public interface ByteArrayDataOutput extends DataOutput
An extension of DataOutput
for writing to in-memory byte arrays; its methods offer identical functionality but do not throw IOException
.
Modifier and Type | Method and Description |
---|---|
byte[] |
toByteArray()
Returns the contents that have been written to this instance, as a byte array.
|
void |
write(byte[] b) |
void |
write(byte[] b,
int off,
int len) |
void |
write(int b) |
void |
writeBoolean(boolean v) |
void |
writeByte(int v) |
void |
writeBytes(String s)
Deprecated.
This method is dangerous as it discards the high byte of every character. For UTF-8, use
write(s.getBytes(StandardCharsets.UTF_8)) . |
void |
writeChar(int v) |
void |
writeChars(String s) |
void |
writeDouble(double v) |
void |
writeFloat(float v) |
void |
writeInt(int v) |
void |
writeLong(long v) |
void |
writeShort(int v) |
void |
writeUTF(String s) |
void write(int b)
write
in interface DataOutput
void write(byte[] b)
write
in interface DataOutput
void write(byte[] b, int off, int len)
write
in interface DataOutput
void writeBoolean(boolean v)
writeBoolean
in interface DataOutput
void writeByte(int v)
writeByte
in interface DataOutput
void writeShort(int v)
writeShort
in interface DataOutput
void writeChar(int v)
writeChar
in interface DataOutput
void writeInt(int v)
writeInt
in interface DataOutput
void writeLong(long v)
writeLong
in interface DataOutput
void writeFloat(float v)
writeFloat
in interface DataOutput
void writeDouble(double v)
writeDouble
in interface DataOutput
void writeChars(String s)
writeChars
in interface DataOutput
void writeUTF(String s)
writeUTF
in interface DataOutput
@Deprecated void writeBytes(String s)
write(s.getBytes(StandardCharsets.UTF_8))
.writeBytes
in interface DataOutput
byte[] toByteArray()
Returns the contents that have been written to this instance, as a byte array.