KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > netbeans > editor > ext > DataAccessor


1 /*
2  * The contents of this file are subject to the terms of the Common Development
3  * and Distribution License (the License). You may not use this file except in
4  * compliance with the License.
5  *
6  * You can obtain a copy of the License at http://www.netbeans.org/cddl.html
7  * or http://www.netbeans.org/cddl.txt.
8  *
9  * When distributing Covered Code, include this CDDL Header Notice in each file
10  * and include the License file at http://www.netbeans.org/cddl.txt.
11  * If applicable, add the following below the CDDL Header, with the fields
12  * enclosed by brackets [] replaced by your own identifying information:
13  * "Portions Copyrighted [year] [name of copyright owner]"
14  *
15  * The Original Software is NetBeans. The Initial Developer of the Original
16  * Software is Sun Microsystems, Inc. Portions Copyright 1997-2006 Sun
17  * Microsystems, Inc. All Rights Reserved.
18  */

19
20 package org.netbeans.editor.ext;
21
22 import java.io.IOException JavaDoc;
23
24 /**
25  * DataAccessor for Code Completion DB files
26  *
27  * @author Martin Roskanin
28  */

29 public interface DataAccessor {
30
31     /** Opens DataAccessor file resource
32      * @param requestWrite if true, file is opened for read/write operation.
33      */

34     public void open(boolean requestWrite) throws IOException JavaDoc;
35
36     /** Closes DataAccessor file resource */
37     public void close() throws IOException JavaDoc;
38
39     /** Reads up to len bytes of data from this file resource into an array of bytes.
40      * @param buffer the buffer into which the data is read.
41      * @param off the start offset of the data.
42      * @param len the maximum number of bytes read.
43      */

44     public void read(byte buffer[], int off, int len) throws IOException JavaDoc;
45     
46     /** Appends exactly <code>len</code> bytes, starting at <code>off</code> of the buffer pointer
47      * to the end of file resource.
48      * @param buffer the buffer from which the data is appended.
49      * @param off the start offset of the data in the buffer.
50      * @param len the number of bytes to append.
51      * @return the actual file offset.
52      */

53     public void append(byte buffer[], int off, int len) throws IOException JavaDoc;
54     
55     /**
56      * Returns the current offset in this file.
57      *
58      * @return the offset from the beginning of the file, in bytes,
59      * at which the next read or write occurs.
60      */

61     public long getFilePointer() throws IOException JavaDoc;
62     
63     /** Clears the file and sets the offset to 0 */
64     public void resetFile() throws IOException JavaDoc;
65     
66     /**
67      * Sets the file-pointer offset, measured from the beginning of this
68      * file, at which the next read or write occurs.
69      */

70     public void seek(long pos) throws IOException JavaDoc;
71     
72     public int getFileLength();
73 }
74
75
Popular Tags