org.apache.lucene.store
Class InputStream
java.lang.Objectorg.apache.lucene.store.InputStream
- Cloneable
public abstract class InputStream
extends java.lang.Object
implements Cloneable
Abstract base class for input from a file in a
Directory. A
random-access input stream. Used for all Lucene index input operations.
Directory, OutputStream
Object | clone()- Returns a clone of this stream.
|
void | close()- Closes the stream to futher operations.
|
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 | readChars(char[] buffer, int start, int length)- Reads UTF-8 encoded characters into an array.
|
int | readInt()- Reads four bytes and returns an int.
|
protected void | readInternal(byte[] b, int offset, int length)- Expert: implements buffer refill.
|
long | readLong()- Reads eight bytes and returns a long.
|
String | readString()- Reads a string.
|
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.
|
protected void | seekInternal(long pos)- Expert: implements seek.
|
length
protected long length
clone
public Object 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.
close
public void close()
throws IOExceptionCloses the stream to futher operations.
getFilePointer
public final long getFilePointer()
Returns the current position in this file, where the next read will
occur.
seek(long)
length
public final long length()
The number of bytes in the file.
readBytes
public final void readBytes(byte[] b,
int offset,
int len)
throws IOExceptionReads a specified number of bytes into an array at the specified offset.
b - the array to read bytes intooffset - the offset in the array to start storing byteslen - the number of bytes to read
OutputStream.writeBytes(byte[],int)
readChars
public final void readChars(char[] buffer,
int start,
int length)
throws IOExceptionReads UTF-8 encoded characters into an array.
buffer - the array to read characters intostart - the offset in the array to start storing characterslength - the number of characters to read
OutputStream.writeChars(String,int,int)
readInternal
protected void readInternal(byte[] b,
int offset,
int length)
throws IOExceptionExpert: implements buffer refill. Reads bytes from the current position
in the input.
b - the array to read bytes intooffset - the offset in the array to start storing byteslength - the number of bytes to read
readVInt
public final int readVInt()
throws IOExceptionReads an int stored in variable-length format. Reads between one and
five bytes. Smaller values take fewer bytes. Negative numbers are not
supported.
OutputStream.writeVInt(int)
readVLong
public final long readVLong()
throws IOExceptionReads a long stored in variable-length format. Reads between one and
nine bytes. Smaller values take fewer bytes. Negative numbers are not
supported.
seek
public final void seek(long pos)
throws IOExceptionSets current position in this file, where the next read will occur.
getFilePointer()
Copyright © 2000-2005 Apache Software Foundation. All Rights Reserved.