Interface Positional

  • All Superinterfaces:
    LocationAware
    All Known Implementing Classes:
    PositionalBufferedStream

    public interface Positional
    extends LocationAware
    Minimal interface for an object at support getting the current position in the stream / writer / file, as well as a handful of other reader-like features.
    • Method Summary

      All Methods Instance Methods Abstract Methods 
      Modifier and Type Method Description
      boolean isDone()
      Is the stream done? Equivalent to ! hasNext() for an iterator?
      int peek()
      Return the next byte in the first, without actually reading it from the stream.
      long skip​(long nBytes)
      Skip the next nBytes in the stream.
    • Method Detail

      • isDone

        boolean isDone()
                throws IOException
        Is the stream done? Equivalent to ! hasNext() for an iterator?
        Returns:
        true if the stream has reached EOF, false otherwise
        Throws:
        IOException
      • skip

        long skip​(long nBytes)
           throws IOException
        Skip the next nBytes in the stream.
        Parameters:
        nBytes - to skip, must be >= 0
        Returns:
        the number of bytes actually skippped.
        Throws:
        IOException
      • peek

        int peek()
          throws IOException
        Return the next byte in the first, without actually reading it from the stream. Has the same output as read()
        Returns:
        the next byte, or -1 if EOF encountered
        Throws:
        IOException