KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > jcifs > smb > SmbComRename


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 jcifs.util.Hexdump;
22
23 class SmbComRename extends ServerMessageBlock {
24
25     private int searchAttributes;
26     private String JavaDoc oldFileName;
27     private String JavaDoc newFileName;
28
29     SmbComRename( String JavaDoc oldFileName, String JavaDoc newFileName ) {
30         command = SMB_COM_RENAME;
31         this.oldFileName = oldFileName;
32         this.newFileName = newFileName;
33         searchAttributes = ATTR_HIDDEN | ATTR_SYSTEM | ATTR_DIRECTORY;
34     }
35
36     int writeParameterWordsWireFormat( byte[] dst, int dstIndex ) {
37         writeInt2( searchAttributes, dst, dstIndex );
38         return 2;
39     }
40     int writeBytesWireFormat( byte[] dst, int dstIndex ) {
41         int start = dstIndex;
42
43         dst[dstIndex++] = (byte)0x04;
44         dstIndex += writeString( oldFileName, dst, dstIndex );
45         dst[dstIndex++] = (byte)0x04;
46         if( useUnicode ) {
47             dst[dstIndex++] = (byte)'\0';
48         }
49         dstIndex += writeString( newFileName, dst, dstIndex );
50
51         return dstIndex - start;
52     }
53     int readParameterWordsWireFormat( byte[] buffer, int bufferIndex ) {
54         return 0;
55     }
56     int readBytesWireFormat( byte[] buffer, int bufferIndex ) {
57         return 0;
58     }
59     public String JavaDoc toString() {
60         return new String JavaDoc( "SmbComRename[" +
61             super.toString() +
62             ",searchAttributes=0x" + Hexdump.toHexString( searchAttributes, 4 ) +
63             ",oldFileName=" + oldFileName +
64             ",newFileName=" + newFileName + "]" );
65     }
66 }
67
Popular Tags