try ( SmbFileHandle h = ensureOpen() ) {} this.readSize = th.getReceiveBufferSize() - 70; this.writeSize = th.getSendBufferSize() - 70;
try ( SmbFileHandle h = ensureOpen() ) {} this.readSize = th.getReceiveBufferSize() - 70; this.writeSize = th.getSendBufferSize() - 70;
try ( SmbFileHandleImpl fh = ensureOpen(); SmbTreeHandleImpl th = fh.getTree() ) { int w;
try ( SmbFileHandleImpl fh = ensureOpen(); SmbTreeHandleImpl th = fh.getTree() ) { int w;
try ( SmbFileHandleImpl fh = ensureOpen(); SmbTreeHandleImpl th = fh.getTree() ) {
try ( SmbFileHandleImpl fh = ensureOpen(); SmbTreeHandleImpl th = fh.getTree() ) {
@Override public void setLength ( long newLength ) throws SmbException { try ( SmbFileHandleImpl fh = ensureOpen(); SmbTreeHandleImpl th = fh.getTree() ) { if ( th.isSMB2() ) { Smb2SetInfoRequest req = new Smb2SetInfoRequest(th.getConfig(), fh.getFileId()); req.setFileInformation(new FileEndOfFileInformation(newLength)); th.send(req, RequestParam.NO_RETRY); } else if ( th.hasCapability(SmbConstants.CAP_NT_SMBS) ) { th.send( new Trans2SetFileInformation(th.getConfig(), fh.getFid(), new FileEndOfFileInformation(newLength)), new Trans2SetFileInformationResponse(th.getConfig()), RequestParam.NO_RETRY); } else { // this is the original, COM_WRITE allows truncation but no 64 bit offsets SmbComWriteResponse rsp = new SmbComWriteResponse(th.getConfig()); th.send( new SmbComWrite(th.getConfig(), fh.getFid(), (int) ( newLength & 0xFFFFFFFFL ), 0, this.tmp, 0, 0), rsp, RequestParam.NO_RETRY); } } catch ( CIFSException e ) { throw SmbException.wrap(e); } }
@Override public void setLength ( long newLength ) throws SmbException { try ( SmbFileHandleImpl fh = ensureOpen(); SmbTreeHandleImpl th = fh.getTree() ) { if ( th.isSMB2() ) { Smb2SetInfoRequest req = new Smb2SetInfoRequest(th.getConfig(), fh.getFileId()); req.setFileInformation(new FileEndOfFileInformation(newLength)); th.send(req, RequestParam.NO_RETRY); } else if ( th.hasCapability(SmbConstants.CAP_NT_SMBS) ) { th.send( new Trans2SetFileInformation(th.getConfig(), fh.getFid(), new FileEndOfFileInformation(newLength)), new Trans2SetFileInformationResponse(th.getConfig()), RequestParam.NO_RETRY); } else { // this is the original, COM_WRITE allows truncation but no 64 bit offsets SmbComWriteResponse rsp = new SmbComWriteResponse(th.getConfig()); th.send( new SmbComWrite(th.getConfig(), fh.getFid(), (int) ( newLength & 0xFFFFFFFFL ), 0, this.tmp, 0, 0), rsp, RequestParam.NO_RETRY); } } catch ( CIFSException e ) { throw SmbException.wrap(e); } }