SmbFileOutputStream ( SmbFile file, SmbTreeHandleImpl th, SmbFileHandleImpl handle, int openFlags, int access, int sharing ) throws CIFSException { this.file = file; this.handle = handle; this.openFlags = openFlags; this.access = access; this.sharing = sharing; this.append = false; this.smb2 = th.isSMB2(); init(th); }
SmbFileOutputStream ( SmbFile file, SmbTreeHandleImpl th, SmbFileHandleImpl handle, int openFlags, int access, int sharing ) throws CIFSException { this.file = file; this.handle = handle; this.openFlags = openFlags; this.access = access; this.sharing = sharing; this.append = false; this.smb2 = th.isSMB2(); init(th); }
SmbFileOutputStream ( SmbFile file, boolean append, int openFlags, int access, int sharing ) throws SmbException { this.file = file; this.append = append; this.openFlags = openFlags; this.sharing = sharing; this.access = access | SmbConstants.FILE_WRITE_DATA; try ( SmbTreeHandleImpl th = file.ensureTreeConnected() ) { this.smb2 = th.isSMB2(); try ( SmbFileHandleImpl fh = ensureOpen() ) { if ( append ) { this.fp = fh.getInitialSize(); } init(th); if ( !append && this.smb2 ) { // no open option for truncating, need to truncate the file Smb2SetInfoRequest treq = new Smb2SetInfoRequest(th.getConfig(), fh.getFileId()); treq.setFileInformation(new FileEndOfFileInformation(0)); th.send(treq, RequestParam.NO_RETRY); } } } catch ( CIFSException e ) { throw SmbException.wrap(e); } }
SmbFileOutputStream ( SmbFile file, boolean append, int openFlags, int access, int sharing ) throws SmbException { this.file = file; this.append = append; this.openFlags = openFlags; this.sharing = sharing; this.access = access | SmbConstants.FILE_WRITE_DATA; try ( SmbTreeHandleImpl th = file.ensureTreeConnected() ) { this.smb2 = th.isSMB2(); try ( SmbFileHandleImpl fh = ensureOpen() ) { if ( append ) { this.fp = fh.getInitialSize(); } init(th); if ( !append && this.smb2 ) { // no open option for truncating, need to truncate the file Smb2SetInfoRequest treq = new Smb2SetInfoRequest(th.getConfig(), fh.getFileId()); treq.setFileInformation(new FileEndOfFileInformation(0)); th.send(treq, RequestParam.NO_RETRY); } } } catch ( CIFSException e ) { throw SmbException.wrap(e); } }