Class FrameFileWriter

java.lang.Object
org.apache.druid.frame.file.FrameFileWriter
All Implemented Interfaces:
Closeable, AutoCloseable

public class FrameFileWriter extends Object implements Closeable
Writer for FrameFile. See that class for format information.
  • Field Details

  • Method Details

    • open

      public static FrameFileWriter open(WritableByteChannel channel, @Nullable ByteBuffer compressionBuffer, ByteTracker byteTracker)
      Opens a writer for a particular channel.
      Parameters:
      channel - destination channel
      compressionBuffer - result of Frame.compressionBufferSize(long) for the largest possible frame size that will be written to this file, or null to allocate buffers dynamically. Providing an explicit buffer here, if possible, improves performance.
      byteTracker - tracker to limit the number of bytes that can be written to the frame file
    • writeFrame

      public void writeFrame(Frame frame, int partition) throws IOException
      Write a frame.
      Parameters:
      frame - the frame
      partition - partition number for a partitioned frame file, or NO_PARTITION for an unpartitioned file. Must be monotonically increasing.
      Throws:
      IOException
    • abort

      public void abort() throws IOException
      Stops writing this file and closes early. Readers will be able to detect that the file is truncated due to the lack of MARKER_NO_MORE_FRAMES. After calling this method, close() does nothing.
      Throws:
      IOException
    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Specified by:
      close in interface Closeable
      Throws:
      IOException