KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > apache > commons > vfs > RandomAccessContent


1 /*
2  * Copyright 2002-2005 The Apache Software Foundation.
3  *
4  * Licensed under the Apache License, Version 2.0 (the "License");
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  * http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an "AS IS" BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */

16 package org.apache.commons.vfs;
17
18 import java.io.DataInput JavaDoc;
19 import java.io.DataOutput JavaDoc;
20 import java.io.IOException JavaDoc;
21 import java.io.InputStream JavaDoc;
22
23 /**
24  * Description
25  *
26  * @author <a HREF="mailto:imario@apache.org">Mario Ivankovits</a>
27  */

28 public interface RandomAccessContent extends DataOutput JavaDoc, DataInput JavaDoc
29 {
30     /**
31      * Returns the current offset in this file.
32      *
33      * @return the offset from the beginning of the file, in bytes,
34      * at which the next read or write occurs.
35      * @throws IOException if an I/O error occurs.
36      */

37     public long getFilePointer() throws IOException JavaDoc;
38
39     /**
40      * Sets the file-pointer offset, measured from the beginning of this
41      * file, at which the next read or write occurs. The offset may be
42      * set beyond the end of the file. Setting the offset beyond the end
43      * of the file does not change the file length. The file length will
44      * change only by writing after the offset has been set beyond the end
45      * of the file.
46      * <br/>
47      * <b>Notice: If you use {@link #getInputStream()} you have to reget the InputStream after calling {@link #seek(long)}</b>
48      *
49      * @param pos the offset position, measured in bytes from the
50      * beginning of the file, at which to set the file
51      * pointer.
52      * @throws IOException if <code>pos</code> is less than
53      * <code>0</code> or if an I/O error occurs.
54      */

55     public void seek(long pos) throws IOException JavaDoc;
56
57     /**
58      * Returns the length of this file.
59      *
60      * @return the length of this file, measured in bytes.
61      * @throws IOException if an I/O error occurs.
62      */

63     public long length() throws IOException JavaDoc;
64
65     /**
66      * Closes this random access file stream and releases any system
67      * resources associated with the stream. A closed random access
68      * file cannot perform input or output operations and cannot be
69      * reopened.
70      * <p/>
71      * <p> If this file has an associated channel then the channel is closed
72      * as well.
73      *
74      * @throws IOException if an I/O error occurs.
75      */

76     public void close() throws IOException JavaDoc;
77
78     /**
79      * get the inputstream interface
80      * <br/>
81      * <b>Notice: If you use {@link #seek(long)} you have to reget the InputStream</b>
82      * @return
83      */

84     public InputStream JavaDoc getInputStream() throws IOException JavaDoc;
85 }
86
Popular Tags