public abstract class WriteOutBytes extends OutputStream implements WritableByteChannel
OutputStream
, WritableByteChannel
and writeInt(int)
append to the sequence. Methods writeTo(WritableByteChannel)
and asInputStream()
allow to write the sequence somewhere else. readFully(long, java.nio.ByteBuffer)
allows to access the sequence randomly.
WriteOutBytes is a resource that is managed by SegmentWriteOutMedium
, so it's own close()
method
does nothing. However WriteOutBytes should appear closed, i. e. Channel.isOpen()
returns false, after the parental
SegmentWriteOutMedium is closed.Constructor and Description |
---|
WriteOutBytes() |
Modifier and Type | Method and Description |
---|---|
abstract InputStream |
asInputStream()
Creates a finite
InputStream with the bytes that are written to this WriteOutBytes so far. |
void |
close()
Deprecated.
does nothing.
|
abstract void |
readFully(long pos,
ByteBuffer buffer)
Reads bytes from the byte sequences, represented by this WriteOutBytes, at the random position, into the given
buffer.
|
abstract long |
size()
Returns the number of bytes written to this WriteOutBytes so far.
|
abstract void |
writeInt(int v)
Writes 4 bytes of the given value in big-endian order, i.
|
abstract void |
writeTo(WritableByteChannel channel)
Takes all bytes that are written to this WriteOutBytes so far and writes them into the given channel.
|
flush, write, write, write
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
write
public abstract void writeInt(int v) throws IOException
DataOutput.writeInt(int)
.IOException
public abstract long size() throws IOException
IOException
public abstract void writeTo(WritableByteChannel channel) throws IOException
IOException
public abstract InputStream asInputStream() throws IOException
InputStream
with the bytes that are written to this WriteOutBytes so far. The returned
InputStream must be closed properly after it's used up.IOException
public abstract void readFully(long pos, ByteBuffer buffer) throws IOException
BufferUnderflowException
- if the byte sequence from the given pos ends before the given buffer
is filledIllegalArgumentException
- if the given pos is negativeIOException
@Deprecated public final void close()
close
in interface Closeable
close
in interface AutoCloseable
close
in interface Channel
close
in class OutputStream
Copyright © 2011–2018. All rights reserved.