1 18 19 package jcifs.smb; 20 21 import jcifs.Config; 22 23 class SmbComWrite extends ServerMessageBlock { 24 25 private int fid, 26 count, 27 offset, 28 remaining, 29 off; 30 private byte[] b; 31 32 SmbComWrite() { 33 super(); 34 command = SMB_COM_WRITE; 35 } 36 SmbComWrite( int fid, int offset, int remaining, byte[] b, int off, int len ) { 37 this.fid = fid; 38 this.count = len; 39 this.offset = offset; 40 this.remaining = remaining; 41 this.b = b; 42 this.off = off; 43 command = SMB_COM_WRITE; 44 } 45 46 void setParam( int fid, long offset, int remaining, 47 byte[] b, int off, int len ) { 48 this.fid = fid; 49 this.offset = (int)(offset & 0xFFFFFFFFL); 50 this.remaining = remaining; 51 this.b = b; 52 this.off = off; 53 count = len; 54 digest = null; 57 } 58 int writeParameterWordsWireFormat( byte[] dst, int dstIndex ) { 59 int start = dstIndex; 60 61 writeInt2( fid, dst, dstIndex ); 62 dstIndex += 2; 63 writeInt2( count, dst, dstIndex ); 64 dstIndex += 2; 65 writeInt4( offset, dst, dstIndex ); 66 dstIndex += 4; 67 writeInt2( remaining, dst, dstIndex ); 68 dstIndex += 2; 69 70 return dstIndex - start; 71 } 72 int writeBytesWireFormat( byte[] dst, int dstIndex ) { 73 int start = dstIndex; 74 75 dst[dstIndex++] = (byte)0x01; 76 writeInt2( count, dst, dstIndex ); 77 dstIndex += 2; 78 System.arraycopy( b, off, dst, dstIndex, count ); 79 dstIndex += count; 80 81 return dstIndex - start; 82 } 83 int readParameterWordsWireFormat( byte[] buffer, int bufferIndex ) { 84 return 0; 85 } 86 int readBytesWireFormat( byte[] buffer, int bufferIndex ) { 87 return 0; 88 } 89 public String toString() { 90 return new String ( "SmbComWrite[" + 91 super.toString() + 92 ",fid=" + fid + 93 ",count=" + count + 94 ",offset=" + offset + 95 ",remaining=" + remaining + "]" ); 96 } 97 } 98 | Popular Tags |