Interface QueueFile

    • Method Summary

      All Methods Instance Methods Abstract Methods Default Methods 
      Modifier and Type Method Description
      default void add​(byte[] data)
      Adds an element to the end of the queue.
      void add​(byte[] data, int offset, int count)
      Adds an element to the end of the queue.
      long availableBytes()
      Returns the number of bytes available for adding new tasks without growing the file.
      void clear()
      Clears this queue.
      default boolean isEmpty()
      Checks whether this queue is empty.
      byte[] peek()
      Reads the eldest element.
      void remove()
      Removes the eldest element.
      int size()
      Returns the number of elements in this queue.
      long storageBytes()
      Returns the storage size (on-disk file size) in bytes.
      long usedBytes()
      Returns the number of bytes used for data.
    • Method Detail

      • add

        default void add​(byte[] data)
                  throws IOException
        Adds an element to the end of the queue.
        Parameters:
        data - to copy bytes from
        Throws:
        IOException
      • add

        void add​(byte[] data,
                 int offset,
                 int count)
          throws IOException
        Adds an element to the end of the queue.
        Parameters:
        data - to copy bytes from
        offset - to start from in buffer
        count - number of bytes to copy
        Throws:
        IndexOutOfBoundsException - if offset < 0 or count < 0, or if offset + count is bigger than the length of buffer.
        IOException
      • clear

        void clear()
            throws IOException
        Clears this queue. Truncates the file to the initial size.
        Throws:
        IOException
      • isEmpty

        default boolean isEmpty()
        Checks whether this queue is empty.
        Returns:
        true if this queue contains no entries
      • peek

        @Nullable
        byte[] peek()
             throws IOException
        Reads the eldest element. Returns null if the queue is empty.
        Returns:
        the eldest element.
        Throws:
        IOException
      • size

        int size()
        Returns the number of elements in this queue.
      • storageBytes

        long storageBytes()
        Returns the storage size (on-disk file size) in bytes.
        Returns:
        file size in bytes.
      • usedBytes

        long usedBytes()
        Returns the number of bytes used for data.
        Returns:
        bytes used.
      • availableBytes

        long availableBytes()
        Returns the number of bytes available for adding new tasks without growing the file.
        Returns:
        bytes available.