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