public class DNSOutput
extends java.lang.Object
Constructor and Description |
---|
DNSOutput()
Create a new DNSOutput
|
DNSOutput(int size)
Create a new DNSOutput with a specified size.
|
Modifier and Type | Method and Description |
---|---|
int |
current()
Returns the current position.
|
void |
jump(int index)
Resets the current position of the output stream to the specified index.
|
void |
restore()
Restores the input stream to its state before the call to
save() . |
void |
save()
Saves the current state of the output stream.
|
byte[] |
toByteArray()
Returns a byte array containing the current contents of the stream.
|
void |
writeByteArray(byte[] b)
Writes a byte array to the stream.
|
void |
writeByteArray(byte[] b,
int off,
int len)
Writes a byte array to the stream.
|
void |
writeCountedString(byte[] s)
Writes a counted string from the stream.
|
void |
writeU16(int val)
Writes an unsigned 16 bit value to the stream.
|
void |
writeU16At(int val,
int where)
Writes an unsigned 16 bit value to the specified position in the stream.
|
void |
writeU32(long val)
Writes an unsigned 32 bit value to the stream.
|
void |
writeU8(int val)
Writes an unsigned 8 bit value to the stream.
|
public DNSOutput(int size)
size
- The initial sizepublic DNSOutput()
public int current()
public void jump(int index)
index
- The new current position.java.lang.IllegalArgumentException
- The index is not within the output.public void save()
java.lang.IllegalArgumentException
- The index is not within the output.public void restore()
save()
.public void writeU8(int val)
val
- The value to be writtenpublic void writeU16(int val)
val
- The value to be writtenpublic void writeU16At(int val, int where)
val
- The value to be writtenwhere
- The position to write the value.public void writeU32(long val)
val
- The value to be writtenpublic void writeByteArray(byte[] b, int off, int len)
b
- The array to write.off
- The offset of the array to start copying data from.len
- The number of bytes to write.public void writeByteArray(byte[] b)
b
- The array to write.public void writeCountedString(byte[] s)
s
- The string to write.public byte[] toByteArray()
Copyright © 2019 dnsjava.org. All rights reserved.