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