Class AsciiLineReader

    • Constructor Detail

      • AsciiLineReader

        protected AsciiLineReader()
      • AsciiLineReader

        @Deprecated
        public AsciiLineReader​(InputStream is)
        Deprecated.
        Note: This class implements LocationAware, which requires preservation of virtual file pointers on BGZF inputs. However, if the inputStream wrapped by this class is a BlockCompressedInputStream, it violates that contract by wrapping the stream and returning positional file offsets instead.
    • Method Detail

      • from

        public static AsciiLineReader from​(InputStream inputStream)
        Create an AsciiLineReader of the appropriate type for a given InputStream.
        Parameters:
        inputStream - An InputStream-derived class that implements BlockCompressedInputStream or PositionalBufferedStream
        Returns:
        AsciiLineReader that wraps inputStream
      • getPosition

        public long getPosition()
        Description copied from interface: LocationAware
        The current offset, in bytes, of this stream/writer/file. Or, if this is an iterator/producer, the offset (in bytes) of the END of the most recently returned record (since a produced record corresponds to something that has been read already). See class javadoc for more. Note that for BGZF files, this does not represent an actually file position, but a virtual file pointer.
        Specified by:
        getPosition in interface LocationAware
        Returns:
        The position of the InputStream
      • getLineTerminatorLength

        public int getLineTerminatorLength()
        Returns the length of the line terminator read after the last read line. Returns either: -1 if no line has been read 0 after the last line if the last line in the file had no CR or LF line ending 1 if the line ended with CR or LF 2 if the line ended with CR and LF
      • readLine

        @Deprecated
        public String readLine​(PositionalBufferedStream stream)
                        throws IOException
        Deprecated.
        8/8/2017 use from(java.io.InputStream) to create a new AsciiLineReader and readLine()
        Read a line of text. A line is considered to be terminated by any one of a line feed ('\n'), a carriage return ('\r'), or a carriage return followed immediately by a linefeed.
        Parameters:
        stream - the stream to read the next line from
        Returns:
        A String containing the contents of the line or null if the end of the stream has been reached
        Throws:
        IOException