org.apache.lucene.store

Class OutputStream

public abstract class OutputStream extends Object

Abstract class for output to a file in a Directory. A random-access output stream. Used for all Lucene index output operations.

See Also: Directory InputStream

Method Summary
voidclose()
Closes this stream to further operations.
protected voidflush()
Forces any buffered output to be written.
protected abstract voidflushBuffer(byte[] b, int len)
Expert: implements buffer write.
longgetFilePointer()
Returns the current position in this file, where the next write will occur.
abstract longlength()
The number of bytes in the file.
voidseek(long pos)
Sets current position in this file, where the next write will occur.
voidwriteByte(byte b)
Writes a single byte.
voidwriteBytes(byte[] b, int length)
Writes an array of bytes.
voidwriteChars(String s, int start, int length)
Writes a sequence of UTF-8 encoded characters from a string.
voidwriteInt(int i)
Writes an int as four bytes.
voidwriteLong(long i)
Writes a long as eight bytes.
voidwriteString(String s)
Writes a string.
voidwriteVInt(int i)
Writes an int in a variable-length format.
voidwriteVLong(long i)
Writes an long in a variable-length format.

Method Detail

close

public void close()
Closes this stream to further operations.

flush

protected final void flush()
Forces any buffered output to be written.

flushBuffer

protected abstract void flushBuffer(byte[] b, int len)
Expert: implements buffer write. Writes bytes at the current position in the output.

Parameters: b the bytes to write len the number of bytes to write

getFilePointer

public final long getFilePointer()
Returns the current position in this file, where the next write will occur.

See Also: OutputStream

length

public abstract long length()
The number of bytes in the file.

seek

public void seek(long pos)
Sets current position in this file, where the next write will occur.

See Also: getFilePointer

writeByte

public final void writeByte(byte b)
Writes a single byte.

See Also: readByte

writeBytes

public final void writeBytes(byte[] b, int length)
Writes an array of bytes.

Parameters: b the bytes to write length the number of bytes to write

See Also: (byte[],int,int)

writeChars

public final void writeChars(String s, int start, int length)
Writes a sequence of UTF-8 encoded characters from a string.

Parameters: s the source of the characters start the first character in the sequence length the number of characters in the sequence

See Also: (char[],int,int)

writeInt

public final void writeInt(int i)
Writes an int as four bytes.

See Also: readInt

writeLong

public final void writeLong(long i)
Writes a long as eight bytes.

See Also: readLong

writeString

public final void writeString(String s)
Writes a string.

See Also: readString

writeVInt

public final void writeVInt(int i)
Writes an int in a variable-length format. Writes between one and five bytes. Smaller values take fewer bytes. Negative numbers are not supported.

See Also: readVInt

writeVLong

public final void writeVLong(long i)
Writes an long in a variable-length format. Writes between one and five bytes. Smaller values take fewer bytes. Negative numbers are not supported.

See Also: readVLong

Copyright © 2000-2007 Apache Software Foundation. All Rights Reserved.