JavaScript is disabled on your browser.
Skip navigation links
org.biojava.utils.io

Class RandomAccessReader

    • Field Summary

    • Constructor Summary

      Constructors
      Constructor and Description
      RandomAccessReader (RandomAccessFile raf)
      Creates a new RandomAccessReader wrapping the RandomAccessFile and using a default-sized buffer (8192 bytes).
      RandomAccessReader (RandomAccessFile raf, int sz)
      Creates a new RandomAccessReader wrapping the RandomAccessFile and using a buffer of the specified size.
    • Method Summary

      All Methods
      Modifier and Type Method and Description
      void close ()
      close closes the underlying RandomAccessFile.
      long getFilePointer ()
      getFilePointer returns the effective position of the pointer in the underlying RandomAccessFile.
      long length ()
      length returns the length of the underlying RandomAccessFile.
      int read ()
      read reads one byte from the underlying RandomAccessFile.
      int read (char[] cbuf, int off, int len)
      read reads from the underlying RandomAccessFile into an array.
      void seek (long pos)
      seek moves the pointer to the specified position.
    • Constructor Detail

      • RandomAccessReader

        public RandomAccessReader(RandomAccessFile raf)
         throws IOException 
        Creates a new RandomAccessReader wrapping the RandomAccessFile and using a default-sized buffer (8192 bytes).
        Parameters:
        raf - a RandomAccessFile to wrap.
        Throws:
        IOException - if an error occurs.
      • RandomAccessReader

        public RandomAccessReader(RandomAccessFile raf,
         int sz)
         throws IOException 
        Creates a new RandomAccessReader wrapping the RandomAccessFile and using a buffer of the specified size.
        Parameters:
        raf - a RandomAccessFile to wrap.
        sz - an int buffer size.
        Throws:
        IOException
    • Method Detail

      • length

        public long length()
         throws IOException 
        length returns the length of the underlying RandomAccessFile.
        Returns:
        a long.
        Throws:
        IOException - if an error occurs.
      • read

        public final int read()
         throws IOException 
        read reads one byte from the underlying RandomAccessFile.
        Overrides:
        read in class Reader
        Returns:
        an int, -1 if the end of the stream has been reached.
        Throws:
        IOException - if an error occurs.
      • read

        public int read(char[] cbuf,
         int off,
         int len)
         throws IOException 
        read reads from the underlying RandomAccessFile into an array.
        Specified by:
        read in class Reader
        Parameters:
        cbuf - a char [] array to read into.
        off - an int offset in the array at which to start storing chars.
        len - an int maximum number of char to read.
        Returns:
        an int number of chars read, or -1 if the end of the stream has been reached.
        Throws:
        IOException - if an error occurs.
      • getFilePointer

        public long getFilePointer()
         throws IOException 
        getFilePointer returns the effective position of the pointer in the underlying RandomAccessFile.
        Returns:
        a long offset.
        Throws:
        IOException - if an error occurs.
      • seek

        public void seek(long pos)
         throws IOException 
        seek moves the pointer to the specified position.
        Parameters:
        pos - a long offset.
        Throws:
        IOException - if an error occurs.
Skip navigation links

Copyright © 2020 BioJava. All rights reserved.

AltStyle によって変換されたページ (->オリジナル) /