add --shared
[pylucene.git] / lucene-java-3.4.0 / lucene / src / java / org / apache / lucene / store / IndexOutput.java
1 package org.apache.lucene.store;
2
3 /**
4  * Licensed to the Apache Software Foundation (ASF) under one or more
5  * contributor license agreements.  See the NOTICE file distributed with
6  * this work for additional information regarding copyright ownership.
7  * The ASF licenses this file to You under the Apache License, Version 2.0
8  * (the "License"); you may not use this file except in compliance with
9  * the License.  You may obtain a copy of the License at
10  *
11  *     http://www.apache.org/licenses/LICENSE-2.0
12  *
13  * Unless required by applicable law or agreed to in writing, software
14  * distributed under the License is distributed on an "AS IS" BASIS,
15  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
16  * See the License for the specific language governing permissions and
17  * limitations under the License.
18  */
19
20 import java.io.IOException;
21 import java.io.Closeable;
22
23 /** Abstract base class for output to a file in a Directory.  A random-access
24  * output stream.  Used for all Lucene index output operations.
25  * @see Directory
26  * @see IndexInput
27  */
28 public abstract class IndexOutput extends DataOutput implements Closeable {
29
30   /** Forces any buffered output to be written. */
31   public abstract void flush() throws IOException;
32
33   /** Closes this stream to further operations. */
34   public abstract void close() throws IOException;
35
36   /** Returns the current position in this file, where the next write will
37    * occur.
38    * @see #seek(long)
39    */
40   public abstract long getFilePointer();
41
42   /** Sets current position in this file, where the next write will occur.
43    * @see #getFilePointer()
44    */
45   public abstract void seek(long pos) throws IOException;
46
47   /** The number of bytes in the file. */
48   public abstract long length() throws IOException;
49
50   /** Set the file length. By default, this method does
51    * nothing (it's optional for a Directory to implement
52    * it).  But, certain Directory implementations (for
53    * example @see FSDirectory) can use this to inform the
54    * underlying IO system to pre-allocate the file to the
55    * specified size.  If the length is longer than the
56    * current file length, the bytes added to the file are
57    * undefined.  Otherwise the file is truncated.
58    * @param length file length
59    */
60   public void setLength(long length) throws IOException {}
61 }