Methods Summary |
---|
int | readHeaderWireFormat(java.io.InputStream in, byte[] buffer, int bufferIndex)
type = buffer[bufferIndex++] & 0xFF;
length = (( buffer[bufferIndex] & 0x01 ) << 16 ) + readInt2( buffer, bufferIndex + 1 );
return HEADER_LENGTH;
|
static int | readInt2(byte[] src, int srcIndex)
return (( src[srcIndex] & 0xFF ) << 8 ) +
( src[srcIndex + 1] & 0xFF );
|
static int | readInt4(byte[] src, int srcIndex)
return (( src[srcIndex] & 0xFF ) << 24 ) +
(( src[srcIndex + 1] & 0xFF ) << 16 ) +
(( src[srcIndex + 2] & 0xFF ) << 8 ) +
( src[srcIndex + 3] & 0xFF );
|
static int | readLength(byte[] src, int srcIndex)
srcIndex++;
return (( src[srcIndex++] & 0x01 ) << 16 ) +
(( src[srcIndex++] & 0xFF ) << 8 ) +
( src[srcIndex++] & 0xFF );
|
static int | readPacketType(java.io.InputStream in, byte[] buffer, int bufferIndex)
int n;
if(( n = readn( in, buffer, bufferIndex, HEADER_LENGTH )) != HEADER_LENGTH ) {
if( n == -1 ) {
return -1;
}
throw new IOException( "unexpected EOF reading netbios session header" );
}
int t = buffer[bufferIndex] & 0xFF;
return t;
|
abstract int | readTrailerWireFormat(java.io.InputStream in, byte[] buffer, int bufferIndex)
|
int | readWireFormat(java.io.InputStream in, byte[] buffer, int bufferIndex)
readHeaderWireFormat( in, buffer, bufferIndex );
return HEADER_LENGTH + readTrailerWireFormat( in, buffer, bufferIndex );
|
static int | readn(java.io.InputStream in, byte[] b, int off, int len)
int i = 0, n;
while (i < len) {
n = in.read( b, off + i, len - i );
if (n <= 0) {
break;
}
i += n;
}
return i;
|
int | writeHeaderWireFormat(byte[] dst, int dstIndex)
dst[dstIndex++] = (byte)type;
if( length > 0x0000FFFF ) {
dst[dstIndex] = (byte)0x01;
}
dstIndex++;
writeInt2( length, dst, dstIndex );
return HEADER_LENGTH;
|
static void | writeInt2(int val, byte[] dst, int dstIndex)
dst[dstIndex++] = (byte)(( val >> 8 ) & 0xFF );
dst[dstIndex] = (byte)( val & 0xFF );
|
static void | writeInt4(int val, byte[] dst, int dstIndex)
dst[dstIndex++] = (byte)(( val >> 24 ) & 0xFF );
dst[dstIndex++] = (byte)(( val >> 16 ) & 0xFF );
dst[dstIndex++] = (byte)(( val >> 8 ) & 0xFF );
dst[dstIndex] = (byte)( val & 0xFF );
|
abstract int | writeTrailerWireFormat(byte[] dst, int dstIndex)
|
public int | writeWireFormat(byte[] dst, int dstIndex)
length = writeTrailerWireFormat( dst, dstIndex + HEADER_LENGTH );
writeHeaderWireFormat( dst, dstIndex );
return HEADER_LENGTH + length;
|