KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > com > knowgate > jcifs > smb > SmbComQueryInformationResponse


1 /* jcifs smb client library in Java
2  * Copyright (C) 2000 "Michael B. Allen" <jcifs at samba dot org>
3  *
4  * This library is free software; you can redistribute it and/or
5  * modify it under the terms of the GNU Lesser General Public
6  * License as published by the Free Software Foundation; either
7  * version 2.1 of the License, or (at your option) any later version.
8  *
9  * 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 JavaDoc;
22
23 import com.knowgate.misc.Gadgets;
24
25 class SmbComQueryInformationResponse extends ServerMessageBlock 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     public long getCreateTime() {
41         return lastWriteTime + serverTimeZoneOffset;
42     }
43     public long getLastWriteTime() {
44         return lastWriteTime + serverTimeZoneOffset;
45     }
46     public long getSize() {
47         return fileSize;
48     }
49     int writeParameterWordsWireFormat( byte[] dst, int dstIndex ) {
50         return 0;
51     }
52     int writeBytesWireFormat( byte[] dst, int dstIndex ) {
53         return 0;
54     }
55     int readParameterWordsWireFormat( byte[] buffer, int bufferIndex ) {
56         if( wordCount == 0 ) {
57             return 0;
58         }
59         fileAttributes = readInt2( buffer, bufferIndex );
60         bufferIndex += 2;
61         lastWriteTime = readUTime( buffer, bufferIndex );
62         bufferIndex += 4;
63         fileSize = readInt4( buffer, bufferIndex );
64         return 20;
65     }
66     int readBytesWireFormat( byte[] buffer, int bufferIndex ) {
67         return 0;
68     }
69     public String JavaDoc toString() {
70         return new String JavaDoc( "SmbComQueryInformationResponse[" +
71             super.toString() +
72             ",fileAttributes=0x" + Gadgets.toHexString( fileAttributes, 4 ) +
73             ",lastWriteTime=" + new Date JavaDoc( lastWriteTime ) +
74             ",fileSize=" + fileSize + "]" );
75     }
76 }
77
78
Popular Tags