@NotThreadSafe public class BlockOutStream extends OutputStream implements BoundedStream, Cancelable
OutputStream
implementation that is based on PacketWriter
which
streams data packet by packet.Modifier | Constructor and Description |
---|---|
protected |
BlockOutStream(PacketWriter packetWriter,
long length,
WorkerNetAddress address)
Constructs a new
BlockOutStream with only one PacketWriter . |
Modifier and Type | Method and Description |
---|---|
void |
cancel()
Cancels an operation.
|
void |
close() |
static BlockOutStream |
create(FileSystemContext context,
long blockId,
long blockSize,
WorkerNetAddress address,
OutStreamOptions options)
Creates an
BlockOutStream . |
void |
flush() |
WorkerNetAddress |
getAddress() |
long |
remaining() |
void |
write(byte[] b) |
void |
write(byte[] b,
int off,
int len) |
void |
write(int b) |
protected BlockOutStream(PacketWriter packetWriter, long length, WorkerNetAddress address)
BlockOutStream
with only one PacketWriter
.packetWriter
- the packet writerlength
- the length of the streamaddress
- the Alluxio worker addresspublic static BlockOutStream create(FileSystemContext context, long blockId, long blockSize, 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
objectIOException
public long remaining()
remaining
in interface BoundedStream
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 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.