RuneHive-Game
Loading...
Searching...
No Matches
dev.advo.fs.fs.Index Class Reference

An Index points to a file in the main_file_cache.dat file. More...

Public Member Functions

int getBlock ()
 Gets the first block of the file.
int getSize ()
 Gets the size of the file.
 Index (int size, int block)
 Creates the index.

Static Public Member Functions

static Index decode (byte[] buffer)
 Decodes a buffer into an index.

Private Attributes

final int block
 The first block of the file.
final int size
 The size of the file.

Detailed Description

An Index points to a file in the main_file_cache.dat file.

Author
Graham

Definition at line 7 of file Index.java.

Constructor & Destructor Documentation

◆ Index()

dev.advo.fs.fs.Index.Index ( int size,
int block )

Creates the index.

Parameters
sizeThe size of the file.
blockThe first block of the file.

Definition at line 41 of file Index.java.

41 {
42 this.size = size;
43 this.block = block;
44 }

References block, and size.

Referenced by decode().

Here is the caller graph for this function:

Member Function Documentation

◆ decode()

Index dev.advo.fs.fs.Index.decode ( byte[] buffer)
static

Decodes a buffer into an index.

Parameters
bufferThe buffer.
Returns
The decoded Index.
Exceptions
IllegalArgumentExceptionif the buffer length is invalid.

Definition at line 15 of file Index.java.

15 {
16 if (buffer.length != FileSystemConstants.INDEX_SIZE) {
17 throw new IllegalArgumentException("Incorrect buffer length.");
18 }
19
20 int size = ((buffer[0] & 0xFF) << 16) | ((buffer[1] & 0xFF) << 8) | (buffer[2] & 0xFF);
21 int block = ((buffer[3] & 0xFF) << 16) | ((buffer[4] & 0xFF) << 8) | (buffer[5] & 0xFF);
22
23 return new Index(size, block);
24 }

References block, Index(), dev.advo.fs.fs.FileSystemConstants.INDEX_SIZE, and size.

Referenced by dev.advo.fs.fs.IndexedFileSystem.getIndex().

Here is the call graph for this function:
Here is the caller graph for this function:

◆ getBlock()

int dev.advo.fs.fs.Index.getBlock ( )

Gets the first block of the file.

Returns
The first block of the file.

Definition at line 58 of file Index.java.

58 {
59 return block;
60 }

References block.

◆ getSize()

int dev.advo.fs.fs.Index.getSize ( )

Gets the size of the file.

Returns
The size of the file.

Definition at line 50 of file Index.java.

50 {
51 return size;
52 }

References size.

Member Data Documentation

◆ block

final int dev.advo.fs.fs.Index.block
private

The first block of the file.

Definition at line 34 of file Index.java.

Referenced by decode(), getBlock(), and Index().

◆ size

final int dev.advo.fs.fs.Index.size
private

The size of the file.

Definition at line 29 of file Index.java.

Referenced by decode(), getSize(), and Index().


The documentation for this class was generated from the following file: