Class BufferOverInputStream.ByteArrayChannel

java.lang.Object
org.aksw.commons.io.hadoop.binseach.bz2.ReadableByteChannelBase
org.aksw.commons.io.hadoop.binseach.bz2.BufferOverInputStream.ByteArrayChannel
All Implemented Interfaces:
Closeable, AutoCloseable, ByteChannel, Channel, ReadableByteChannel, SeekableByteChannel, WritableByteChannel, org.aksw.commons.io.seekable.api.Seekable
Enclosing class:
BufferOverInputStream

public class BufferOverInputStream.ByteArrayChannel extends ReadableByteChannelBase implements SeekableByteChannel, org.aksw.commons.io.seekable.api.Seekable
  • Field Details

  • Constructor Details

  • Method Details

    • position

      public BufferOverInputStream.ByteArrayChannel position(long pos)
      Setting a position outside of the size of the entity is valid will will cause a read to immediately return an EOF See ReadableByteChannel
      Specified by:
      position in interface SeekableByteChannel
      Parameters:
      pos -
      Returns:
    • position

      public long position()
      Specified by:
      position in interface SeekableByteChannel
    • readActual

      public int readActual(ByteBuffer dst) throws IOException
      Specified by:
      readActual in class ReadableByteChannelBase
      Throws:
      IOException
    • write

      public int write(ByteBuffer src) throws IOException
      Specified by:
      write in interface SeekableByteChannel
      Specified by:
      write in interface WritableByteChannel
      Throws:
      IOException
    • size

      public long size() throws IOException
      First checks whether there is at least one more byte available and afterwards returns the currently known size
      Specified by:
      size in interface org.aksw.commons.io.seekable.api.Seekable
      Specified by:
      size in interface SeekableByteChannel
      Throws:
      IOException
    • loadAll

      public long loadAll() throws IOException
      Loads all data into the buffer and returns the total size
      Throws:
      IOException
    • truncate

      public SeekableByteChannel truncate(long size) throws IOException
      Specified by:
      truncate in interface SeekableByteChannel
      Throws:
      IOException
    • clone

      public org.aksw.commons.io.seekable.api.Seekable clone()
      Specified by:
      clone in interface org.aksw.commons.io.seekable.api.Seekable
      Overrides:
      clone in class Object
    • getPos

      public long getPos() throws IOException
      Specified by:
      getPos in interface org.aksw.commons.io.seekable.api.Seekable
      Throws:
      IOException
    • setPos

      public void setPos(long pos) throws IOException
      Specified by:
      setPos in interface org.aksw.commons.io.seekable.api.Seekable
      Throws:
      IOException
    • posToStart

      public void posToStart() throws IOException
      Specified by:
      posToStart in interface org.aksw.commons.io.seekable.api.Seekable
      Throws:
      IOException
    • posToEnd

      public void posToEnd() throws IOException
      Set the position to the end of the stream immediately loads all data.
      Specified by:
      posToEnd in interface org.aksw.commons.io.seekable.api.Seekable
      Throws:
      IOException
    • isPosBeforeStart

      public boolean isPosBeforeStart() throws IOException
      Specified by:
      isPosBeforeStart in interface org.aksw.commons.io.seekable.api.Seekable
      Throws:
      IOException
    • isPosAfterEnd

      public boolean isPosAfterEnd() throws IOException
      Specified by:
      isPosAfterEnd in interface org.aksw.commons.io.seekable.api.Seekable
      Throws:
      IOException
    • readString

      public String readString(int len) throws IOException
      Specified by:
      readString in interface org.aksw.commons.io.seekable.api.Seekable
      Throws:
      IOException
    • checkNext

      public int checkNext(int len, boolean changePos) throws IOException
      Specified by:
      checkNext in interface org.aksw.commons.io.seekable.api.Seekable
      Throws:
      IOException
    • get

      public byte get() throws IOException
      Specified by:
      get in interface org.aksw.commons.io.seekable.api.Seekable
      Throws:
      IOException
    • checkPrev

      public int checkPrev(int len, boolean changePos) throws IOException
      The method assumes that the current position is in the valid range
      Specified by:
      checkPrev in interface org.aksw.commons.io.seekable.api.Seekable
      Throws:
      IOException