|
RuneHive-Game
|
A file system based on top of the operating system's file system. More...
Public Member Functions | |
| void | close () throws IOException |
| ByteBuffer | getCrcTable () throws IOException |
| Gets the CRC table. | |
| ByteBuffer | getFile (FileDescriptor fd) throws IOException |
| Gets a file. | |
| ByteBuffer | getFile (int type, int file) throws IOException |
| Gets a file. | |
| ByteBuffer | getJireCRCTable () throws IOException |
| IndexedFileSystem (File base, boolean readOnly) throws Exception | |
| Creates the file system with the specified base directory. | |
| boolean | isReadOnly () |
Checks if this IndexedFileSystem is read only. | |
Static Public Member Functions | |
| static byte[] | gzip (byte[] bytes) throws IOException |
| Compresses a GZIP file. | |
Static Public Attributes | |
| static byte[] | bytes |
Private Member Functions | |
| void | detectLayout (File base) throws Exception |
| Automatically detect the layout of the specified directory. | |
| int | getFileCount (int type) throws IOException |
| Gets the number of files with the specified type. | |
| Index | getIndex (FileDescriptor fd) throws IOException |
| Gets the index of a file. | |
| byte[] | initialResponse () throws IOException |
Private Attributes | |
| ByteBuffer | crcTable |
| The cached CRC table. | |
| RandomAccessFile | data |
| The data file. | |
| RandomAccessFile[] | indices = new RandomAccessFile[256] |
| The index files. | |
| final boolean | readOnly |
| Read only flag. | |
A file system based on top of the operating system's file system.
It consists of a data file and index files. Index files point to blocks in the data file, which contains the actual data.
Definition at line 20 of file IndexedFileSystem.java.
| dev.advo.fs.fs.IndexedFileSystem.IndexedFileSystem | ( | File | base, |
| boolean | readOnly ) throws Exception |
Creates the file system with the specified base directory.
| base | The base directory. |
| readOnly | A flag indicating if the file system will be read only. |
| Exception | if the file system is invalid. |
Definition at line 48 of file IndexedFileSystem.java.
References detectLayout(), and readOnly.
| void dev.advo.fs.fs.IndexedFileSystem.close | ( | ) | throws IOException |
Definition at line 443 of file IndexedFileSystem.java.
|
private |
Automatically detect the layout of the specified directory.
| base | The base directory. |
| Exception | if the file system is invalid. |
Definition at line 66 of file IndexedFileSystem.java.
References bytes, data, indices, initialResponse(), and readOnly.
Referenced by IndexedFileSystem().
| ByteBuffer dev.advo.fs.fs.IndexedFileSystem.getCrcTable | ( | ) | throws IOException |
Gets the CRC table.
| IOException | if an I/O erorr occurs. |
Definition at line 144 of file IndexedFileSystem.java.
References bytes, crcTable, getFile(), getFileCount(), and readOnly.
| ByteBuffer dev.advo.fs.fs.IndexedFileSystem.getFile | ( | FileDescriptor | fd | ) | throws IOException |
Gets a file.
| fd | The FileDescriptor which points to the file. |
ByteBuffer which contains the contents of the file. | IOException | if an I/O error occurs. |
Definition at line 371 of file IndexedFileSystem.java.
References dev.advo.fs.fs.FileSystemConstants.BLOCK_SIZE, dev.advo.fs.fs.FileSystemConstants.CHUNK_SIZE, data, getIndex(), and dev.advo.fs.fs.FileSystemConstants.HEADER_SIZE.
| ByteBuffer dev.advo.fs.fs.IndexedFileSystem.getFile | ( | int | type, |
| int | file ) throws IOException |
Gets a file.
| type | The file type. |
| file | The file id. |
ByteBuffer which contains the contents of the file. | IOException | if an I/O error occurs. |
Definition at line 361 of file IndexedFileSystem.java.
References getFile().
Referenced by getCrcTable(), getFile(), getJireCRCTable(), and initialResponse().
|
private |
Gets the number of files with the specified type.
| type | The type. |
| IOException | if an I/O error occurs. |
Definition at line 128 of file IndexedFileSystem.java.
References dev.advo.fs.fs.FileSystemConstants.INDEX_SIZE, and indices.
Referenced by getCrcTable(), getJireCRCTable(), and initialResponse().
|
private |
Gets the index of a file.
| fd | The FileDescriptor which points to the file. |
Index. | IOException | if an I/O error occurs. |
Definition at line 101 of file IndexedFileSystem.java.
References dev.advo.fs.fs.Index.decode(), dev.advo.fs.fs.FileSystemConstants.INDEX_SIZE, and indices.
Referenced by getFile().
| ByteBuffer dev.advo.fs.fs.IndexedFileSystem.getJireCRCTable | ( | ) | throws IOException |
Definition at line 302 of file IndexedFileSystem.java.
References bytes, crcTable, getFile(), getFileCount(), and readOnly.
|
static |
Compresses a GZIP file.
| bytes | The uncompressed bytes. |
| IOException | if an I/O error occurs. |
Definition at line 203 of file IndexedFileSystem.java.
References bytes.
Referenced by initialResponse().
|
private |
Definition at line 239 of file IndexedFileSystem.java.
References bytes, getFile(), getFileCount(), and gzip().
Referenced by detectLayout().
| boolean dev.advo.fs.fs.IndexedFileSystem.isReadOnly | ( | ) |
Checks if this IndexedFileSystem is read only.
true if so, false if not. Definition at line 57 of file IndexedFileSystem.java.
References readOnly.
|
static |
Definition at line 93 of file IndexedFileSystem.java.
Referenced by detectLayout(), dev.advo.fs.net.service.ServiceResponseEncoder.encode(), getCrcTable(), getJireCRCTable(), gzip(), and initialResponse().
|
private |
The cached CRC table.
Definition at line 40 of file IndexedFileSystem.java.
Referenced by getCrcTable(), and getJireCRCTable().
|
private |
The data file.
Definition at line 35 of file IndexedFileSystem.java.
Referenced by close(), detectLayout(), and getFile().
|
private |
The index files.
Definition at line 30 of file IndexedFileSystem.java.
Referenced by close(), detectLayout(), getFileCount(), and getIndex().
|
private |
Read only flag.
Definition at line 25 of file IndexedFileSystem.java.
Referenced by detectLayout(), getCrcTable(), getJireCRCTable(), IndexedFileSystem(), and isReadOnly().