1 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 oldFileName; 27 private String newFileName; 28 29 SmbComRename( String oldFileName, String 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 toString() { 60 return new String ( "SmbComRename[" + 61 super.toString() + 62 ",searchAttributes=0x" + Hexdump.toHexString( searchAttributes, 4 ) + 63 ",oldFileName=" + oldFileName + 64 ",newFileName=" + newFileName + "]" ); 65 } 66 } 67 | Popular Tags |