public class ExtendedByteArrayDataOutput extends ByteArrayOutputStream implements ExtendedDataOutput
buf, count| Constructor and Description |
|---|
ExtendedByteArrayDataOutput()
Creates a new byte array output stream.
|
ExtendedByteArrayDataOutput(byte[] buf)
Uses the byte array provided or if null, use a default size
|
ExtendedByteArrayDataOutput(byte[] buf,
int pos)
Uses the byte array provided at the given pos
|
ExtendedByteArrayDataOutput(int size)
Creates a new byte array output stream, with a buffer capacity of
the specified size, in bytes.
|
| Modifier and Type | Method and Description |
|---|---|
void |
ensureWritable(int minSize)
Ensure that backing byte structure has at least minSize
additional bytes
|
byte[] |
getByteArray()
Get the internal byte array (if possible), read-only
|
int |
getPos()
Get the position in the output stream
|
void |
skipBytes(int bytesToSkip)
Skip some number of bytes.
|
byte[] |
toByteArray(int offset,
int length)
Return a copy of slice of byte array
|
void |
writeBoolean(boolean v) |
void |
writeByte(int v) |
void |
writeBytes(String s) |
void |
writeChar(int v) |
void |
writeChars(String s) |
void |
writeDouble(double v) |
void |
writeFloat(float v) |
void |
writeInt(int v) |
void |
writeInt(int position,
int value)
In order to write a size as a first part of an data output, it is
useful to be able to write an int at an arbitrary location in the stream
|
void |
writeLong(long v) |
void |
writeShort(int v) |
void |
writeUTF(String s) |
close, reset, size, toByteArray, toString, toString, toString, write, write, writeToflush, writeclone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, waitreset, toByteArraywrite, write, writepublic ExtendedByteArrayDataOutput(byte[] buf)
buf - Buffer to usepublic ExtendedByteArrayDataOutput(byte[] buf,
int pos)
buf - Buffer to usepos - Position in the buffer to start writing frompublic ExtendedByteArrayDataOutput()
public ExtendedByteArrayDataOutput(int size)
size - the initial size.IllegalArgumentException - if size is negative.public void writeBoolean(boolean v)
throws IOException
writeBoolean in interface DataOutputIOExceptionpublic void writeByte(int v)
throws IOException
writeByte in interface DataOutputIOExceptionpublic void writeShort(int v)
throws IOException
writeShort in interface DataOutputIOExceptionpublic void writeChar(int v)
throws IOException
writeChar in interface DataOutputIOExceptionpublic void writeInt(int v)
throws IOException
writeInt in interface DataOutputIOExceptionpublic void writeLong(long v)
throws IOException
writeLong in interface DataOutputIOExceptionpublic void writeFloat(float v)
throws IOException
writeFloat in interface DataOutputIOExceptionpublic void writeDouble(double v)
throws IOException
writeDouble in interface DataOutputIOExceptionpublic void writeBytes(String s) throws IOException
writeBytes in interface DataOutputIOExceptionpublic void writeChars(String s) throws IOException
writeChars in interface DataOutputIOExceptionpublic void writeUTF(String s) throws IOException
writeUTF in interface DataOutputIOExceptionpublic void ensureWritable(int minSize)
ExtendedDataOutputensureWritable in interface ExtendedDataOutputminSize - additional size requiredpublic void skipBytes(int bytesToSkip)
ExtendedDataOutputskipBytes in interface ExtendedDataOutputbytesToSkip - Number of bytes to skippublic void writeInt(int position,
int value)
ExtendedDataOutputwriteInt in interface ExtendedDataOutputposition - Byte position in the output streamvalue - Value to writepublic byte[] toByteArray(int offset,
int length)
ExtendedDataOutputtoByteArray in interface ExtendedDataOutputoffset - offset of arraylength - length of slicepublic byte[] getByteArray()
ExtendedDataOutputgetByteArray in interface ExtendedDataOutputpublic int getPos()
ExtendedDataOutputgetPos in interface ExtendedDataOutputCopyright © 2011-2020 The Apache Software Foundation. All Rights Reserved.