01: /* jcifs smb client library in Java
02: * Copyright (C) 2000 "Michael B. Allen" <jcifs at samba dot org>
03: *
04: * This library is free software; you can redistribute it and/or
05: * modify it under the terms of the GNU Lesser General Public
06: * License as published by the Free Software Foundation; either
07: * version 2.1 of the License, or (at your option) any later version.
08: *
09: * This library is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
12: * Lesser General Public License for more details.
13: *
14: * You should have received a copy of the GNU Lesser General Public
15: * License along with this library; if not, write to the Free Software
16: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17: */
18:
19: package jcifs.smb;
20:
21: import java.io.IOException;
22: import java.io.InputStream;
23:
24: class SmbComReadAndXResponse extends AndXServerMessageBlock {
25:
26: private int dataCompactionMode, dataOffset;
27:
28: byte[] b;
29: int dataLength, off;
30:
31: SmbComReadAndXResponse() {
32: }
33:
34: SmbComReadAndXResponse(byte[] b, int off) {
35: this .b = b;
36: this .off = off;
37: }
38:
39: void setParam(byte[] b, int off) {
40: this .b = b;
41: this .off = off;
42: }
43:
44: int writeParameterWordsWireFormat(byte[] dst, int dstIndex) {
45: return 0;
46: }
47:
48: int writeBytesWireFormat(byte[] dst, int dstIndex) {
49: return 0;
50: }
51:
52: int readParameterWordsWireFormat(byte[] buffer, int bufferIndex) {
53: int start = bufferIndex;
54:
55: bufferIndex += 2; // reserved
56: dataCompactionMode = readInt2(buffer, bufferIndex);
57: bufferIndex += 4; // 2 reserved
58: dataLength = readInt2(buffer, bufferIndex);
59: bufferIndex += 2;
60: dataOffset = readInt2(buffer, bufferIndex);
61: bufferIndex += 12; // 10 reserved
62:
63: return bufferIndex - start;
64: }
65:
66: int readBytesWireFormat(byte[] buffer, int bufferIndex) {
67: return 0;
68: }
69:
70: int readBytesDirectWireFormat(InputStream in, int byteCount,
71: byte[] buffer, int bufferIndex) throws IOException {
72: int pad = dataOffset - (HEADER_LENGTH + 3 + wordCount * 2);
73: in.read(buffer, bufferIndex, pad); /* needed for signing */
74: in.read(b, off, dataLength);
75: return pad + dataLength;
76: }
77:
78: public String toString() {
79: return new String("SmbComReadAndXResponse[" + super .toString()
80: + ",dataCompactionMode=" + dataCompactionMode
81: + ",dataLength=" + dataLength + ",dataOffset="
82: + dataOffset + "]");
83: }
84: }
|