Package nl.sidnlabs.dnslib.message.util
Class NetworkData
- java.lang.Object
-
- nl.sidnlabs.dnslib.message.util.NetworkData
-
public class NetworkData extends Object
-
-
Constructor Summary
Constructors Constructor Description NetworkData()NetworkData(byte[] data)NetworkData(byte[] data, int offset, int length)Allow for data buffer with additional data.NetworkData(int size)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description intbytesAvailable()intgetReaderIndex()intgetWriterIndex()booleanisBytesAvailable()intlength()voidmarkReaderIndex()byte[]readBytes()voidreadBytes(byte[] destination)voidreadBytes(byte[] dst, int pos, int len)byte[]readBytes(int len, int max)Read limited number of bytes into result (max param), but always return result with size of len param. addional bytes are zero.shortreadUnsignedByte()charreadUnsignedChar()longreadUnsignedInt()voidresetReaderIndex()voidrewind(int bytes)voidsetReaderIndex(int index)voidsetReaderIndex(int index, boolean abs)byte[]write()voidwriteByte(int b)voidwriteBytes(byte[] b)voidwriteChar(int c)voidwriteInt(long i)
-
-
-
Constructor Detail
-
NetworkData
public NetworkData(int size)
-
NetworkData
public NetworkData()
-
NetworkData
public NetworkData(byte[] data)
-
NetworkData
public NetworkData(byte[] data, int offset, int length)Allow for data buffer with additional data. Data before position marked by offset and after position marked by length will be ignored.- Parameters:
data-offset-length-
-
-
Method Detail
-
length
public int length()
-
bytesAvailable
public int bytesAvailable()
-
isBytesAvailable
public boolean isBytesAvailable()
-
readUnsignedInt
public long readUnsignedInt()
-
readUnsignedByte
public short readUnsignedByte()
-
readUnsignedChar
public char readUnsignedChar()
-
readBytes
public byte[] readBytes()
-
readBytes
public void readBytes(byte[] destination)
-
readBytes
public byte[] readBytes(int len, int max)Read limited number of bytes into result (max param), but always return result with size of len param. addional bytes are zero.- Parameters:
len- the size of return byte[]max- the max number of bytes read from buffer- Returns:
- fixed sized array
-
readBytes
public void readBytes(byte[] dst, int pos, int len)
-
writeChar
public void writeChar(int c)
-
writeByte
public void writeByte(int b)
-
writeBytes
public void writeBytes(byte[] b)
-
writeInt
public void writeInt(long i)
-
write
public byte[] write()
-
getReaderIndex
public int getReaderIndex()
-
setReaderIndex
public void setReaderIndex(int index)
-
setReaderIndex
public void setReaderIndex(int index, boolean abs)
-
getWriterIndex
public int getWriterIndex()
-
markReaderIndex
public void markReaderIndex()
-
resetReaderIndex
public void resetReaderIndex()
-
rewind
public void rewind(int bytes)
-
-