Class RandomAccessFileManager

All Implemented Interfaces:
AutoCloseable, ByteBufferDestination

public class RandomAccessFileManager extends OutputStreamManager
Extends OutputStreamManager but instead of using a buffered output stream, this class uses a ByteBuffer and a RandomAccessFile to do the I/O.
  • Constructor Details

  • Method Details

    • getFileManager

      public static RandomAccessFileManager getFileManager(String fileName, boolean append, boolean immediateFlush, int bufferSize, String advertiseURI, Layout<? extends Serializable> layout, Configuration configuration)
      Returns the RandomAccessFileManager.
      Parameters:
      fileName - The name of the file to manage.
      append - true if the file should be appended to, false if it should be overwritten.
      immediateFlush - true if the contents should be flushed to disk on every write
      bufferSize - The buffer size.
      advertiseURI - the URI to use when advertising the file
      layout - The layout.
      configuration - The configuration.
      Returns:
      A RandomAccessFileManager for the File.
    • isEndOfBatch

      @Deprecated public Boolean isEndOfBatch()
      Deprecated.
      end-of-batch on the event is used instead.
      No longer used, the LogEvent.isEndOfBatch() attribute is used instead.
      Returns:
      Boolean.FALSE.
    • setEndOfBatch

      @Deprecated public void setEndOfBatch(boolean endOfBatch)
      Deprecated.
      end-of-batch on the event is used instead.
      No longer used, the LogEvent.isEndOfBatch() attribute is used instead. This method is a no-op.
    • writeToDestination

      protected void writeToDestination(byte[] bytes, int offset, int length)
      Description copied from class: OutputStreamManager
      Writes the specified section of the specified byte array to the stream.
      Overrides:
      writeToDestination in class OutputStreamManager
      Parameters:
      bytes - the array containing data
      offset - from where to write
      length - how many bytes to write
    • flush

      public void flush()
      Description copied from class: OutputStreamManager
      Flushes any buffers.
      Overrides:
      flush in class OutputStreamManager
    • closeOutputStream

      public boolean closeOutputStream()
      Overrides:
      closeOutputStream in class OutputStreamManager
    • getFileName

      public String getFileName()
      Returns the name of the File being managed.
      Returns:
      The name of the File being managed.
    • getBufferSize

      public int getBufferSize()
      Returns the buffer capacity.
      Returns:
      the buffer size
    • getContentFormat

      public Map<String,String> getContentFormat()
      Gets this FileManager's content format specified by:

      Key: "fileURI" Value: provided "advertiseURI" param.

      Overrides:
      getContentFormat in class AbstractManager
      Returns:
      Map of content format keys supporting FileManager