Class 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.
    • 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 input ByteBuffer.
      void close()  
      java.nio.channels.WritableByteChannel getChannel()  
      long getPosition()  
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
    • Constructor Detail

      • LocalFileBlockWriter

        public LocalFileBlockWriter​(java.lang.String path)
        Constructs a Block writer given the file path of the block.
        Parameters:
        path - file path of the block
    • 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 input ByteBuffer.
        Specified by:
        append in class BlockWriter
        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 class BlockWriter
        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 class BlockWriter
        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 class BlockWriter
        Returns:
        the current write position (same as the number of bytes written)
      • getChannel

        public java.nio.channels.WritableByteChannel getChannel()
        Specified by:
        getChannel in class BlockWriter
        Returns:
        a writeable byte channel of the block
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Overrides:
        close in class BlockClient
        Throws:
        java.io.IOException