KickJava   Java API By Example, From Geeks To Geeks.

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


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 import java.io.IOException JavaDoc;
23 import java.io.InputStream JavaDoc;
24
25 import com.knowgate.misc.Gadgets;
26
27 class SmbComNTCreateAndXResponse extends AndXServerMessageBlock {
28
29     static final int EXCLUSIVE_OPLOCK_GRANTED = 1;
30     static final int BATCH_OPLOCK_GRANTED = 2;
31     static final int LEVEL_II_OPLOCK_GRANTED = 3;
32
33     byte oplockLevel;
34     int fid,
35         createAction,
36         extFileAttributes,
37         fileType,
38         deviceState;
39     long creationTime,
40         lastAccessTime,
41         lastWriteTime,
42         changeTime,
43         allocationSize,
44         endOfFile;
45     boolean directory;
46
47     SmbComNTCreateAndXResponse() {
48     }
49
50     int writeParameterWordsWireFormat( byte[] dst, int dstIndex ) {
51         return 0;
52     }
53     int writeBytesWireFormat( byte[] dst, int dstIndex ) {
54         return 0;
55     }
56     int readParameterWordsWireFormat( byte[] buffer, int bufferIndex ) {
57         int start = bufferIndex;
58
59         oplockLevel = buffer[bufferIndex++];
60         fid = readInt2( buffer, bufferIndex );
61         bufferIndex += 2;
62         createAction = readInt4( buffer, bufferIndex );
63         bufferIndex += 4;
64         creationTime = readTime( buffer, bufferIndex );
65         bufferIndex += 8;
66         lastAccessTime = readTime( buffer, bufferIndex );
67         bufferIndex += 8;
68         lastWriteTime = readTime( buffer, bufferIndex );
69         bufferIndex += 8;
70         changeTime = readTime( buffer, bufferIndex );
71         bufferIndex += 8;
72         extFileAttributes = readInt4( buffer, bufferIndex );
73         bufferIndex += 4;
74         allocationSize = readInt8( buffer, bufferIndex );
75         bufferIndex += 8;
76         endOfFile = readInt8( buffer, bufferIndex );
77         bufferIndex += 8;
78         fileType = readInt2( buffer, bufferIndex );
79         bufferIndex += 2;
80         deviceState = readInt2( buffer, bufferIndex );
81         bufferIndex += 2;
82         directory = ( buffer[bufferIndex++] & 0xFF ) > 0;
83
84         return bufferIndex - start;
85     }
86     int readBytesWireFormat( byte[] buffer, int bufferIndex ) {
87         return 0;
88     }
89     int readBytesDirectWireFormat( InputStream JavaDoc in, int byteCount,
90                 byte[] buffer, int bufferIndex ) throws IOException JavaDoc {
91         return 0;
92     }
93     public String JavaDoc toString() {
94         return new String JavaDoc( "SmbComNTCreateAndXResponse[" +
95             super.toString() +
96             ",oplockLevel=" + oplockLevel +
97             ",fid=" + fid +
98             ",createAction=0x" + Gadgets.toHexString( createAction, 4 ) +
99             ",creationTime=" + new Date JavaDoc( creationTime ) +
100             ",lastAccessTime=" + new Date JavaDoc( lastAccessTime ) +
101             ",lastWriteTime=" + new Date JavaDoc( lastWriteTime ) +
102             ",changeTime=" + new Date JavaDoc( changeTime ) +
103             ",extFileAttributes=0x" + Gadgets.toHexString( extFileAttributes, 4 ) +
104             ",allocationSize=" + allocationSize +
105             ",endOfFile=" + endOfFile +
106             ",fileType=" + fileType +
107             ",deviceState=" + deviceState +
108             ",directory=" + directory + "]" );
109     }
110 }
111
Popular Tags