in src/main/java/com/pastdev/jsch/nio/file/UnixSshFileSystemProvider.java [190:222]
PosixFileAttributes createFile( UnixSshPath path, FileAttribute<?>... fileAttributes ) throws IOException {
Set<PosixFilePermission> permissions = null;
UserPrincipal owner = null;
GroupPrincipal group = null;
for ( FileAttribute<?> fileAttribute : fileAttributes ) {
String name = fileAttribute.name();
if ( name.equals( "posix:permissions" ) ) {
permissions = (Set<PosixFilePermission>)fileAttribute.value();
}
else if ( name.equals( "posix:owner" ) ) {
owner = (UserPrincipal)fileAttribute.value();
}
else if ( name.equals( "posix:group" ) ) {
group = (GroupPrincipal)fileAttribute.value();
}
}
// TODO i think this can be done with dd atomically
String command = path.getFileSystem().getCommand( "touch" ) + " " + path.toAbsolutePath().quotedString();
executeForStdout( path, command );
if ( permissions != null ) {
setPermissions( path, permissions );
}
if ( owner != null ) {
setOwner( path, owner );
}
if ( group != null ) {
setGroup( path, group );
}
return readAttributes( path, PosixFileAttributes.class );
}