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.util.Date;
22: import jcifs.util.Hexdump;
23:
24: class SmbComQueryInformationResponse extends ServerMessageBlock
25: implements Info {
26:
27: private int fileAttributes = 0x0000;
28: private long lastWriteTime = 0L;
29: private long serverTimeZoneOffset;
30: private int fileSize = 0;
31:
32: SmbComQueryInformationResponse(long serverTimeZoneOffset) {
33: this .serverTimeZoneOffset = serverTimeZoneOffset;
34: command = SMB_COM_QUERY_INFORMATION;
35: }
36:
37: public int getAttributes() {
38: return fileAttributes;
39: }
40:
41: public long getCreateTime() {
42: return lastWriteTime + serverTimeZoneOffset;
43: }
44:
45: public long getLastWriteTime() {
46: return lastWriteTime + serverTimeZoneOffset;
47: }
48:
49: public long getSize() {
50: return fileSize;
51: }
52:
53: int writeParameterWordsWireFormat(byte[] dst, int dstIndex) {
54: return 0;
55: }
56:
57: int writeBytesWireFormat(byte[] dst, int dstIndex) {
58: return 0;
59: }
60:
61: int readParameterWordsWireFormat(byte[] buffer, int bufferIndex) {
62: if (wordCount == 0) {
63: return 0;
64: }
65: fileAttributes = readInt2(buffer, bufferIndex);
66: bufferIndex += 2;
67: lastWriteTime = readUTime(buffer, bufferIndex);
68: bufferIndex += 4;
69: fileSize = readInt4(buffer, bufferIndex);
70: return 20;
71: }
72:
73: int readBytesWireFormat(byte[] buffer, int bufferIndex) {
74: return 0;
75: }
76:
77: public String toString() {
78: return new String("SmbComQueryInformationResponse["
79: + super .toString() + ",fileAttributes=0x"
80: + Hexdump.toHexString(fileAttributes, 4)
81: + ",lastWriteTime=" + new Date(lastWriteTime)
82: + ",fileSize=" + fileSize + "]");
83: }
84: }
|