Interface ConditionalOutputStream

  • All Superinterfaces:
    java.lang.AutoCloseable

    public interface ConditionalOutputStream
    extends java.lang.AutoCloseable
    Defines a ConditionalOutputStream for a segment. Allows data to be conditionally appended to the end of the segment
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      void close()
      Flushes and then closes the output stream.
      java.lang.String getScopedSegmentName()
      Returns the scoped name of the segment associated to this output stream.
      boolean write​(java.nio.ByteBuffer data, long expectedOffset)
      Writes the provided data to the SegmentOutputStream.
    • Method Detail

      • getScopedSegmentName

        java.lang.String getScopedSegmentName()
        Returns the scoped name of the segment associated to this output stream.
        Returns:
        The name of the segment associated to this output stream.
      • write

        boolean write​(java.nio.ByteBuffer data,
                      long expectedOffset)
               throws SegmentSealedException
        Writes the provided data to the SegmentOutputStream. The data will be written only if the SegmentOutputStream's writeOffset is currently expectedOffset. This is a synchronous and blocking method.
        Parameters:
        data - The data to be added to the segment.
        expectedOffset - The location in the segment that the data will be written at.
        Returns:
        true if the data was appended, false if the offset was not the expected value.
        Throws:
        SegmentSealedException - If the segment is closed for modifications.
      • close

        void close()
        Flushes and then closes the output stream. Frees any resources associated with it.
        Specified by:
        close in interface java.lang.AutoCloseable