站内搜索: 请输入搜索关键词
当前页面: 在线文档首页 > NetBeans API Javadoc (Current Development Version)

FileAccessor (Editor Library) - NetBeans API Javadoc (Current Development Version)

org.netbeans.modules.editor.lib/1 1.14.0 3

org.netbeans.editor.ext
Class FileAccessor

java.lang.Object
  extended by org.netbeans.editor.ext.FileAccessor
All Implemented Interfaces:
DataAccessor

public class FileAccessor
extends Object
implements DataAccessor

DataAccessor for Code Completion DB files via RandomAccessFile implementation


Constructor Summary
FileAccessor(File file)
          Creates a new instance of FileAccessor
 
Method Summary
 void append(byte[] buffer, int off, int len)
          Appends exactly len bytes, starting at off of the buffer pointer to the end of file resource.
 void close()
          Closes DataAccessor file resource
 int getFileLength()
           
 long getFilePointer()
          Returns the current offset in this file.
 void open(boolean requestWrite)
          Opens DataAccessor file resource
 void read(byte[] buffer, int off, int len)
          Reads up to len bytes of data from this file resource into an array of bytes.
 void resetFile()
          Clears the file and sets the offset to 0
 void seek(long pos)
          Sets the file-pointer offset, measured from the beginning of this file, at which the next read or write occurs.
 String toString()
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Constructor Detail

FileAccessor

public FileAccessor(File file)
Creates a new instance of FileAccessor

Method Detail

append

public void append(byte[] buffer,
                   int off,
                   int len)
            throws IOException
Appends exactly len bytes, starting at off of the buffer pointer to the end of file resource.

Specified by:
append in interface DataAccessor
Parameters:
buffer - the buffer from which the data is appended.
off - the start offset of the data in the buffer.
len - the number of bytes to append.
Throws:
IOException

read

public void read(byte[] buffer,
                 int off,
                 int len)
          throws IOException
Reads up to len bytes of data from this file resource into an array of bytes.

Specified by:
read in interface DataAccessor
Parameters:
buffer - the buffer into which the data is read.
off - the start offset of the data.
len - the maximum number of bytes read.
Throws:
IOException

open

public void open(boolean requestWrite)
          throws IOException
Opens DataAccessor file resource

Specified by:
open in interface DataAccessor
Parameters:
requestWrite - if true, file is opened for read/write operation.
Throws:
IOException

close

public void close()
           throws IOException
Closes DataAccessor file resource

Specified by:
close in interface DataAccessor
Throws:
IOException

getFilePointer

public long getFilePointer()
                    throws IOException
Returns the current offset in this file.

Specified by:
getFilePointer in interface DataAccessor
Returns:
the offset from the beginning of the file, in bytes, at which the next read or write occurs.
Throws:
IOException

resetFile

public void resetFile()
               throws IOException
Clears the file and sets the offset to 0

Specified by:
resetFile in interface DataAccessor
Throws:
IOException

seek

public void seek(long pos)
          throws IOException
Description copied from interface: DataAccessor
Sets the file-pointer offset, measured from the beginning of this file, at which the next read or write occurs.

Specified by:
seek in interface DataAccessor
Throws:
IOException

getFileLength

public int getFileLength()
Specified by:
getFileLength in interface DataAccessor

toString

public String toString()
Overrides:
toString in class Object

org.netbeans.modules.editor.lib/1 1.14.0 3

Built on May 28 2007.  |  Portions Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.