|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.apache.lucene.store.DataInput org.apache.lucene.store.IndexInput org.apache.lucene.store.MockIndexInputWrapper
public class MockIndexInputWrapper
Used by MockDirectoryWrapper to create an input stream that keeps track of when it's been closed.
Constructor Summary | |
---|---|
MockIndexInputWrapper(MockDirectoryWrapper dir,
String name,
IndexInput delegate)
Construct an empty output buffer. |
Method Summary | |
---|---|
Object |
clone()
Returns a clone of this stream. |
void |
close()
Closes the stream to further operations. |
void |
copyBytes(IndexOutput out,
long numBytes)
Copies numBytes bytes to the given IndexOutput . |
long |
getFilePointer()
Returns the current position in this file, where the next read will occur. |
long |
length()
The number of bytes in the file. |
byte |
readByte()
Reads and returns a single byte. |
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). |
void |
readChars(char[] buffer,
int start,
int length)
Reads Lucene's old "modified UTF-8" encoded characters into an array. |
int |
readInt()
Reads four bytes and returns an int. |
long |
readLong()
Reads eight bytes and returns a long. |
String |
readString()
Reads a string. |
Map<String,String> |
readStringStringMap()
|
int |
readVInt()
Reads an int stored in variable-length format. |
long |
readVLong()
Reads a long stored in variable-length format. |
void |
seek(long pos)
Sets current position in this file, where the next read will occur. |
void |
setModifiedUTF8StringsMode()
Call this if readString should read characters stored in the old modified UTF8 format (length in java chars and java's modified UTF8 encoding). |
void |
skipChars(int length)
Expert Similar to DataInput.readChars(char[], int, int) but does not do any conversion operations on the bytes it is reading in. |
Methods inherited from class org.apache.lucene.store.IndexInput |
---|
toString |
Methods inherited from class org.apache.lucene.store.DataInput |
---|
readShort |
Methods inherited from class java.lang.Object |
---|
equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public MockIndexInputWrapper(MockDirectoryWrapper dir, String name, IndexInput delegate)
Method Detail |
---|
public void close() throws IOException
IndexInput
close
in interface Closeable
close
in class IndexInput
IOException
public Object clone()
DataInput
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 DataInput
public long getFilePointer()
IndexInput
getFilePointer
in class IndexInput
IndexInput.seek(long)
public void seek(long pos) throws IOException
IndexInput
seek
in class IndexInput
IOException
IndexInput.getFilePointer()
public long length()
IndexInput
length
in class IndexInput
public byte readByte() throws IOException
DataInput
readByte
in class DataInput
IOException
DataOutput.writeByte(byte)
public void readBytes(byte[] b, int offset, int len) throws IOException
DataInput
readBytes
in class DataInput
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 copyBytes(IndexOutput out, long numBytes) throws IOException
IndexInput
numBytes
bytes to the given IndexOutput
.
NOTE: this method uses an intermediate buffer to copy the bytes. Consider overriding it in your implementation, if you can make a better, optimized copy.
NOTE ensure that there are enough bytes in the input to copy to output. Otherwise, different exceptions may be thrown, depending on the implementation.
copyBytes
in class IndexInput
IOException
public void readBytes(byte[] b, int offset, int len, boolean useBuffer) throws IOException
DataInput
BufferedIndexInput
respects this parameter.
readBytes
in class DataInput
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 int readInt() throws IOException
DataInput
readInt
in class DataInput
IOException
DataOutput.writeInt(int)
public int readVInt() throws IOException
DataInput
readVInt
in class DataInput
IOException
DataOutput.writeVInt(int)
public long readLong() throws IOException
DataInput
readLong
in class DataInput
IOException
DataOutput.writeLong(long)
public long readVLong() throws IOException
DataInput
readVLong
in class DataInput
IOException
public String readString() throws IOException
DataInput
readString
in class DataInput
IOException
DataOutput.writeString(String)
public Map<String,String> readStringStringMap() throws IOException
readStringStringMap
in class DataInput
IOException
public void setModifiedUTF8StringsMode()
DataInput
setModifiedUTF8StringsMode
in class DataInput
public void readChars(char[] buffer, int start, int length) throws IOException
DataInput
readChars
in class DataInput
buffer
- the array to read characters intostart
- the offset in the array to start storing characterslength
- the number of characters to read
IOException
DataOutput.writeChars(String,int,int)
public void skipChars(int length) throws IOException
IndexInput
DataInput.readChars(char[], int, int)
but does not do any conversion operations on the bytes it is reading in. It still
has to invoke DataInput.readByte()
just as DataInput.readChars(char[], int, int)
does, but it does not need a buffer to store anything
and it does not have to do any of the bitwise operations, since we don't actually care what is in the byte except to determine
how many more bytes to read
skipChars
in class IndexInput
length
- The number of chars to read
IOException
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |