Class DataInput

    • Constructor Detail

      • DataInput

        public DataInput()
    • Method Detail

      • readBytes

        public abstract void readBytes​(byte[] b,
                                       int offset,
                                       int len)
                                throws IOException
        Reads a specified number of bytes into an array at the specified offset.
        Parameters:
        b - the array to read bytes into
        offset - the offset in the array to start storing bytes
        len - the number of bytes to read
        Throws:
        IOException
        See Also:
        DataOutput.writeBytes(byte[],int)
      • readBytes

        public void readBytes​(byte[] b,
                              int offset,
                              int len,
                              boolean useBuffer)
                       throws IOException
        Reads a specified number of bytes into an array at the specified offset with control over whether the read should be buffered (callers who have their own buffer should pass in "false" for useBuffer). Currently only BufferedIndexInput respects this parameter.
        Parameters:
        b - the array to read bytes into
        offset - the offset in the array to start storing bytes
        len - the number of bytes to read
        useBuffer - set to false if the caller will handle buffering.
        Throws:
        IOException
        See Also:
        DataOutput.writeBytes(byte[],int)
      • readGroupVInts

        public final void readGroupVInts​(long[] dst,
                                         int limit)
                                  throws IOException
        Read all the group varints, including the tail vints. we need a long[] because this is what postings are using, all longs are actually required to be integers.
        Parameters:
        dst - the array to read ints into.
        limit - the number of int values to read.
        Throws:
        IOException
        WARNING: This API is experimental and might change in incompatible ways in the next release.
      • readGroupVInt

        protected void readGroupVInt​(long[] dst,
                                     int offset)
                              throws IOException
        Override if you have a efficient implementation. In general this is when the input supports random access.
        Throws:
        IOException
      • readLongs

        public void readLongs​(long[] dst,
                              int offset,
                              int length)
                       throws IOException
        Read a specified number of longs.
        Throws:
        IOException
        WARNING: This API is experimental and might change in incompatible ways in the next release.
      • readInts

        public void readInts​(int[] dst,
                             int offset,
                             int length)
                      throws IOException
        Reads a specified number of ints into an array at the specified offset.
        Parameters:
        dst - the array to read bytes into
        offset - the offset in the array to start storing ints
        length - the number of ints to read
        Throws:
        IOException
      • readFloats

        public void readFloats​(float[] floats,
                               int offset,
                               int len)
                        throws IOException
        Reads a specified number of floats into an array at the specified offset.
        Parameters:
        floats - the array to read bytes into
        offset - the offset in the array to start storing floats
        len - the number of floats to read
        Throws:
        IOException
      • clone

        public DataInput clone()
        Returns a clone of this stream.

        Clones of a stream access the same data, and are positioned at the same point as the stream they were cloned from.

        Expert: Subclasses must ensure that clones may be positioned at different points in the input from each other and from the stream they were cloned from.

        Overrides:
        clone in class Object
      • skipBytes

        public abstract void skipBytes​(long numBytes)
                                throws IOException
        Skip over numBytes bytes. This method may skip bytes in whatever way is most optimal, and may not have the same behavior as reading the skipped bytes. In general, negative numBytes are not supported.
        Throws:
        IOException