@NotThreadSafe public final class LocalFileDataWriter extends Object implements DataWriter
DataWriter.Factory
Modifier and Type | Method and Description |
---|---|
void |
cancel()
Cancels an operation.
|
int |
chunkSize() |
void |
close() |
static LocalFileDataWriter |
create(FileSystemContext context,
WorkerNetAddress address,
long blockId,
long blockSize,
OutStreamOptions options)
Creates an instance of
LocalFileDataWriter . |
void |
flush()
Flushes all the pending chunks.
|
Optional<String> |
getUfsContentHash() |
long |
pos() |
void |
writeChunk(io.netty.buffer.ByteBuf buf)
Writes a chunk.
|
public static LocalFileDataWriter create(FileSystemContext context, WorkerNetAddress address, long blockId, long blockSize, OutStreamOptions options) throws IOException
LocalFileDataWriter
. This requires the block to be locked
beforehand.context
- the file system contextaddress
- the worker network addressblockId
- the block IDblockSize
- the block size in bytesoptions
- the output stream optionsLocalFileDataWriter
createdIOException
public long pos()
pos
in interface DataWriter
public int chunkSize()
chunkSize
in interface DataWriter
public Optional<String> getUfsContentHash()
getUfsContentHash
in interface DataWriter
public void writeChunk(io.netty.buffer.ByteBuf buf) throws IOException
DataWriter
writeChunk
in interface DataWriter
buf
- the chunkIOException
public void cancel() throws IOException
Cancelable
cancel
in interface Cancelable
IOException
public void flush()
DataWriter
flush
in interface DataWriter
public void close() throws IOException
close
in interface Closeable
close
in interface AutoCloseable
IOException
Copyright © 2023. All Rights Reserved.