Fork me on GitHub
  • API

    Show / Hide Table of Contents

    Class DataInput

    Abstract base class for performing read operations of Lucene's low-level data types.

    DataInput may only be used from one thread, because it is not thread safe (it keeps internal state like file position). To allow multithreaded use, every DataInput instance must be cloned before used in another thread. Subclasses must therefore implement Clone(), returning a new DataInput which operates on the same underlying resource, but positioned independently.
    Inheritance
    object
    DataInput
    ByteSliceReader
    ByteArrayDataInput
    IndexInput
    InputStreamDataInput
    FST.BytesReader
    PagedBytes.PagedBytesDataInput
    Inherited Members
    object.Equals(object)
    object.Equals(object, object)
    object.GetHashCode()
    object.GetType()
    object.MemberwiseClone()
    object.ReferenceEquals(object, object)
    object.ToString()
    Namespace: Lucene.Net.Store
    Assembly: Lucene.Net.dll
    Syntax
    public abstract class DataInput

    Methods

    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.
    Declaration
    public virtual object Clone()
    Returns
    Type Description
    object

    ReadByte()

    Reads and returns a single byte.

    Declaration
    public abstract byte ReadByte()
    Returns
    Type Description
    byte
    See Also
    WriteByte(byte)

    ReadBytes(byte[], int, int)

    Reads a specified number of bytes into an array at the specified offset.

    Declaration
    public abstract void ReadBytes(byte[] b, int offset, int len)
    Parameters
    Type Name Description
    byte[] b

    the array to read bytes into

    int offset

    the offset in the array to start storing bytes

    int len

    the number of bytes to read

    See Also
    WriteBytes(byte[], int)

    ReadBytes(byte[], int, int, bool)

    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.

    Declaration
    public virtual void ReadBytes(byte[] b, int offset, int len, bool useBuffer)
    Parameters
    Type Name Description
    byte[] b

    the array to read bytes into

    int offset

    the offset in the array to start storing bytes

    int len

    the number of bytes to read

    bool useBuffer

    set to false if the caller will handle buffering.

    See Also
    WriteBytes(byte[], int)

    ReadInt16()

    Reads two bytes and returns a short.

    LUCENENET NOTE: Important - always cast to ushort (System.UInt16) before using to ensure the value is positive!

    NOTE: this was readShort() in Lucene
    Declaration
    public virtual short ReadInt16()
    Returns
    Type Description
    short
    See Also
    WriteInt16(short)

    ReadInt32()

    Reads four bytes and returns an int.

    NOTE: this was readInt() in Lucene
    Declaration
    public virtual int ReadInt32()
    Returns
    Type Description
    int
    See Also
    WriteInt32(int)

    ReadInt64()

    Reads eight bytes and returns a long.

    NOTE: this was readLong() in Lucene
    Declaration
    public virtual long ReadInt64()
    Returns
    Type Description
    long
    See Also
    WriteInt64(long)

    ReadString()

    Reads a string.

    Declaration
    public virtual string ReadString()
    Returns
    Type Description
    string
    See Also
    WriteString(string)

    ReadStringSet()

    Reads a ISet<string> previously written with WriteStringSet(ISet<string>).

    Declaration
    public virtual ISet<string> ReadStringSet()
    Returns
    Type Description
    ISet<string>

    ReadStringStringMap()

    Reads a IDictionary<string,string> previously written with WriteStringStringMap(IDictionary<string, string>).

    Declaration
    public virtual IDictionary<string, string> ReadStringStringMap()
    Returns
    Type Description
    IDictionary<string, string>

    ReadVInt32()

    Reads an int stored in variable-length format. Reads between one and five bytes. Smaller values take fewer bytes. Negative numbers are not supported.

    The format is described further in WriteVInt32(int).

    NOTE: this was readVInt() in Lucene
    Declaration
    public virtual int ReadVInt32()
    Returns
    Type Description
    int
    See Also
    WriteVInt32(int)

    ReadVInt64()

    Reads a long stored in variable-length format. Reads between one and nine bytes. Smaller values take fewer bytes. Negative numbers are not supported.

    The format is described further in WriteVInt32(int).

    NOTE: this was readVLong() in Lucene
    Declaration
    public virtual long ReadVInt64()
    Returns
    Type Description
    long
    See Also
    WriteVInt64(long)

    SkipBytes(long)

    Skip over numBytes bytes. The contract on this method is that it should have the same behavior as reading the same number of bytes into a buffer and discarding its content. Negative values of numBytes are not supported.

    Declaration
    public virtual void SkipBytes(long numBytes)
    Parameters
    Type Name Description
    long numBytes
    Back to top Copyright © 2024 The Apache Software Foundation, Licensed under the Apache License, Version 2.0
    Apache Lucene.Net, Lucene.Net, Apache, the Apache feather logo, and the Apache Lucene.Net project logo are trademarks of The Apache Software Foundation.
    All other marks mentioned may be trademarks or registered trademarks of their respective owners.