1 17 package org.alfresco.filesys.smb.server; 18 19 import org.alfresco.filesys.util.DataPacker; 20 21 26 class NTParameterPacker 27 { 28 29 31 private byte[] m_buf; 32 private int m_pos; 33 34 39 public NTParameterPacker(byte[] buf) 40 { 41 m_buf = buf; 42 m_pos = SMBSrvPacket.PARAMWORDS; 43 } 44 45 51 public NTParameterPacker(byte[] buf, int pos) 52 { 53 m_buf = buf; 54 m_pos = pos; 55 } 56 57 62 public final void packByte(byte val) 63 { 64 m_buf[m_pos++] = val; 65 } 66 67 72 public final void packByte(int val) 73 { 74 m_buf[m_pos++] = (byte) val; 75 } 76 77 82 public final void packWord(int val) 83 { 84 DataPacker.putIntelShort(val, m_buf, m_pos); 85 m_pos += 2; 86 } 87 88 93 public final void packInt(int val) 94 { 95 DataPacker.putIntelInt(val, m_buf, m_pos); 96 m_pos += 4; 97 } 98 99 104 public final void packLong(long val) 105 { 106 DataPacker.putIntelLong(val, m_buf, m_pos); 107 m_pos += 8; 108 } 109 110 115 public final int getPosition() 116 { 117 return m_pos; 118 } 119 120 125 public final byte[] getBuffer() 126 { 127 return m_buf; 128 } 129 130 135 public final int unpackByte() 136 { 137 return (int) m_buf[m_pos++]; 138 } 139 140 145 public final int unpackWord() 146 { 147 int val = DataPacker.getIntelShort(m_buf, m_pos); 148 m_pos += 2; 149 return val; 150 } 151 152 157 public final int unpackInt() 158 { 159 int val = DataPacker.getIntelInt(m_buf, m_pos); 160 m_pos += 4; 161 return val; 162 } 163 164 169 public final long unpackLong() 170 { 171 long val = DataPacker.getIntelLong(m_buf, m_pos); 172 m_pos += 8; 173 return val; 174 } 175 176 182 public final void reset(byte[] buf, int pos) 183 { 184 m_buf = buf; 185 m_pos = pos; 186 } 187 } 188 | Popular Tags |