Class ContinuousStringStream

java.lang.Object
com.mastfrog.util.streams.ContinuousStringStream
All Implemented Interfaces:
AutoCloseable

public final class ContinuousStringStream extends Object implements AutoCloseable
An InputStream-like construct which does not acknowledge the end of files.
  • Constructor Details

    • ContinuousStringStream

      public ContinuousStringStream(FileChannel fileChannel, int readBufferSizeInBytes)
  • Method Details

    • isOpen

      public boolean isOpen()
    • position

      public long position() throws IOException
      Get the postion the next read will come from
      Returns:
      The position in the file
      Throws:
      IOException
    • position

      public void position(long pos) throws IOException
      Change the position
      Parameters:
      pos -
      Throws:
      IOException
    • close

      public void close() throws IOException
      Specified by:
      close in interface AutoCloseable
      Throws:
      IOException
    • available

      public int available() throws IOException
      Throws:
      IOException
    • skip

      public long skip(long l) throws IOException
      Throws:
      IOException
    • decode

      public CoderResult decode(CharBuffer target, CharsetDecoder charsetDecoder) throws IOException
      Decode whatever characters are available into the passed CharBuffer. Note that for multi-byte encodings, CharsetDecoders are stateful, and a previous call could result in being at a byte-position that's part-way through reading a character. Always pass the same decoder unless a decoding error has occurred.
      Parameters:
      target - The charbuffer to decode results into
      charsetDecoder - A decoder for the desired charset
      Returns:
      The result of decoding
      Throws:
      IOException - If something goes wrong