java.lang.Object
org.codelibs.jcifs.smb.internal.smb2.ServerMessageBlock2
org.codelibs.jcifs.smb.internal.smb2.ServerMessageBlock2Request<Smb2WriteResponse>
org.codelibs.jcifs.smb.internal.smb2.io.Smb2WriteRequest
- All Implemented Interfaces:
CommonServerMessageBlock,CommonServerMessageBlockRequest,Request<Smb2WriteResponse>,RequestWithFileId,Message,Request
public class Smb2WriteRequest
extends ServerMessageBlock2Request<Smb2WriteResponse>
implements RequestWithFileId
SMB2 Write request message.
This command is used to write data to a file that has been
previously opened with a Create request.
- Author:
- mbechler
-
Field Summary
FieldsModifier and TypeFieldDescriptionstatic final intThe overhead size in bytes for an SMB2 write request packet.Fields inherited from class org.codelibs.jcifs.smb.internal.smb2.ServerMessageBlock2
SMB2_CANCEL, SMB2_CHANGE_NOTIFY, SMB2_CLOSE, SMB2_CREATE, SMB2_ECHO, SMB2_FLAGS_ASYNC_COMMAND, SMB2_FLAGS_DFS_OPERATIONS, SMB2_FLAGS_PRIORITY_MASK, SMB2_FLAGS_RELATED_OPERATIONS, SMB2_FLAGS_REPLAY_OPERATION, SMB2_FLAGS_SERVER_TO_REDIR, SMB2_FLAGS_SIGNED, SMB2_FLUSH, SMB2_IOCTL, SMB2_LOCK, SMB2_LOGOFF, SMB2_NEGOTIATE, SMB2_OPLOCK_BREAK, SMB2_QUERY_DIRECTORY, SMB2_QUERY_INFO, SMB2_READ, SMB2_SESSION_SETUP, SMB2_SET_INFO, SMB2_TREE_CONNECT, SMB2_TREE_DISCONNECT, SMB2_WRITE -
Constructor Summary
ConstructorsConstructorDescriptionSmb2WriteRequest(Configuration config, byte[] fileId) Creates a new SMB2 write request for writing data to a file. -
Method Summary
Modifier and TypeMethodDescriptionprotected Smb2WriteResponseCreate the response object for this requestprotected intreadBytesWireFormat(byte[] buffer, int bufferIndex) Reads the message body from the wire format.voidsetData(byte[] data, int offset, int length) Sets the data to be written to the file.voidsetFileId(byte[] fileId) Sets the file ID for this request.voidsetOffset(long offset) Sets the file offset where the write operation should begin.voidsetRemainingBytes(int remainingBytes) Sets the number of bytes remaining to be written in a sequence of write operations.voidsetWriteFlags(int writeFlags) Sets the write operation flags.intsize()Gets the size of this message.protected intwriteBytesWireFormat(byte[] dst, int dstIndex) Writes the message body to the wire format.Methods inherited from class org.codelibs.jcifs.smb.internal.smb2.ServerMessageBlock2Request
allowChain, createCancel, encode, getCreditCost, getNext, getOverrideTimeout, getResponse, ignoreDisconnect, initResponse, isCancel, isResponseAsync, setNext, setOverrideTimeout, setRequestCredits, setResponse, setTid, splitMethods inherited from class org.codelibs.jcifs.smb.internal.smb2.ServerMessageBlock2
addFlags, chain, clearFlags, decode, decode, equals, getAsyncId, getCommand, getConfig, getCredit, getCreditCharge, getDigest, getErrorContextCount, getErrorData, getFlags, getHeaderStart, getLength, getMid, getNextCommandOffset, getRawPayload, getSessionId, getStatus, getTreeId, hashCode, haveResponse, isAsync, isErrorResponseStatus, isRetainPayload, pad8, readErrorResponse, readHeaderWireFormat, reset, retainPayload, setAsyncId, setCommand, setCredit, setDigest, setExtendedSecurity, setMid, setNext, setRawPayload, setReadSize, setSessionId, setTreeId, setUid, size8, size8, toString, writeHeaderWireFormatMethods inherited from class java.lang.Object
clone, finalize, getClass, notify, notifyAll, wait, wait, waitMethods inherited from interface org.codelibs.jcifs.smb.internal.CommonServerMessageBlock
decode, getCommand, getDigest, getMid, reset, setCommand, setDigest, setExtendedSecurity, setMid, setSessionId, setUidMethods inherited from interface org.codelibs.jcifs.smb.util.transport.Message
getRawPayload, isRetainPayload, retainPayload, setRawPayload
-
Field Details
-
OVERHEAD
public static final int OVERHEADThe overhead size in bytes for an SMB2 write request packet.- See Also:
-
-
Constructor Details
-
Smb2WriteRequest
Creates a new SMB2 write request for writing data to a file.- Parameters:
config- the CIFS configurationfileId- the file identifier for the target file
-
-
Method Details
-
setFileId
public void setFileId(byte[] fileId) Sets the file ID for this request.- Specified by:
setFileIdin interfaceRequestWithFileId- Parameters:
fileId- the file ID to set- See Also:
-
createResponse
protected Smb2WriteResponse createResponse(CIFSContext tc, ServerMessageBlock2Request<Smb2WriteResponse> req) Description copied from class:ServerMessageBlock2RequestCreate the response object for this request- Specified by:
createResponsein classServerMessageBlock2Request<Smb2WriteResponse>- Parameters:
tc- the CIFS contextreq- the request object- Returns:
- the response object
-
setData
public void setData(byte[] data, int offset, int length) Sets the data to be written to the file.- Parameters:
data- the data buffer to writeoffset- the offset in the data bufferlength- the number of bytes to write
-
setRemainingBytes
public void setRemainingBytes(int remainingBytes) Sets the number of bytes remaining to be written in a sequence of write operations.- Parameters:
remainingBytes- the remainingBytes to set
-
setWriteFlags
public void setWriteFlags(int writeFlags) Sets the write operation flags.- Parameters:
writeFlags- the writeFlags to set
-
setOffset
public void setOffset(long offset) Sets the file offset where the write operation should begin.- Parameters:
offset- the offset to set
-
size
public int size()Gets the size of this message.- Specified by:
sizein interfaceCommonServerMessageBlockRequest- Returns:
- the size of this message
- See Also:
-
writeBytesWireFormat
protected int writeBytesWireFormat(byte[] dst, int dstIndex) Writes the message body to the wire format.- Specified by:
writeBytesWireFormatin classServerMessageBlock2- Parameters:
dst- the destination bufferdstIndex- the starting position in the buffer- Returns:
- number of bytes written
- See Also:
-
readBytesWireFormat
protected int readBytesWireFormat(byte[] buffer, int bufferIndex) Reads the message body from the wire format.- Specified by:
readBytesWireFormatin classServerMessageBlock2- Parameters:
buffer- the buffer to read frombufferIndex- the starting position in the buffer- Returns:
- number of bytes read
- See Also:
-