1package com.runehive.fs.cache;
3import com.google.common.base.Preconditions;
4import com.runehive.fs.util.ByteBufferUtil;
6import java.nio.ByteBuffer;
54 public static Sector decode(ByteBuffer buffer,
byte[] data,
int offset,
int length) {
55 int indexId = buffer.getShort() & 0xFFFF;
56 int chunk = buffer.getShort() & 0xFFFF;
58 int cacheId = buffer.get() & 0xFF;
59 buffer.get(data, offset, length);
71 Preconditions.checkArgument(this.cacheId ==
cacheId);
72 Preconditions.checkArgument(this.indexId ==
indexId);
73 Preconditions.checkArgument(this.chunk ==
chunk);
void check(int cacheId, int indexId, int chunk)
Tests whether or not this sector is valid.
final int indexId
The id of the index this sector is within.
Sector(int indexId, int chunk, int nextIndexId, int cacheId)
Constructs a new Sector with the expected index id, chunk, next index id and cache id.
final int cacheId
The id of the cache this sector is in.
int getCacheId()
Returns the id of the cache this sector is in.
int getNextIndexId()
Returns the next index within this sector.
int getChunk()
Returns this sectors chunk.
final int nextIndexId
The next index within this sector.
int getIndexId()
Returns the id of the index this sector is within.
final int chunk
This sectors chunk.
static Sector decode(ByteBuffer buffer, byte[] data, int offset, int length)
Decodes a Sector from the specified ByteBuffer.
A static-utility class containing extension or helper methods for ByteBuffers.
static int getMedium(ByteBuffer buffer)
Gets a 24-bit medium integer from the specified ByteBuffer, this method does not mark the ByteBuffers...