## org.apache.lucene.store
Class IndexOutput

    java.lang.Object
      org.apache.lucene.store.IndexOutput

Direct Known Subclasses:
  BufferedIndexOutput, RAMOutputStream

    public abstract class IndexOutput

extends Object

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

See Also:
  `Directory`, `IndexInput`

Constructor Summary
`IndexOutput()`

Method Summary
`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.
`abstract void` `writeByte(byte b)` Writes a single byte.
`void` `writeBytes(byte[] b, int length)` Writes an array of bytes.
`abstract void` `writeBytes(byte[] b, int offset, int length)` Writes an array of bytes.
`void` `writeChars(char[] s, int start, int length)` Writes a sequence of UTF-8 encoded characters from a char[].
`void` `writeChars(String s, int start, int length)` Writes a sequence of UTF-8 encoded characters from a 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` `writeVInt(int i)` Writes an int in a variable-length format.
`void` `writeVLong(long i)` Writes an long in a variable-length format.

Methods inherited from class java.lang.Object
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

Constructor Detail

### IndexOutput

    public IndexOutput()

Method Detail

### writeByte

    public abstract void writeByte(byte b)
                            throws IOException

  Writes a single byte.

  Throws:
    `IOException`
  See Also:
    `IndexInput.readByte()`

### writeBytes

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

  Writes an array of bytes.

  Parameters:
    `b` - the bytes to write
    `length` - the number of bytes to write
  Throws:
    `IOException`
  See Also:
    `IndexInput.readBytes(byte[],int,int)`

### writeBytes

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

  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`
  See Also:
    `IndexInput.readBytes(byte[],int,int)`

### writeInt

    public void writeInt(int i)
                  throws IOException

  Writes an int as four bytes.

  Throws:
    `IOException`
  See Also:
    `IndexInput.readInt()`

### writeVInt

    public void writeVInt(int i)
                   throws IOException

  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:
    `IndexInput.readVInt()`

### writeLong

    public void writeLong(long i)
                   throws IOException

  Writes a long as eight bytes.

  Throws:
    `IOException`
  See Also:
    `IndexInput.readLong()`

### writeVLong

    public void writeVLong(long i)
                    throws IOException

  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:
    `IndexInput.readVLong()`

### writeString

    public void writeString(String s)
                     throws IOException

  Writes a string.

  Throws:
    `IOException`
  See Also:
    `IndexInput.readString()`

### writeChars

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

  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
  Throws:
    `IOException`
  See Also:
    `IndexInput.readChars(char[],int,int)`

### writeChars

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

  Writes a sequence of UTF-8 encoded characters from a char[].

  Parameters:
    `s` - the source of the characters
    `start` - the first character in the sequence
    `length` - the number of characters in the sequence
  Throws:
    `IOException`
  See Also:
    `IndexInput.readChars(char[],int,int)`

### copyBytes

    public void copyBytes(IndexInput input,
                          long numBytes)
                   throws IOException

  Copy numBytes bytes from input to ourself.

  Throws:
    `IOException`

### flush

    public abstract void flush()
                        throws IOException

  Forces any buffered output to be written.

  Throws:
    `IOException`

### close

    public abstract void close()
                        throws IOException

  Closes this stream to further operations.

  Throws:
    `IOException`

### getFilePointer

    public abstract long getFilePointer()

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

  See Also:
    `seek(long)`

### seek

    public abstract void seek(long pos)
                       throws IOException

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

  Throws:
    `IOException`
  See Also:
    `getFilePointer()`

### length

    public abstract long length()
                         throws IOException

  The number of bytes in the file.

  Throws:
    `IOException`

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