Interface FrameWriter

    • Method Detail

      • addSelection

        boolean addSelection()
        Write the current row to the frame that is under construction, if there is enough space to do so.

        If this method returns false on an empty frame, or in a situation where starting a new frame is impractical, it is conventional (although not required) for the caller to throw FrameRowTooLargeException.

        Returns:
        true if the row was written, false if there was not enough space
      • getNumRows

        int getNumRows()
        Returns the number of rows written so far.
      • writeTo

        long writeTo​(org.apache.datasketches.memory.WritableMemory memory,
                     long position)
        Writes the frame to the provided memory location, which must have at least getTotalSize() bytes available. Once this method is called, the frame writer is no longer usable and must be closed. Returns the number of bytes written, which will equal getTotalSize().
        Throws:
        IllegalStateException - if the provided memory does not have sufficient space to write this frame.
      • toByteArray

        default byte[] toByteArray()
        Returns a frame as a newly-allocated byte array. Once this method is called, the frame writer is no longer usable and must be closed. In general, it is more efficient to write a frame into a pre-existing buffer, but this method is provided as a convenience.