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
Inherited Members
Namespace: Lucene.Net.Store
Assembly: Lucene.Net.dll
Syntax
public abstract class DataInput
Methods
| Improve this Doc View SourceClone()
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 |
---|---|
System.Object |
ReadByte()
Reads and returns a single byte.
Declaration
public abstract byte ReadByte()
Returns
Type | Description |
---|---|
System.Byte |
See Also
ReadBytes(Byte[], Int32, Int32)
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 |
---|---|---|
System.Byte[] | b | the array to read bytes into |
System.Int32 | offset | the offset in the array to start storing bytes |
System.Int32 | len | the number of bytes to read |
See Also
ReadBytes(Byte[], Int32, Int32, Boolean)
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 |
---|---|---|
System.Byte[] | b | the array to read bytes into |
System.Int32 | offset | the offset in the array to start storing bytes |
System.Int32 | len | the number of bytes to read |
System.Boolean | useBuffer | set to false if the caller will handle buffering. |
See Also
ReadInt16()
Reads two bytes and returns a System.Int16.
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 |
---|---|
System.Int16 |
See Also
ReadInt32()
Reads four bytes and returns an System.Int32.
NOTE: this was readInt() in Lucene
Declaration
public virtual int ReadInt32()
Returns
Type | Description |
---|---|
System.Int32 |
See Also
ReadInt64()
Reads eight bytes and returns a System.Int64.
NOTE: this was readLong() in Lucene
Declaration
public virtual long ReadInt64()
Returns
Type | Description |
---|---|
System.Int64 |
See Also
ReadString()
Reads a System.String.
Declaration
public virtual string ReadString()
Returns
Type | Description |
---|---|
System.String |
See Also
ReadStringSet()
Reads a ISet<string> previously written with WriteStringSet(ISet<String>).
Declaration
public virtual ISet<string> ReadStringSet()
Returns
Type | Description |
---|---|
System.Collections.Generic.ISet<System.String> |
ReadStringStringMap()
Reads a IDictionary<string,string> previously written with WriteStringStringMap(IDictionary<String, String>).
Declaration
public virtual IDictionary<string, string> ReadStringStringMap()
Returns
Type | Description |
---|---|
System.Collections.Generic.IDictionary<System.String, System.String> |
ReadVInt32()
Reads an System.Int32 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(Int32).
NOTE: this was readVInt() in Lucene
Declaration
public virtual int ReadVInt32()
Returns
Type | Description |
---|---|
System.Int32 |
See Also
ReadVInt64()
Reads a System.Int64 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(Int32).
NOTE: this was readVLong() in Lucene
Declaration
public virtual long ReadVInt64()
Returns
Type | Description |
---|---|
System.Int64 |
See Also
SkipBytes(Int64)
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 |
---|---|---|
System.Int64 | numBytes |