Interface Page

All Superinterfaces:
AutoCloseable, Block, org.aksw.commons.io.util.channel.ChannelFactory<Seekable>, Segment
All Known Implementing Classes:
PageBase

public interface Page extends Block
A page is a fixed size sequence of bytes obtained from a page manager backed by a ByteBuffer. Only the last page may have a smaller size than the others. A page does not provide its own release mechanism. Instead, the page manager returns a Reference<Page>. A page is only released iff all its references are released, hence any release action is associated with the reference. Usually the release action is performed immediately by the thread that releases the last reference.
Author:
raven
  • Method Summary

    Modifier and Type
    Method
    Description
    long
    Offset in a parent container; should be 0 if there is none
     
    default boolean
    Check if there is a subsequent block.
    default boolean
     
    default long
    Retrieve the length of the segment For segments that are based on encoded data this method may trigger a full read.
    Return a byte buffer for the page with freshly initialized positioning i.e.
    default Seekable
     
    default Ref<? extends Page>
    The block source of this block - if any.
    default Ref<? extends Block>
     

    Methods inherited from interface java.lang.AutoCloseable

    close
  • Method Details

    • getOffset

      long getOffset()
      Description copied from interface: Block
      Offset in a parent container; should be 0 if there is none
      Specified by:
      getOffset in interface Block
      Returns:
    • getPageManager

      PageManager getPageManager()
    • newBuffer

      ByteBuffer newBuffer()
      Return a byte buffer for the page with freshly initialized positioning i.e. the returned byte buffer should be created using originalBuffer.duplicate()
      Returns:
    • prevBlock

      default Ref<? extends Block> prevBlock() throws IOException
      Specified by:
      prevBlock in interface Block
      Throws:
      IOException
    • nextBlock

      default Ref<? extends Page> nextBlock() throws IOException
      Description copied from interface: Block
      The block source of this block - if any.
      Specified by:
      nextBlock in interface Block
      Returns:
      the block source or null if there is none
      Throws:
      IOException
    • hasNext

      default boolean hasNext() throws IOException
      Check if there is a subsequent block.
      Specified by:
      hasNext in interface Block
      Returns:
      Throws:
      IOException
    • hasPrev

      default boolean hasPrev() throws IOException
      Specified by:
      hasPrev in interface Block
      Throws:
      IOException
    • length

      default long length() throws IOException
      Description copied from interface: Segment
      Retrieve the length of the segment For segments that are based on encoded data this method may trigger a full read. Therefore, this method should be used with care.
      Specified by:
      length in interface Segment
      Returns:
      Throws:
      IOException
    • newChannel

      default Seekable newChannel()
      Specified by:
      newChannel in interface org.aksw.commons.io.util.channel.ChannelFactory<Seekable>