Class DiskStorageWriter

java.lang.Object
nz.org.riskscape.engine.io.DiskStorageWriter
All Implemented Interfaces:
Closeable, AutoCloseable, nz.org.riskscape.engine.io.TupleWriter

public class DiskStorageWriter extends Object implements nz.org.riskscape.engine.io.TupleWriter, Closeable

Wraps a DataOutputStreamTupleWriter to write out to a buffered and byte counted FileOutputStream.

  • Field Details

  • Constructor Details

    • DiskStorageWriter

      public DiskStorageWriter(File file, boolean compressed) throws IOException
      Throws:
      IOException
    • DiskStorageWriter

      public DiskStorageWriter(File file, boolean compressed, com.codahale.metrics.Counter metricsCounter) throws IOException
      Throws:
      IOException
  • Method Details

    • write

      public void write(nz.org.riskscape.engine.Tuple tuple) throws IOException
      Specified by:
      write in interface nz.org.riskscape.engine.io.TupleWriter
      Throws:
      IOException
    • close

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

      public void remove() throws IOException
      Specified by:
      remove in interface nz.org.riskscape.engine.io.TupleWriter
      Throws:
      IOException
    • getBytesWritten

      public long getBytesWritten() throws IOException
      Returns:
      the number of bytes written to the buffer so far.
      Throws:
      IOException
    • getFile

      public File getFile()