Module jcifs

Class SmbComWrite

java.lang.Object
org.codelibs.jcifs.smb.internal.smb1.ServerMessageBlock
org.codelibs.jcifs.smb.internal.smb1.com.SmbComWrite
All Implemented Interfaces:
CommonServerMessageBlock, CommonServerMessageBlockRequest, CommonServerMessageBlockResponse, RequestWithPath, Message, Request, Response

public class SmbComWrite extends ServerMessageBlock
SMB1 COM_WRITE command implementation. This command writes data to an open file on the server. It's the basic write operation in the SMB1 protocol.
  • Constructor Details

    • SmbComWrite

      public SmbComWrite(Configuration config)
      Constructs an empty write request.
      Parameters:
      config - the configuration to use
    • SmbComWrite

      public SmbComWrite(Configuration config, int fid, int offset, int remaining, byte[] b, int off, int len)
      Constructs a write request to write data to a file.
      Parameters:
      config - the configuration to use
      fid - the file identifier
      offset - the file offset at which to write
      remaining - the number of bytes remaining to be written
      b - the data buffer containing bytes to write
      off - the offset in the buffer where data starts
      len - the number of bytes to write
  • Method Details

    • setParam

      public final void setParam(int fid, long offset, int remaining, byte[] b, int off, int len)
      Sets the parameters for this write request.
      Parameters:
      fid - the file identifier
      offset - the file offset at which to write
      remaining - the number of bytes remaining to be written
      b - the data buffer containing bytes to write
      off - the offset in the buffer where data starts
      len - the number of bytes to write
    • writeParameterWordsWireFormat

      protected int writeParameterWordsWireFormat(byte[] dst, int dstIndex)
      Description copied from class: ServerMessageBlock
      Writes the parameter words portion of the SMB message to the wire format.
      Specified by:
      writeParameterWordsWireFormat in class ServerMessageBlock
      Parameters:
      dst - the destination buffer
      dstIndex - the starting offset in the buffer
      Returns:
      the number of bytes written
    • writeBytesWireFormat

      protected int writeBytesWireFormat(byte[] dst, int dstIndex)
      Description copied from class: ServerMessageBlock
      Writes the data bytes portion of the SMB message to the wire format.
      Specified by:
      writeBytesWireFormat in class ServerMessageBlock
      Parameters:
      dst - the destination buffer
      dstIndex - the starting offset in the buffer
      Returns:
      the number of bytes written
    • readParameterWordsWireFormat

      protected int readParameterWordsWireFormat(byte[] buffer, int bufferIndex)
      Description copied from class: ServerMessageBlock
      Reads the parameter words portion of the SMB message from the wire format.
      Specified by:
      readParameterWordsWireFormat in class ServerMessageBlock
      Parameters:
      buffer - the buffer containing the message data
      bufferIndex - the starting offset in the buffer
      Returns:
      the number of bytes read
    • readBytesWireFormat

      protected int readBytesWireFormat(byte[] buffer, int bufferIndex)
      Description copied from class: ServerMessageBlock
      Reads the data bytes portion of the SMB message from the wire format.
      Specified by:
      readBytesWireFormat in class ServerMessageBlock
      Parameters:
      buffer - the buffer containing the message data
      bufferIndex - the starting offset in the buffer
      Returns:
      the number of bytes read
    • toString

      public String toString()
      Overrides:
      toString in class ServerMessageBlock