|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.lucene.store.DataInput
public abstract 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.
Constructor Summary | |
---|---|
DataInput()
|
Method Summary | |
---|---|
DataInput |
clone()
Returns a clone of this stream. |
abstract byte |
readByte()
Reads and returns a single byte. |
abstract void |
readBytes(byte[] b,
int offset,
int len)
Reads a specified number of bytes into an array at the specified offset. |
void |
readBytes(byte[] b,
int offset,
int len,
boolean useBuffer)
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). |
int |
readInt()
Reads four bytes and returns an int. |
long |
readLong()
Reads eight bytes and returns a long. |
short |
readShort()
Reads two bytes and returns a short. |
String |
readString()
Reads a string. |
Set<String> |
readStringSet()
Reads a Set<String> previously written with DataOutput.writeStringSet(Set) . |
Map<String,String> |
readStringStringMap()
Reads a Map<String,String> previously written with DataOutput.writeStringStringMap(Map) . |
int |
readVInt()
Reads an int stored in variable-length format. |
long |
readVLong()
Reads a long stored in variable-length format. |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public DataInput()
Method Detail |
---|
public abstract byte readByte() throws IOException
IOException
DataOutput.writeByte(byte)
public abstract void readBytes(byte[] b, int offset, int len) throws IOException
b
- the array to read bytes intooffset
- the offset in the array to start storing byteslen
- the number of bytes to read
IOException
DataOutput.writeBytes(byte[],int)
public void readBytes(byte[] b, int offset, int len, boolean useBuffer) throws IOException
BufferedIndexInput
respects this parameter.
b
- the array to read bytes intooffset
- the offset in the array to start storing byteslen
- the number of bytes to readuseBuffer
- set to false if the caller will handle
buffering.
IOException
DataOutput.writeBytes(byte[],int)
public short readShort() throws IOException
IOException
DataOutput.writeByte(byte)
public int readInt() throws IOException
IOException
DataOutput.writeInt(int)
public int readVInt() throws IOException
The format is described further in DataOutput.writeVInt(int)
.
IOException
DataOutput.writeVInt(int)
public long readLong() throws IOException
IOException
DataOutput.writeLong(long)
public long readVLong() throws IOException
The format is described further in DataOutput.writeVInt(int)
.
IOException
DataOutput.writeVLong(long)
public String readString() throws IOException
IOException
DataOutput.writeString(String)
public DataInput clone()
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.
clone
in class Object
public Map<String,String> readStringStringMap() throws IOException
DataOutput.writeStringStringMap(Map)
.
IOException
public Set<String> readStringSet() throws IOException
DataOutput.writeStringSet(Set)
.
IOException
|
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |