public abstract class ByteBufferWriteOutBytes extends WriteOutBytes
Modifier and Type | Method and Description |
---|---|
protected abstract ByteBuffer |
allocateBuffer() |
InputStream |
asInputStream()
Creates a finite
InputStream with the bytes that are written to this WriteOutBytes so far. |
boolean |
isOpen() |
void |
readFully(long pos,
ByteBuffer buffer)
Reads bytes from the byte sequences, represented by this WriteOutBytes, at the random position, into the given
buffer.
|
long |
size()
Returns the number of bytes written to this WriteOutBytes so far.
|
void |
write(byte[] b) |
void |
write(byte[] b,
int off,
int len) |
int |
write(ByteBuffer src) |
void |
write(int b) |
void |
writeInt(int v)
Writes 4 bytes of the given value in big-endian order, i.
|
void |
writeTo(ByteBuffer out)
Takes all bytes that are written to this WriteOutBytes so far and writes them into the given ByteBuffer.
|
void |
writeTo(WritableByteChannel channel)
Takes all bytes that are written to this WriteOutBytes so far and writes them into the given channel.
|
close
flush
public long size()
WriteOutBytes
size
in class WriteOutBytes
protected abstract ByteBuffer allocateBuffer()
public void write(int b)
write
in class OutputStream
public void writeInt(int v)
WriteOutBytes
DataOutput.writeInt(int)
.writeInt
in class WriteOutBytes
public void write(byte[] b) throws IOException
write
in class OutputStream
IOException
public void write(byte[] b, int off, int len) throws IOException
write
in class OutputStream
IOException
public int write(ByteBuffer src)
public void writeTo(WritableByteChannel channel) throws IOException
WriteOutBytes
writeTo
in class WriteOutBytes
IOException
public void writeTo(ByteBuffer out)
size()
of this WriteOutBytes.BufferOverflowException
- if the Buffer.remaining()
capacity of the given buffer is
smaller than the size of this WriteOutBytespublic void readFully(long pos, ByteBuffer buffer)
WriteOutBytes
readFully
in class WriteOutBytes
public InputStream asInputStream() throws IOException
WriteOutBytes
InputStream
with the bytes that are written to this WriteOutBytes so far. The returned
InputStream must be closed properly after it's used up.asInputStream
in class WriteOutBytes
IOException
public boolean isOpen()
Copyright © 2011–2018. All rights reserved.