public abstract class

IndexOutput

extends Object
implements Closeable
java.lang.Object
   ↳ org.apache.lucene.store.IndexOutput
Known Direct Subclasses
Known Indirect Subclasses

Class Overview

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

Summary

Public Constructors
IndexOutput()
Public Methods
abstract void close()
Closes this stream to further operations.
void copyBytes(IndexInput input, long numBytes)
Copy numBytes bytes from input to ourself.
abstract void flush()
Forces any buffered output to be written.
abstract long getFilePointer()
Returns the current position in this file, where the next write will occur.
abstract long length()
The number of bytes in the file.
abstract void seek(long pos)
Sets current position in this file, where the next write will occur.
void setLength(long length)
Set the file length.
abstract void writeByte(byte b)
Writes a single byte.
abstract void writeBytes(byte[] b, int offset, int length)
Writes an array of bytes.
void writeBytes(byte[] b, int length)
Writes an array of bytes.
void writeChars(char[] s, int start, int length)
This method is deprecated. -- please pre-convert to utf8 bytes instead or use writeString(String)
void writeChars(String s, int start, int length)
This method is deprecated. -- please pre-convert to utf8 bytes instead or use writeString(String)
void writeInt(int i)
Writes an int as four bytes.
void writeLong(long i)
Writes a long as eight bytes.
void writeString(String s)
Writes a string.
void writeStringStringMap(Map<StringString> map)
void writeVInt(int i)
Writes an int in a variable-length format.
void writeVLong(long i)
Writes an long in a variable-length format.
[Expand]
Inherited Methods
From class java.lang.Object
From interface java.io.Closeable

Public Constructors

public IndexOutput ()

Public Methods

public abstract void close ()

Closes this stream to further operations.

Throws
IOException

public void copyBytes (IndexInput input, long numBytes)

Copy numBytes bytes from input to ourself.

Throws
IOException

public abstract void flush ()

Forces any buffered output to be written.

Throws
IOException

public abstract long getFilePointer ()

Returns the current position in this file, where the next write will occur.

See Also

public abstract long length ()

The number of bytes in the file.

Throws
IOException

public abstract void seek (long pos)

Sets current position in this file, where the next write will occur.

Throws
IOException
See Also

public void setLength (long length)

Set the file length. By default, this method does nothing (it's optional for a Directory to implement it). But, certain Directory implementations (for example @see FSDirectory) can use this to inform the underlying IO system to pre-allocate the file to the specified size. If the length is longer than the current file length, the bytes added to the file are undefined. Otherwise the file is truncated.

Parameters
length file length
Throws
IOException

public abstract void writeByte (byte b)

Writes a single byte.

Throws
IOException
See Also

public abstract void writeBytes (byte[] b, int offset, int length)

Writes an array of bytes.

Parameters
b the bytes to write
offset the offset in the byte array
length the number of bytes to write
Throws
IOException

public void writeBytes (byte[] b, int length)

Writes an array of bytes.

Parameters
b the bytes to write
length the number of bytes to write
Throws
IOException

public void writeChars (char[] s, int start, int length)

This method is deprecated.
-- please pre-convert to utf8 bytes instead or use writeString(String)

Writes a sub sequence of characters from char[] as the old format (modified UTF-8 encoded bytes).

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

public void writeChars (String s, int start, int length)

This method is deprecated.
-- please pre-convert to utf8 bytes instead or use writeString(String)

Writes a sub sequence of characters from s as the old format (modified UTF-8 encoded bytes).

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

public void writeInt (int i)

Writes an int as four bytes.

Throws
IOException
See Also

public void writeLong (long i)

Writes a long as eight bytes.

Throws
IOException
See Also

public void writeString (String s)

Writes a string.

Throws
IOException
See Also

public void writeStringStringMap (Map<StringString> map)

Throws
IOException

public 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.

Throws
IOException
See Also

public 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.

Throws
IOException
See Also