C# Class Lucene.Net.Store.DataInput

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

{@code 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 {@code DataInput} instance must be cloned before used in another thread. Subclasses must therefore implement #clone(), returning a new {@code DataInput} which operates on the same underlying resource, but positioned independently.

Inheritance: ICloneable
显示文件 Open project: apache/lucenenet Class Usage Examples

Public Methods

Method Description
Clone ( ) : object

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.

ReadByte ( ) : byte

Reads and returns a single byte.

ReadBytes ( byte b, int offset, int len ) : void

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

ReadBytes ( byte b, int offset, int len, bool useBuffer ) : void

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.

ReadInt ( ) : int

Reads four bytes and returns an int.

ReadLong ( ) : long

Reads eight bytes and returns a long.

ReadShort ( ) : short

Reads two bytes and returns a short. LUCENENET NOTE: Important - always cast to ushort (System.UInt16) before using to ensure the value is positive!

ReadString ( ) : string

Reads a string.

ReadStringSet ( ) : ISet

Reads a Set<String> previously written with DataOutput#writeStringSet(Set).

ReadStringStringMap ( ) : string>.IDictionary

Reads a Map<String,String> previously written with DataOutput#writeStringStringMap(Map).

ReadVInt ( ) : int

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 DataOutput#writeVInt(int).

ReadVLong ( ) : long

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 DataOutput#writeVInt(int).

SkipBytes ( long numBytes ) : void

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.

Method Details

Clone() public method

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.

public Clone ( ) : object
return object

ReadByte() public abstract method

Reads and returns a single byte.
public abstract ReadByte ( ) : byte
return byte

ReadBytes() public abstract method

Reads a specified number of bytes into an array at the specified offset.
public abstract ReadBytes ( byte b, int offset, int len ) : void
b byte the array to read bytes into
offset int the offset in the array to start storing bytes
len int the number of bytes to read
return void

ReadBytes() public method

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.
public ReadBytes ( byte b, int offset, int len, bool useBuffer ) : void
b byte the array to read bytes into
offset int the offset in the array to start storing bytes
len int the number of bytes to read
useBuffer bool set to false if the caller will handle /// buffering.
return void

ReadInt() public method

Reads four bytes and returns an int.
public ReadInt ( ) : int
return int

ReadLong() public method

Reads eight bytes and returns a long.
public ReadLong ( ) : long
return long

ReadShort() public method

Reads two bytes and returns a short. LUCENENET NOTE: Important - always cast to ushort (System.UInt16) before using to ensure the value is positive!
public ReadShort ( ) : short
return short

ReadString() public method

Reads a string.
public ReadString ( ) : string
return string

ReadStringSet() public method

Reads a Set<String> previously written with DataOutput#writeStringSet(Set).
public ReadStringSet ( ) : ISet
return ISet

ReadStringStringMap() public method

Reads a Map<String,String> previously written with DataOutput#writeStringStringMap(Map).
public ReadStringStringMap ( ) : string>.IDictionary
return string>.IDictionary

ReadVInt() public method

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 DataOutput#writeVInt(int).

public ReadVInt ( ) : int
return int

ReadVLong() public method

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 DataOutput#writeVInt(int).

public ReadVLong ( ) : long
return long

SkipBytes() public method

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.
public SkipBytes ( long numBytes ) : void
numBytes long
return void