Package com.google.common.io
Interface ByteArrayDataOutput
-
- All Superinterfaces:
java.io.DataOutput
@GwtIncompatible public interface ByteArrayDataOutput extends java.io.DataOutput
An extension ofDataOutput
for writing to in-memory byte arrays; its methods offer identical functionality but do not throwIOException
.- Since:
- 1.0
- Author:
- Jayaprabhakar Kadarkarai
-
-
Method Summary
All Methods Instance Methods Abstract Methods Deprecated Methods Modifier and Type Method 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(java.lang.String s)
Deprecated.This method is dangerous as it discards the high byte of every character.void
writeChar(int v)
void
writeChars(java.lang.String s)
void
writeDouble(double v)
void
writeFloat(float v)
void
writeInt(int v)
void
writeLong(long v)
void
writeShort(int v)
void
writeUTF(java.lang.String s)
-
-
-
Method Detail
-
write
void write(int b)
- Specified by:
write
in interfacejava.io.DataOutput
-
write
void write(byte[] b)
- Specified by:
write
in interfacejava.io.DataOutput
-
write
void write(byte[] b, int off, int len)
- Specified by:
write
in interfacejava.io.DataOutput
-
writeBoolean
void writeBoolean(boolean v)
- Specified by:
writeBoolean
in interfacejava.io.DataOutput
-
writeByte
void writeByte(int v)
- Specified by:
writeByte
in interfacejava.io.DataOutput
-
writeShort
void writeShort(int v)
- Specified by:
writeShort
in interfacejava.io.DataOutput
-
writeChar
void writeChar(int v)
- Specified by:
writeChar
in interfacejava.io.DataOutput
-
writeInt
void writeInt(int v)
- Specified by:
writeInt
in interfacejava.io.DataOutput
-
writeLong
void writeLong(long v)
- Specified by:
writeLong
in interfacejava.io.DataOutput
-
writeFloat
void writeFloat(float v)
- Specified by:
writeFloat
in interfacejava.io.DataOutput
-
writeDouble
void writeDouble(double v)
- Specified by:
writeDouble
in interfacejava.io.DataOutput
-
writeChars
void writeChars(java.lang.String s)
- Specified by:
writeChars
in interfacejava.io.DataOutput
-
writeUTF
void writeUTF(java.lang.String s)
- Specified by:
writeUTF
in interfacejava.io.DataOutput
-
writeBytes
@Deprecated void writeBytes(java.lang.String s)
Deprecated.This method is dangerous as it discards the high byte of every character. For UTF-8, usewrite(s.getBytes(StandardCharsets.UTF_8))
.- Specified by:
writeBytes
in interfacejava.io.DataOutput
-
toByteArray
byte[] toByteArray()
Returns the contents that have been written to this instance, as a byte array.
-
-