Java Code Examples for com.hierynomus.smbj.share.File#getOutputStream()
The following examples show how to use
com.hierynomus.smbj.share.File#getOutputStream() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: Samba2FileSystem.java From iaf with Apache License 2.0 | 8 votes |
@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; }
Example 2
Source File: Samba2FileSystem.java From iaf with Apache License 2.0 | 6 votes |
@Override public OutputStream appendFile(String f) throws FileSystemException, IOException { final File file = getFile(f, AccessMask.FILE_APPEND_DATA, SMB2CreateDisposition.FILE_OPEN_IF); 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; }