use of com.hierynomus.mssmb2.SMB2CreateOptions in project iaf by ibissource.
the class Samba2FileSystem method createFile.
@Override
public OutputStream createFile(String f) throws FileSystemException, IOException {
Set<AccessMask> accessMask = new HashSet<AccessMask>(EnumSet.of(AccessMask.FILE_ADD_FILE));
Set<SMB2CreateOptions> createOptions = new HashSet<SMB2CreateOptions>(EnumSet.of(SMB2CreateOptions.FILE_NON_DIRECTORY_FILE, SMB2CreateOptions.FILE_WRITE_THROUGH));
final File file = diskShare.openFile(f, accessMask, null, SMB2ShareAccess.ALL, SMB2CreateDisposition.FILE_OVERWRITE_IF, createOptions);
OutputStream out = file.getOutputStream();
FilterOutputStream fos = new FilterOutputStream(out) {
boolean isOpen = true;
@Override
public void close() throws IOException {
if (isOpen) {
super.close();
isOpen = false;
}
file.close();
}
};
return fos;
}
use of com.hierynomus.mssmb2.SMB2CreateOptions in project iaf by ibissource.
the class Samba2FileSystemTestHelper method getFile.
private File getFile(String filename, AccessMask accessMask, SMB2CreateDisposition createDisposition) {
Set<SMB2ShareAccess> shareAccess = new HashSet<SMB2ShareAccess>();
shareAccess.addAll(SMB2ShareAccess.ALL);
Set<SMB2CreateOptions> createOptions = new HashSet<SMB2CreateOptions>();
createOptions.add(SMB2CreateOptions.FILE_WRITE_THROUGH);
Set<AccessMask> accessMaskSet = new HashSet<AccessMask>();
accessMaskSet.add(accessMask);
File file;
file = diskShare.openFile(filename, accessMaskSet, null, shareAccess, createDisposition, createOptions);
return file;
}
use of com.hierynomus.mssmb2.SMB2CreateOptions in project iaf by ibissource.
the class Samba2FileSystemTestHelper method _createFile.
@Override
public OutputStream _createFile(String folder, String filename) throws Exception {
Set<AccessMask> accessMask = new HashSet<AccessMask>(EnumSet.of(AccessMask.FILE_ADD_FILE));
Set<SMB2CreateOptions> createOptions = new HashSet<SMB2CreateOptions>(EnumSet.of(SMB2CreateOptions.FILE_NON_DIRECTORY_FILE, SMB2CreateOptions.FILE_WRITE_THROUGH));
final File file = diskShare.openFile(filename, accessMask, null, SMB2ShareAccess.ALL, SMB2CreateDisposition.FILE_OVERWRITE_IF, createOptions);
OutputStream out = file.getOutputStream();
FilterOutputStream fos = new FilterOutputStream(out) {
boolean isOpen = true;
@Override
public void close() throws IOException {
if (isOpen) {
super.close();
isOpen = false;
}
file.close();
}
};
return fos;
}
use of com.hierynomus.mssmb2.SMB2CreateOptions in project iaf by ibissource.
the class Samba2FileSystem method getFile.
private File getFile(String filename, AccessMask accessMask, SMB2CreateDisposition createDisposition) {
Set<SMB2ShareAccess> shareAccess = new HashSet<SMB2ShareAccess>();
shareAccess.addAll(SMB2ShareAccess.ALL);
Set<SMB2CreateOptions> createOptions = new HashSet<SMB2CreateOptions>();
createOptions.add(SMB2CreateOptions.FILE_WRITE_THROUGH);
Set<AccessMask> accessMaskSet = new HashSet<AccessMask>();
accessMaskSet.add(accessMask);
File file;
file = diskShare.openFile(filename, accessMaskSet, null, shareAccess, createDisposition, createOptions);
return file;
}
Aggregations