I have files that need an extra attribute called "encryption used". But this gives "IllegalArgumentExeption". I know why it gives that error, "encryption used" isn't known as an attribute, but is there a way I can force it to be? Or add custom metadata to the file?
Path path = new File("/propertyfiles/encdec.properties").toPath();
try{
Files.setAttribute(path, "encryption used", "testtesttest");
}catch(IOException e){
System.out.println(e.getMessage());
}
try{
System.out.println(Files.getAttribute(path, "encryption used"));
}catch(IOException e){
System.out.println(e.getMessage());
}
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…