Skip to content

Instantly share code, notes, and snippets.

Embed
What would you like to do?
File serverFile = new File(dir.getAbsolutePath()
+ file.getOriginalFilename());
serverFile.setWritable(true, false);
serverFile.setExecutable(true, false);
serverFile.setReadable(true, false);
BufferedOutputStream stream = null;
stream = new BufferedOutputStream(new FileOutputStream(serverFile));
stream.write(bytes);
stream.close();
Set perms = new HashSet();
perms.add(PosixFilePermission.OWNER_READ);
perms.add(PosixFilePermission.OWNER_WRITE);
perms.add(PosixFilePermission.OTHERS_READ);
perms.add(PosixFilePermission.OTHERS_WRITE);
Files.setPosixFilePermissions(serverFile.toPath(), perms);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.