@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 |
---|---|
|
BlockOutStream(DataWriter dataWriter,
long length,
WorkerNetAddress address)
Constructs a new
BlockOutStream with only one DataWriter . |
protected |
BlockOutStream(List<DataWriter> dataWriters,
long length,
List<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 |
createReplicatedBlockOutStream(FileSystemContext context,
long blockId,
long blockSize,
List<WorkerNetAddress> workerNetAddresses,
OutStreamOptions options)
Creates a new remote block output stream.
|
void |
flush() |
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) |
public BlockOutStream(DataWriter dataWriter, long length, 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<WorkerNetAddress> workerNetAddresses)
BlockOutStream
with only one DataWriter
.dataWriters
- the data writerlength
- the length of the streamworkerNetAddresses
- the worker network addressespublic long remaining()
remaining
in interface BoundedStream
public static BlockOutStream createReplicatedBlockOutStream(FileSystemContext context, long blockId, long blockSize, List<WorkerNetAddress> workerNetAddresses, OutStreamOptions options) throws IOException
context
- the file system contextblockId
- the block idblockSize
- the block sizeworkerNetAddresses
- the worker network addressesoptions
- the optionsBlockOutStream
instance createdIOException
public void write(int b) throws IOException
write
in class OutputStream
IOException
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 void write(io.netty.buffer.ByteBuf buf) throws IOException
buf
- the bufferIOException
public void write(io.netty.buffer.ByteBuf buf, int off, int len) throws IOException
buf
- the bufferoff
- the offsetlen
- the lengthIOException
public void flush() throws IOException
flush
in interface Flushable
flush
in class OutputStream
IOException
public void cancel() throws IOException
Cancelable
cancel
in interface Cancelable
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
close
in class OutputStream
IOException
public WorkerNetAddress getAddress()
Copyright © 2023. All Rights Reserved.