Package nl.sidnlabs.dnslib.message.util
Class NetworkData
java.lang.Object
nl.sidnlabs.dnslib.message.util.NetworkData
-
Constructor Summary
ConstructorsConstructorDescriptionNetworkData(byte[] data) NetworkData(byte[] data, int offset, int length) Allow for data buffer with additional data.NetworkData(int size) -
Method Summary
Modifier and TypeMethodDescriptionintintbyte[]intbooleanintlength()voidbyte[]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.shortcharlongvoidvoidrewind(int bytes) voidsetReaderIndex(int index) voidsetReaderIndex(int index, boolean abs) update(byte[] data, int offset, int length) byte[]write()voidwriteByte(int b) voidwriteBytes(byte[] b) voidwriteChar(int c) voidwriteInt(long i)
-
Constructor Details
-
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 Details
-
update
-
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) -
getStringDecodeBuffer
public byte[] getStringDecodeBuffer()
-