@NotThreadSafe public class BlockOutStream extends OutputStream implements BoundedStream, Cancelable
OutputStream implementation that is based on DataWriter which
streams data chunk by chunk.| Modifier | Constructor and Description |
|---|---|
protected |
BlockOutStream(DataWriter dataWriter,
long length,
alluxio.wire.WorkerNetAddress address)
Constructs a new
BlockOutStream with only one DataWriter. |
protected |
BlockOutStream(List<DataWriter> dataWriters,
long length,
List<alluxio.wire.WorkerNetAddress> workerNetAddresses)
Constructs a new
BlockOutStream with only one DataWriter. |
| Modifier and Type | Method and Description |
|---|---|
void |
cancel()
Cancels an operation.
|
void |
close() |
static BlockOutStream |
create(FileSystemContext context,
long blockId,
long blockSize,
alluxio.wire.WorkerNetAddress address,
OutStreamOptions options)
Creates an
BlockOutStream. |
static BlockOutStream |
createReplicatedBlockOutStream(FileSystemContext context,
long blockId,
long blockSize,
List<alluxio.wire.WorkerNetAddress> workerNetAddresses,
OutStreamOptions options)
Creates a new remote block output stream.
|
void |
flush() |
alluxio.wire.WorkerNetAddress |
getAddress() |
long |
remaining() |
void |
write(byte[] b) |
void |
write(byte[] b,
int off,
int len) |
void |
write(io.netty.buffer.ByteBuf buf)
Writes the data in the specified byte buf to this output stream.
|
void |
write(io.netty.buffer.ByteBuf buf,
int off,
int len)
Writes len bytes from the specified byte buf starting at offset off to this output stream.
|
void |
write(int b) |
protected BlockOutStream(DataWriter dataWriter, long length, alluxio.wire.WorkerNetAddress address)
BlockOutStream with only one DataWriter.dataWriter - the data writerlength - the length of the streamaddress - the Alluxio worker addressprotected BlockOutStream(List<DataWriter> dataWriters, long length, List<alluxio.wire.WorkerNetAddress> workerNetAddresses)
BlockOutStream with only one DataWriter.dataWriters - the data writerlength - the length of the streamworkerNetAddresses - the worker network addressespublic static BlockOutStream create(FileSystemContext context, long blockId, long blockSize, alluxio.wire.WorkerNetAddress address, OutStreamOptions options) throws IOException
BlockOutStream.context - the file system contextblockId - the block IDblockSize - the block size in bytesaddress - the Alluxio worker addressoptions - the out stream optionsOutputStream objectIOExceptionpublic long remaining()
remaining in interface BoundedStreampublic static BlockOutStream createReplicatedBlockOutStream(FileSystemContext context, long blockId, long blockSize, List<alluxio.wire.WorkerNetAddress> workerNetAddresses, OutStreamOptions options) throws IOException
context - the file system contextblockId - the block idblockSize - the block sizeworkerNetAddresses - the worker network addressesoptions - the optionsBlockOutStream instance createdIOExceptionpublic void write(int b)
throws IOException
write in class OutputStreamIOExceptionpublic void write(byte[] b)
throws IOException
write in class OutputStreamIOExceptionpublic void write(byte[] b,
int off,
int len)
throws IOException
write in class OutputStreamIOExceptionpublic void write(io.netty.buffer.ByteBuf buf)
throws IOException
buf - the bufferIOExceptionpublic void write(io.netty.buffer.ByteBuf buf,
int off,
int len)
throws IOException
buf - the bufferoff - the offsetlen - the lengthIOExceptionpublic void flush()
throws IOException
flush in interface Flushableflush in class OutputStreamIOExceptionpublic void cancel()
throws IOException
Cancelablecancel in interface CancelableIOExceptionpublic void close()
throws IOException
close in interface Closeableclose in interface AutoCloseableclose in class OutputStreamIOExceptionpublic alluxio.wire.WorkerNetAddress getAddress()
Copyright © 2024. All Rights Reserved.