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