@NotThreadSafe public final class NettyPacketWriter extends Object implements PacketWriter
PacketWriter.Factory
Modifier and Type | Method and Description |
---|---|
void |
cancel()
Cancels an operation.
|
void |
close() |
static NettyPacketWriter |
create(FileSystemContext context,
WorkerNetAddress address,
long id,
long length,
Protocol.RequestType type,
OutStreamOptions options) |
void |
flush()
Flushes all the pending packets.
|
int |
packetSize() |
long |
pos() |
void |
writePacket(io.netty.buffer.ByteBuf buf)
Writes a packet.
|
public static NettyPacketWriter create(FileSystemContext context, WorkerNetAddress address, long id, long length, Protocol.RequestType type, OutStreamOptions options) throws IOException
context
- the file system contextaddress
- the data server addressid
- the block or UFS IDlength
- the length of the block or file to write, set to Long.MAX_VALUE if unknowntype
- type of the write requestoptions
- the options of the output streamNettyPacketWriter
IOException
public long pos()
pos
in interface PacketWriter
public void writePacket(io.netty.buffer.ByteBuf buf) throws IOException
PacketWriter
writePacket
in interface PacketWriter
buf
- the packetIOException
public void cancel()
Cancelable
cancel
in interface Cancelable
public void flush() throws IOException
PacketWriter
flush
in interface PacketWriter
IOException
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
public int packetSize()
packetSize
in interface PacketWriter
Copyright © 2023. All Rights Reserved.