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

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

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

org.netbeans.editor.ext
Class FileStorage

java.lang.Object
  extended by org.netbeans.editor.ext.FileStorage

public class FileStorage
extends Object

Management of storage of the data for the java completion.


Field Summary
protected  byte[] bytes
          Byte array holding the data that were read from file
protected  DataAccessor da
           
 boolean fileNotFound
           
protected  int offset
          Current offset in the bytes array
protected  boolean opened
           
protected  boolean openedForWrite
           
 
Constructor Summary
FileStorage(DataAccessor da, StringCache strCache)
           
FileStorage(String fileName)
           
FileStorage(String fileName, StringCache strCache)
           
 
Method Summary
protected  void checkBytesSize(int len)
          Check size of bytes[] array
 void close()
           
 int getFileLength()
           
 String getFileName()
           
 int getFilePointer()
           
 int getInteger()
          Get the integer value from the bytes[] array
 int getOffset()
           
 String getString()
          Get the string value from the bytes[] array
 void lockFile()
          Locks the file and disable other threads to write
 void open(boolean requestWrite)
           
 void putInteger(int i)
          Put the integer into bytes[] array.
 void putString(String s)
          Put the string into bytes[] array.
 void read(int len)
          Read some part of the file into the begining of bytes array and reset offset to zero.
 void resetBytes()
           
 void resetFile()
          Reset the size of the file and set current offset to zero.
 void seek(int filePointer)
           
 void setOffset(int offset)
           
 void setVersion(int ver)
          Setter for version of Code Completion DB file.
 String toString()
          Returns name of the file
 void unlockFile()
          Unlocks the file and notifies wqiting threads
 void write()
          Write bytes array (with offset length) to the file
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait
 

Field Detail

openedForWrite

protected boolean openedForWrite

fileNotFound

public boolean fileNotFound

da

protected DataAccessor da

opened

protected boolean opened

offset

protected int offset
Current offset in the bytes array


bytes

protected byte[] bytes
Byte array holding the data that were read from file

Constructor Detail

FileStorage

public FileStorage(String fileName)
Parameters:
fileName - name of file to operate over

FileStorage

public FileStorage(String fileName,
                   StringCache strCache)

FileStorage

public FileStorage(DataAccessor da,
                   StringCache strCache)
Method Detail

setVersion

public void setVersion(int ver)
Setter for version of Code Completion DB file.


open

public void open(boolean requestWrite)
          throws IOException
Throws:
IOException

close

public void close()
           throws IOException
Throws:
IOException

checkBytesSize

protected void checkBytesSize(int len)
Check size of bytes[] array


read

public void read(int len)
          throws IOException
Read some part of the file into the begining of bytes array and reset offset to zero.

Throws:
IOException

write

public void write()
           throws IOException
Write bytes array (with offset length) to the file

Throws:
IOException

seek

public void seek(int filePointer)
          throws IOException
Throws:
IOException

getFileName

public String getFileName()

getFilePointer

public int getFilePointer()
                   throws IOException
Throws:
IOException

setOffset

public void setOffset(int offset)

getOffset

public int getOffset()

getFileLength

public int getFileLength()
                  throws IOException
Throws:
IOException

resetBytes

public void resetBytes()

resetFile

public void resetFile()
               throws IOException
Reset the size of the file and set current offset to zero.

Throws:
IOException

getInteger

public int getInteger()
Get the integer value from the bytes[] array


getString

public String getString()
Get the string value from the bytes[] array


putInteger

public void putInteger(int i)
Put the integer into bytes[] array. It is stored as four bytes in big endian.


putString

public void putString(String s)
Put the string into bytes[] array. First the length is stored by putInteger() and then all the characters as two bytes each in big endian.


lockFile

public final void lockFile()
Locks the file and disable other threads to write


unlockFile

public final void unlockFile()
Unlocks the file and notifies wqiting threads


toString

public String toString()
Returns name of the file

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.