@NotThreadSafe public class BlockOutStream extends java.io.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(java.util.List<DataWriter> dataWriters,
long length,
java.util.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,
java.util.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(java.util.List<DataWriter> dataWriters, long length, java.util.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 BoundedStreampublic static BlockOutStream createReplicatedBlockOutStream(FileSystemContext context, long blockId, long blockSize, java.util.List<WorkerNetAddress> workerNetAddresses, OutStreamOptions options) throws java.io.IOException
context - the file system contextblockId - the block idblockSize - the block sizeworkerNetAddresses - the worker network addressesoptions - the optionsBlockOutStream instance createdjava.io.IOExceptionpublic void write(int b)
throws java.io.IOException
write in class java.io.OutputStreamjava.io.IOExceptionpublic void write(byte[] b)
throws java.io.IOException
write in class java.io.OutputStreamjava.io.IOExceptionpublic void write(byte[] b,
int off,
int len)
throws java.io.IOException
write in class java.io.OutputStreamjava.io.IOExceptionpublic void write(io.netty.buffer.ByteBuf buf)
throws java.io.IOException
buf - the bufferjava.io.IOException - exceptionpublic void write(io.netty.buffer.ByteBuf buf,
int off,
int len)
throws java.io.IOException
buf - the bufferoff - the offsetlen - the lengthjava.io.IOExceptionpublic void flush()
throws java.io.IOException
flush in interface java.io.Flushableflush in class java.io.OutputStreamjava.io.IOExceptionpublic void cancel()
throws java.io.IOException
Cancelablecancel in interface Cancelablejava.io.IOExceptionpublic void close()
throws java.io.IOException
close in interface java.io.Closeableclose in interface java.lang.AutoCloseableclose in class java.io.OutputStreamjava.io.IOExceptionpublic WorkerNetAddress getAddress()
Copyright © 2022. All Rights Reserved.