3

I want to create a Path with Files.createFile(path, FileAttributes...)

How can I get a set of default FileAttributes to create a File on Windows?

0

1 Answer 1

1

Here is basic example for your cause.

public static void main(String[] args) throws IOException {

        BasicFileAttributes thisFileBasicAttributes = null;
        Path pathOfThisFile = Paths.get("/myKey.store");
        System.out.println(pathOfThisFile);
        try{
        thisFileBasicAttributes = Files.readAttributes(pathOfThisFile, BasicFileAttributes.class);
        Object fileKeyBasic = thisFileBasicAttributes.fileKey();
        String output = "Basic: " + fileKeyBasic.toString();
        System.out.println(output);
        }
        catch(IOException exception)
        {
            System.err.println("JVM reported an exception, please take a look at" + exception);
        }

    }
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.