Package alluxio.worker.block.io
Class LocalFileBlockWriter
- java.lang.Object
-
- alluxio.worker.block.io.BlockClient
-
- alluxio.worker.block.io.BlockWriter
-
- alluxio.worker.block.io.LocalFileBlockWriter
-
- All Implemented Interfaces:
java.io.Closeable
,java.lang.AutoCloseable
@NotThreadSafe public class LocalFileBlockWriter extends BlockWriter
This class provides write access to a temp block data file locally stored in managed storage.
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from class alluxio.worker.block.io.BlockClient
BlockClient.Type
-
-
Constructor Summary
Constructors Constructor Description LocalFileBlockWriter(java.lang.String path)
Constructs a Block writer given the file path of the block.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
append(DataBuffer buffer)
Appends buffer.readableBytes() bytes to the end of this block writer from the given buffer.long
append(io.netty.buffer.ByteBuf buf)
Appends buf.readableBytes() bytes to the end of this block writer from the given buf.long
append(java.nio.ByteBuffer inputBuf)
Appends data to the end of a block from an inputByteBuffer
.void
close()
java.nio.channels.WritableByteChannel
getChannel()
long
getPosition()
-
Methods inherited from class alluxio.worker.block.io.BlockClient
toString
-
-
-
-
Method Detail
-
append
public long append(java.nio.ByteBuffer inputBuf)
Description copied from class:BlockWriter
Appends data to the end of a block from an inputByteBuffer
.- Specified by:
append
in classBlockWriter
- Parameters:
inputBuf
-ByteBuffer
that input data is stored in- Returns:
- the size of data that was appended in bytes
-
append
public long append(io.netty.buffer.ByteBuf buf) throws java.io.IOException
Description copied from class:BlockWriter
Appends buf.readableBytes() bytes to the end of this block writer from the given buf.- Specified by:
append
in classBlockWriter
- Parameters:
buf
- the byte buffer that holds the data- Returns:
- the size of data that was appended in bytes
- Throws:
java.io.IOException
-
append
public long append(DataBuffer buffer) throws java.io.IOException
Description copied from class:BlockWriter
Appends buffer.readableBytes() bytes to the end of this block writer from the given buffer.- Specified by:
append
in classBlockWriter
- Parameters:
buffer
- the byte buffer that holds the data- Returns:
- the size of data that was appended in bytes
- Throws:
java.io.IOException
-
getPosition
public long getPosition()
- Specified by:
getPosition
in classBlockWriter
- Returns:
- the current write position (same as the number of bytes written)
-
getChannel
public java.nio.channels.WritableByteChannel getChannel()
- Specified by:
getChannel
in classBlockWriter
- Returns:
- a writeable byte channel of the block
-
close
public void close() throws java.io.IOException
- Specified by:
close
in interfacejava.lang.AutoCloseable
- Specified by:
close
in interfacejava.io.Closeable
- Overrides:
close
in classBlockClient
- Throws:
java.io.IOException
-
-