KickJava   Java API By Example, From Geeks To Geeks.

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