FileDocCategorySizeDatePackage
SmbComWriteAndX.javaAPI DocJCIFS 1.3.17 API4482Tue Oct 18 15:26:24 BST 2011jcifs.smb

SmbComWriteAndX

public class SmbComWriteAndX extends AndXServerMessageBlock

Fields Summary
private static final int
READ_ANDX_BATCH_LIMIT
private static final int
CLOSE_BATCH_LIMIT
private int
fid
private int
remaining
private int
dataLength
private int
dataOffset
private int
off
private byte[]
b
private long
offset
private int
pad
int
writeMode
Constructors Summary
SmbComWriteAndX()


     
        super( null );
        command = SMB_COM_WRITE_ANDX;
    
SmbComWriteAndX(int fid, long offset, int remaining, byte[] b, int off, int len, ServerMessageBlock andx)

        super( andx );
        this.fid = fid;
        this.offset = offset;
        this.remaining = remaining;
        this.b = b;
        this.off = off;
        dataLength = len;
        command = SMB_COM_WRITE_ANDX;
    
Methods Summary
intgetBatchLimit(byte command)

        if( command == SMB_COM_READ_ANDX ) {
            return READ_ANDX_BATCH_LIMIT;
        }
        if( command == SMB_COM_CLOSE ) {
            return CLOSE_BATCH_LIMIT;
        }
        return 0;
    
intreadBytesWireFormat(byte[] buffer, int bufferIndex)

        return 0;
    
intreadParameterWordsWireFormat(byte[] buffer, int bufferIndex)

        return 0;
    
voidsetParam(int fid, long offset, int remaining, byte[] b, int off, int len)

        this.fid = fid;
        this.offset = offset;
        this.remaining = remaining;
        this.b = b;
        this.off = off;
        dataLength = len;
        digest = null; /* otherwise recycled commands
                        * like writeandx will choke if session
                        * closes in between */
    
public java.lang.StringtoString()

        return new String( "SmbComWriteAndX[" +
            super.toString() +
            ",fid=" + fid +
            ",offset=" + offset +
            ",writeMode=" + writeMode +
            ",remaining=" + remaining +
            ",dataLength=" + dataLength +
            ",dataOffset=" + dataOffset + "]" );
    
intwriteBytesWireFormat(byte[] dst, int dstIndex)

        int start = dstIndex;

while( pad-- > 0 ) {
    dst[dstIndex++] = (byte)0xEE;
}
        System.arraycopy( b, off, dst, dstIndex, dataLength );
        dstIndex += dataLength;

        return dstIndex - start;
    
intwriteParameterWordsWireFormat(byte[] dst, int dstIndex)

        int start = dstIndex;

        dataOffset = (dstIndex - headerStart) + 26; // 26 = off from here to pad

pad = ( dataOffset - headerStart ) % 4;
pad = pad == 0 ? 0 : 4 - pad;
dataOffset += pad;

        writeInt2( fid, dst, dstIndex );
        dstIndex += 2;
        writeInt4( offset, dst, dstIndex );
        dstIndex += 4;
        for( int i = 0; i < 4; i++ ) {
            dst[dstIndex++] = (byte)0xFF;
        }
        writeInt2( writeMode, dst, dstIndex );
        dstIndex += 2;
        writeInt2( remaining, dst, dstIndex );
        dstIndex += 2;
        dst[dstIndex++] = (byte)0x00;
        dst[dstIndex++] = (byte)0x00;
        writeInt2( dataLength, dst, dstIndex );
        dstIndex += 2;
        writeInt2( dataOffset, dst, dstIndex );
        dstIndex += 2;
        writeInt4( offset >> 32, dst, dstIndex );
        dstIndex += 4;

        return dstIndex - start;