RuneHive-Game
Loading...
Searching...
No Matches
com.runehive.fs.cache.decoder.Buffer Class Reference
Collaboration diagram for com.runehive.fs.cache.decoder.Buffer:

Public Member Functions

 Buffer (byte[] array)
void encodeRSA (BigInteger exponent, BigInteger modulus)
void finishBitAccess ()
int getUIncrementalSmart ()
void initBitAccess ()
void method403 (int j)
int method421 ()
int method422 ()
void method425 (int j)
byte method429 ()
byte method430 ()
int method438 ()
int method439 ()
int method440 ()
void method441 (int i, byte[] abyte0, int j)
byte peek ()
int read24Int ()
int readBigSmart2 ()
int readBits (int amount)
byte[] readBytes ()
byte[] readBytes (final int length)
void readBytes (int amount, int offset, byte[] destination)
float readFloat ()
int readInt ()
int readLEShort ()
int readLEUShort ()
int readLEUShortA ()
int readMedium ()
int readNegUByte ()
String readNewString ()
void readReverseData (int i, int j, byte[] abyte0)
int readShort ()
int readShort2 ()
int readShortOSRS ()
int readShortSmart ()
byte readSignedByte ()
int readSignedShort ()
int readSignedSmart ()
int readSignedWord ()
int readSmart ()
String readString ()
String readStringCp1252NullTerminated ()
String readStringNew ()
int readUByteA ()
int readUByteS ()
int readUnsignedByte ()
int readUnsignedInt ()
int readUnsignedIntSmartShortCompat ()
long readUnsignedLong ()
int readUnsignedShort ()
int readUnsignedShortSmart ()
int readUnsignedShortSmartMinusOne ()
int readUnsignedTriByte ()
int readUShort ()
int readUShortA ()
int readUSmart2 ()
void setOffset (int offset)
void setPosition (int offset)
void writeByte (int i)
void writeBytes (byte[] abyte0, int i, int j)
void writeBytes (int i)
void writeDWord (int i)
void writeDWordBigEndian (int i)
void writeLEShort (int i)
void writeLEShortA (int j)
void writeNegatedByte (int i)
void writeOpcode (int i)
void writeQWord (long l)
void writeShort (int i)
void writeShortA (int j)
void writeString (String s)

Static Public Member Functions

static String decodeStringCp1252 (byte[] var0, int var1, int var2)
static Buffer fromByteBuffer (final ByteBuffer byteBuffer)

Public Attributes

byte[] array
int bitPosition
IsaacCipher encryption
int position

Static Public Attributes

static final char[] cp1252AsciiExtension = new char[]{'€', '\u0000', '‚', 'ƒ', '„', '…', '†', '‡', 'ˆ', '‰', 'Š', '‹', 'Œ', '\u0000', 'Ž', '\u0000', '\u0000', '‘', '’', '“', '”', '•', '–', '—', '˜', '™', 'š', '›', 'œ', '\u0000', 'ž', 'Ÿ'}

Package Functions

final int v (int i)

Private Member Functions

 Buffer ()

Static Private Attributes

static int anInt1412
static final int[] BIT_MASK = {0, 1, 3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 32767, 65535, 0x1ffff, 0x3ffff, 0x7ffff, 0xfffff, 0x1fffff, 0x3fffff, 0x7fffff, 0xffffff, 0x1ffffff, 0x3ffffff, 0x7ffffff, 0xfffffff, 0x1fffffff, 0x3fffffff, 0x7fffffff, -1}

Detailed Description

Definition at line 8 of file Buffer.java.

Constructor & Destructor Documentation

◆ Buffer() [1/2]

com.runehive.fs.cache.decoder.Buffer.Buffer ( )
private

Definition at line 104 of file Buffer.java.

104 {
105 }

Referenced by fromByteBuffer().

Here is the caller graph for this function:

◆ Buffer() [2/2]

com.runehive.fs.cache.decoder.Buffer.Buffer ( byte[] array)

Definition at line 107 of file Buffer.java.

107 {
108 this.array = array;
109 position = 0;
110 }

References array, and position.

Member Function Documentation

◆ decodeStringCp1252()

String com.runehive.fs.cache.decoder.Buffer.decodeStringCp1252 ( byte[] var0,
int var1,
int var2 )
static

Definition at line 312 of file Buffer.java.

312 {
313 char[] var3 = new char[var2];
314 int var4 = 0;
315
316 for(int var5 = 0; var5 < var2; ++var5) {
317 int var6 = var0[var5 + var1] & 255;
318 if (var6 != 0) {
319 if (var6 >= 128 && var6 < 160) {
320 char var7 = cp1252AsciiExtension[var6 - 128];
321 if (var7 == 0) {
322 var7 = '?';
323 }
324
325 var6 = var7;
326 }
327
328 var3[var4++] = (char)var6;
329 }
330 }
331
332 return new String(var3, 0, var4);
333 }

References cp1252AsciiExtension.

Referenced by readStringCp1252NullTerminated().

Here is the caller graph for this function:

◆ encodeRSA()

void com.runehive.fs.cache.decoder.Buffer.encodeRSA ( BigInteger exponent,
BigInteger modulus )

Definition at line 395 of file Buffer.java.

395 {
396 int i = position;
397 position = 0;
398 byte[] abyte0 = new byte[i];
399 readBytes(i, 0, abyte0);
400
401 byte[] rsa = new BigInteger(abyte0).modPow(exponent, modulus).toByteArray();
402
403 position = 0;
404 writeByte(rsa.length);
405 writeBytes(rsa, rsa.length, 0);
406 }

References position, readBytes(), writeByte(), and writeBytes().

Here is the call graph for this function:

◆ finishBitAccess()

void com.runehive.fs.cache.decoder.Buffer.finishBitAccess ( )

Definition at line 375 of file Buffer.java.

375 {
376 position = (bitPosition + 7) / 8;
377 }

References bitPosition, and position.

◆ fromByteBuffer()

Buffer com.runehive.fs.cache.decoder.Buffer.fromByteBuffer ( final ByteBuffer byteBuffer)
static

Definition at line 112 of file Buffer.java.

112 {
113 final byte[] array = new byte[byteBuffer.capacity()];
114 byteBuffer.get(array);
115 return new Buffer(array);
116 }

References array, and Buffer().

Referenced by com.runehive.fs.cache.decoder.CacheNpcDefinition.unpackConfig().

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

◆ getUIncrementalSmart()

int com.runehive.fs.cache.decoder.Buffer.getUIncrementalSmart ( )

Definition at line 270 of file Buffer.java.

270 {
271 int value = 0, remainder;
272 for (remainder = method422(); remainder == 32767; remainder = method422()) {
273 value += 32767;
274 }
275 value += remainder;
276 return value;
277 }

References method422().

Here is the call graph for this function:

◆ initBitAccess()

void com.runehive.fs.cache.decoder.Buffer.initBitAccess ( )

Definition at line 350 of file Buffer.java.

350 {
351 bitPosition = position * 8;
352 }

References bitPosition, and position.

◆ method403()

void com.runehive.fs.cache.decoder.Buffer.method403 ( int j)

Definition at line 181 of file Buffer.java.

181 {
182 array[position++] = (byte) j;
183 array[position++] = (byte) (j >> 8);
184 array[position++] = (byte) (j >> 16);
185 array[position++] = (byte) (j >> 24);
186 }

References array, and position.

◆ method421()

int com.runehive.fs.cache.decoder.Buffer.method421 ( )

Definition at line 379 of file Buffer.java.

379 {
380 int i = array[position] & 0xff;
381 if (i < 128)
382 return readUnsignedByte() - 64;
383 else
384 return readUnsignedShort() - 49152;
385 }

References array, position, readUnsignedByte(), and readUnsignedShort().

Here is the call graph for this function:

◆ method422()

int com.runehive.fs.cache.decoder.Buffer.method422 ( )

Definition at line 387 of file Buffer.java.

387 {
388 int i = array[position] & 0xff;
389 if (i < 128)
390 return readUnsignedByte();
391 else
392 return readUnsignedShort() - 32768;
393 }

References array, position, readUnsignedByte(), and readUnsignedShort().

Referenced by getUIncrementalSmart(), and readUSmart2().

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

◆ method425()

void com.runehive.fs.cache.decoder.Buffer.method425 ( int j)

Definition at line 412 of file Buffer.java.

412 {
413 array[position++] = (byte) (128 - j);
414 }

References array, and position.

◆ method429()

byte com.runehive.fs.cache.decoder.Buffer.method429 ( )

Definition at line 428 of file Buffer.java.

428 {
429 return (byte) (-array[position++]);
430 }

References array, and position.

◆ method430()

byte com.runehive.fs.cache.decoder.Buffer.method430 ( )

Definition at line 432 of file Buffer.java.

432 {
433 return (byte) (128 - array[position++]);
434 }

References array, and position.

◆ method438()

int com.runehive.fs.cache.decoder.Buffer.method438 ( )

Definition at line 474 of file Buffer.java.

474 {
475 position += 2;
476 int j = ((array[position - 1] & 0xff) << 8) + (array[position - 2] - 128 & 0xff);
477 if (j > 32767)
478 j -= 0x10000;
479 return j;
480 }

References array, and position.

◆ method439()

int com.runehive.fs.cache.decoder.Buffer.method439 ( )

Definition at line 482 of file Buffer.java.

482 {
483 position += 4;
484 return ((array[position - 2] & 0xff) << 24) + ((array[position - 1] & 0xff) << 16) + ((array[position - 4] & 0xff) << 8) + (array[position - 3] & 0xff);
485 }

References array, and position.

◆ method440()

int com.runehive.fs.cache.decoder.Buffer.method440 ( )

Definition at line 487 of file Buffer.java.

487 {
488 position += 4;
489 return ((array[position - 3] & 0xff) << 24) + ((array[position - 4] & 0xff) << 16) + ((array[position - 1] & 0xff) << 8) + (array[position - 2] & 0xff);
490 }

References array, and position.

◆ method441()

void com.runehive.fs.cache.decoder.Buffer.method441 ( int i,
byte[] abyte0,
int j )

Definition at line 492 of file Buffer.java.

492 {
493 for (int k = (i + j) - 1; k >= i; k--)
494 array[position++] = (byte) (abyte0[k] + 128);
495
496 }

References array, and position.

◆ peek()

byte com.runehive.fs.cache.decoder.Buffer.peek ( )

Definition at line 231 of file Buffer.java.

232 {
233 return array[position];
234 }

References array, and position.

Referenced by readBigSmart2(), readShortSmart(), readSignedSmart(), readUnsignedShortSmart(), and readUnsignedShortSmartMinusOne().

Here is the caller graph for this function:

◆ read24Int()

int com.runehive.fs.cache.decoder.Buffer.read24Int ( )

Definition at line 53 of file Buffer.java.

53 {
54 position += 3;
55 return ((array[position - 3] & 0xff) << 16) + ((array[position - 2] & 0xff) << 8) + (array[position - 1] & 0xff);
56 }

References array, and position.

◆ readBigSmart2()

int com.runehive.fs.cache.decoder.Buffer.readBigSmart2 ( )

Definition at line 242 of file Buffer.java.

243 {
244 if (peek() < 0)
245 {
246 return readInt() & Integer.MAX_VALUE; // and off sign bit
247 }
248 int value = readUnsignedShort();
249 return value == 32767 ? -1 : value;
250 }

References peek(), readInt(), and readUnsignedShort().

Referenced by com.runehive.fs.cache.decoder.CacheNpcDefinition.decode().

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

◆ readBits()

int com.runehive.fs.cache.decoder.Buffer.readBits ( int amount)

Definition at line 354 of file Buffer.java.

354 {
355 int bytePos = bitPosition >> 3;
356 int bitOffset = 8 - (bitPosition & 7);
357 int value = 0;
358
359 bitPosition += amount;
360
361 for (; amount > bitOffset; bitOffset = 8) {
362 value += (array[bytePos++] & BIT_MASK[bitOffset]) << amount - bitOffset;
363 amount -= bitOffset;
364 }
365
366 if (amount == bitOffset) {
367 value += array[bytePos] & BIT_MASK[bitOffset];
368 } else {
369 value += array[bytePos] >> bitOffset - amount & BIT_MASK[amount];
370 }
371
372 return value;
373 }

References array, BIT_MASK, and bitPosition.

◆ readBytes() [1/3]

byte[] com.runehive.fs.cache.decoder.Buffer.readBytes ( )

Definition at line 337 of file Buffer.java.

337 {
338 int start = position;
339 while (array[position++] != 10);
340 byte[] bytes = new byte[position - start - 1];
341 System.arraycopy(array, start, bytes, start - start, position - 1 - start);
342 return bytes;
343 }

References array, and position.

Referenced by com.runehive.fs.cache.decoder.CacheNpcDefinition.decode(), and encodeRSA().

Here is the caller graph for this function:

◆ readBytes() [2/3]

byte[] com.runehive.fs.cache.decoder.Buffer.readBytes ( final int length)

Definition at line 508 of file Buffer.java.

508 {
509 final byte[] bytes = new byte[length];
510 System.arraycopy(array, position, bytes, 0, length);
511 position += length;
512 return bytes;
513 }

References array, and position.

◆ readBytes() [3/3]

void com.runehive.fs.cache.decoder.Buffer.readBytes ( int amount,
int offset,
byte[] destination )

Definition at line 345 of file Buffer.java.

345 {
346 for (int l = offset; l < offset + amount; l++)
347 destination[l] = array[position++];
348 }

References array, and position.

◆ readFloat()

float com.runehive.fs.cache.decoder.Buffer.readFloat ( )

Definition at line 504 of file Buffer.java.

504 {
505 return Float.intBitsToFloat(readInt());
506 }

References readInt().

Here is the call graph for this function:

◆ readInt()

int com.runehive.fs.cache.decoder.Buffer.readInt ( )

Definition at line 70 of file Buffer.java.

70 {
71 position += 4;
72 return ((array[position - 4] & 0xff) << 24)
73 + ((array[position - 3] & 0xff) << 16)
74 + ((array[position - 2] & 0xff) << 8)
75 + (array[position - 1] & 0xff);
76 }

References array, and position.

Referenced by readBigSmart2(), and readFloat().

Here is the caller graph for this function:

◆ readLEShort()

int com.runehive.fs.cache.decoder.Buffer.readLEShort ( )

Definition at line 466 of file Buffer.java.

466 {
467 position += 2;
468 int j = ((array[position - 1] & 0xff) << 8) + (array[position - 2] & 0xff);
469 if (j > 32767)
470 j -= 0x10000;
471 return j;
472 }

References array, and position.

◆ readLEUShort()

int com.runehive.fs.cache.decoder.Buffer.readLEUShort ( )

Definition at line 451 of file Buffer.java.

451 {
452 position += 2;
453 return ((array[position - 1] & 0xff) << 8) + (array[position - 2] & 0xff);
454 }

References array, and position.

◆ readLEUShortA()

int com.runehive.fs.cache.decoder.Buffer.readLEUShortA ( )

Definition at line 461 of file Buffer.java.

461 {
462 position += 2;
463 return ((array[position - 1] & 0xff) << 8) + (array[position - 2] - 128 & 0xff);
464 }

References array, and position.

◆ readMedium()

int com.runehive.fs.cache.decoder.Buffer.readMedium ( )

Definition at line 58 of file Buffer.java.

58 {
59 this.position += 3;
60 return ((this.array[this.position - 3] & 255) << 16) + (this.array[this.position - 1] & 255) + ((this.array[this.position - 2] & 255) << 8);
61 }

References array, and position.

◆ readNegUByte()

int com.runehive.fs.cache.decoder.Buffer.readNegUByte ( )

Definition at line 420 of file Buffer.java.

420 {
421 return -array[position++] & 0xff;
422 }

References array, and position.

◆ readNewString()

String com.runehive.fs.cache.decoder.Buffer.readNewString ( )

Definition at line 147 of file Buffer.java.

147 {
148 int i = position;
149 while (array[position++] != 0)
150 ;
151 return new String(array, i, position - i - 1);
152 }

References array, and position.

◆ readReverseData()

void com.runehive.fs.cache.decoder.Buffer.readReverseData ( int i,
int j,
byte[] abyte0 )

Definition at line 498 of file Buffer.java.

498 {
499 for (int k = (j + i) - 1; k >= j; k--)
500 abyte0[k] = array[position++];
501
502 }

References array, and position.

◆ readShort()

int com.runehive.fs.cache.decoder.Buffer.readShort ( )

Definition at line 78 of file Buffer.java.

78 {
79 position += 2;
80 int value = ((array[position - 2] & 0xff) << 8)
81 + (array[position - 1] & 0xff);
82
83 if (value > 32767) {
84 value -= 0x10000;
85 }
86 return value;
87 }

References array, and position.

◆ readShort2()

int com.runehive.fs.cache.decoder.Buffer.readShort2 ( )

Definition at line 29 of file Buffer.java.

29 {
30 position += 2;
31 int i = ((array[position - 2] & 0xff) << 8) + (array[position - 1] & 0xff);
32 if (i > 60000)
33 i = -65535 + i;
34 return i;
35
36 }

References array, and position.

◆ readShortOSRS()

int com.runehive.fs.cache.decoder.Buffer.readShortOSRS ( )

Definition at line 89 of file Buffer.java.

89 {
90 this.position += 2;
91 int var1 = (this.array[this.position - 1] & 255) + ((this.array[this.position - 2] & 255) << 8);
92 if (var1 > 32767) {
93 var1 -= 65536;
94 }
95
96 return var1;
97 }

References array, and position.

◆ readShortSmart()

int com.runehive.fs.cache.decoder.Buffer.readShortSmart ( )

Definition at line 47 of file Buffer.java.

48 {
49 int peek = array[position] & 0xFF;
50 return peek < 128 ? this.readUnsignedByte() - 64 : this.readUnsignedShort() - 0xc000;
51 }

References array, peek(), position, readUnsignedByte(), and readUnsignedShort().

Here is the call graph for this function:

◆ readSignedByte()

byte com.runehive.fs.cache.decoder.Buffer.readSignedByte ( )

Definition at line 252 of file Buffer.java.

252 {
253 return array[position++];
254 }

References array, and position.

Referenced by com.runehive.fs.cache.decoder.CacheNpcDefinition.decode().

Here is the caller graph for this function:

◆ readSignedShort()

int com.runehive.fs.cache.decoder.Buffer.readSignedShort ( )

Definition at line 38 of file Buffer.java.

38 {
39 this.position += 2;
40 int value = ((this.array[this.position - 2] & 0xff) << 8) + (this.array[this.position - 1] & 0xff);
41 if (value > 32767)
42 value -= 0x10000; //theres no errors its just gradle being slow as fck
43
44 return value;
45 }

References array, and position.

◆ readSignedSmart()

int com.runehive.fs.cache.decoder.Buffer.readSignedSmart ( )

Definition at line 223 of file Buffer.java.

223 {
224 int value = peek() & 0xff;
225 if (value < 128)
226 return this.readUnsignedByte() - 64;
227 else
228 return this.readUnsignedShort() - 49152;
229 }

References peek(), readUnsignedByte(), and readUnsignedShort().

Here is the call graph for this function:

◆ readSignedWord()

int com.runehive.fs.cache.decoder.Buffer.readSignedWord ( )

Definition at line 261 of file Buffer.java.

261 {
262 position += 2;
263 int i = ((array[position - 2] & 0xff) << 8) + (array[position - 1] & 0xff);
264 if (i > 32767) {
265 i -= 0x10000;
266 }
267 return i;
268 }

References array, and position.

◆ readSmart()

int com.runehive.fs.cache.decoder.Buffer.readSmart ( )

Definition at line 15 of file Buffer.java.

15 {
16 int value = array[position] & 0xff;
17 if (value < 128)
18 return readUnsignedByte() - 64;
19 else
20 return readUShort() - 49152;
21 }

References array, position, readUnsignedByte(), and readUShort().

Here is the call graph for this function:

◆ readString()

String com.runehive.fs.cache.decoder.Buffer.readString ( )

Definition at line 295 of file Buffer.java.

295 {
296 int start = position;
297 while (array[position++] != 10);
298 return new String(array, start, position - start - 1);
299 }

References array, and position.

◆ readStringCp1252NullTerminated()

String com.runehive.fs.cache.decoder.Buffer.readStringCp1252NullTerminated ( )

Definition at line 301 of file Buffer.java.

301 {
302 int var1 = this.position;
303
304 while(this.array[++this.position - 1] != 0) {
305 ;
306 }
307
308 int var2 = this.position - var1 - 1;
309 return var2 == 0 ? "" : decodeStringCp1252(this.array, var1, var2);
310 }

References array, decodeStringCp1252(), and position.

Referenced by com.runehive.fs.cache.decoder.CacheNpcDefinition.decode().

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

◆ readStringNew()

String com.runehive.fs.cache.decoder.Buffer.readStringNew ( )

Definition at line 22 of file Buffer.java.

22 {
23 int i = position;
24 while (array[position++] != 0)
25 ;
26 return new String(array, i, position - i - 1);
27 }

References array, and position.

◆ readUByteA()

int com.runehive.fs.cache.decoder.Buffer.readUByteA ( )

Definition at line 416 of file Buffer.java.

416 {
417 return array[position++] - 128 & 0xff;
418 }

References array, and position.

◆ readUByteS()

int com.runehive.fs.cache.decoder.Buffer.readUByteS ( )

Definition at line 424 of file Buffer.java.

424 {
425 return 128 - array[position++] & 0xff;
426 }

References array, and position.

◆ readUnsignedByte()

int com.runehive.fs.cache.decoder.Buffer.readUnsignedByte ( )

Definition at line 219 of file Buffer.java.

219 {
220 return array[position++] & 0xff;
221 }

References array, and position.

Referenced by com.runehive.fs.cache.decoder.CacheNpcDefinition.decode(), method421(), method422(), readShortSmart(), readSignedSmart(), readSmart(), readUnsignedShortSmart(), and readUnsignedShortSmartMinusOne().

Here is the caller graph for this function:

◆ readUnsignedInt()

int com.runehive.fs.cache.decoder.Buffer.readUnsignedInt ( )

Definition at line 284 of file Buffer.java.

284 {
285 position += 4;
286 return ((array[position - 4] & 0xff) << 24) + ((array[position - 3] & 0xff) << 16) + ((array[position - 2] & 0xff) << 8) + (array[position - 1] & 0xff);
287 }

References array, and position.

Referenced by com.runehive.fs.cache.decoder.CacheNpcDefinition.decode(), and readUnsignedLong().

Here is the caller graph for this function:

◆ readUnsignedIntSmartShortCompat()

int com.runehive.fs.cache.decoder.Buffer.readUnsignedIntSmartShortCompat ( )

Definition at line 124 of file Buffer.java.

125 {
126 int var1 = 0;
127
128 int var2;
129 for (var2 = this.readUnsignedShortSmart(); var2 == 32767; var2 = this.readUnsignedShortSmart())
130 {
131 var1 += 32767;
132 }
133
134 var1 += var2;
135 return var1;
136 }

References readUnsignedShortSmart().

Here is the call graph for this function:

◆ readUnsignedLong()

long com.runehive.fs.cache.decoder.Buffer.readUnsignedLong ( )

Definition at line 289 of file Buffer.java.

289 {
290 long big = (long) readUnsignedInt() & 0xFFFF_FFFFL;
291 long little = (long) readUnsignedInt() & 0xFFFF_FFFFL;
292 return (big << 32) + little;
293 }

References readUnsignedInt().

Here is the call graph for this function:

◆ readUnsignedShort()

int com.runehive.fs.cache.decoder.Buffer.readUnsignedShort ( )

Definition at line 256 of file Buffer.java.

256 {
257 position += 2;
258 return ((array[position - 2] & 0xff) << 8) + (array[position - 1] & 0xff);
259 }

References array, and position.

Referenced by com.runehive.fs.cache.decoder.CacheNpcDefinition.decode(), method421(), method422(), readBigSmart2(), readShortSmart(), readSignedSmart(), readUnsignedShortSmart(), readUnsignedShortSmartMinusOne(), and com.runehive.fs.cache.decoder.CacheNpcDefinition.unpackConfig().

Here is the caller graph for this function:

◆ readUnsignedShortSmart()

int com.runehive.fs.cache.decoder.Buffer.readUnsignedShortSmart ( )

Definition at line 118 of file Buffer.java.

119 {
120 int peek = this.peek() & 0xFF;
121 return peek < 128 ? this.readUnsignedByte() : this.readUnsignedShort() - 0x8000;
122 }

References peek(), readUnsignedByte(), and readUnsignedShort().

Referenced by readUnsignedIntSmartShortCompat().

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

◆ readUnsignedShortSmartMinusOne()

int com.runehive.fs.cache.decoder.Buffer.readUnsignedShortSmartMinusOne ( )

Definition at line 236 of file Buffer.java.

237 {
238 int peek = this.peek() & 0xFF;
239 return peek < 128 ? this.readUnsignedByte() - 1 : this.readUnsignedShort() - 0x8001;
240 }

References peek(), readUnsignedByte(), and readUnsignedShort().

Referenced by com.runehive.fs.cache.decoder.CacheNpcDefinition.decode().

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

◆ readUnsignedTriByte()

int com.runehive.fs.cache.decoder.Buffer.readUnsignedTriByte ( )

Definition at line 279 of file Buffer.java.

279 {
280 position += 3;
281 return ((array[position - 3] & 0xff) << 16) + ((array[position - 2] & 0xff) << 8) + (array[position - 1] & 0xff);
282 }

References array, and position.

Referenced by com.runehive.fs.cache.decoder.CacheNpcDefinition.decode().

Here is the caller graph for this function:

◆ readUShort()

int com.runehive.fs.cache.decoder.Buffer.readUShort ( )

Definition at line 64 of file Buffer.java.

64 {
65 position += 2;
66 return ((array[position - 2] & 0xff) << 8)
67 + (array[position - 1] & 0xff);
68 }

References array, and position.

Referenced by readSmart().

Here is the caller graph for this function:

◆ readUShortA()

int com.runehive.fs.cache.decoder.Buffer.readUShortA ( )

Definition at line 456 of file Buffer.java.

456 {
457 position += 2;
458 return ((array[position - 2] & 0xff) << 8) + (array[position - 1] - 128 & 0xff);
459 }

References array, and position.

◆ readUSmart2()

int com.runehive.fs.cache.decoder.Buffer.readUSmart2 ( )

Definition at line 138 of file Buffer.java.

138 {
139 int baseVal = 0;
140 int lastVal = 0;
141 while ((lastVal = method422()) == 32767) {
142 baseVal += 32767;
143 }
144 return baseVal + lastVal;
145 }

References method422().

Here is the call graph for this function:

◆ setOffset()

void com.runehive.fs.cache.decoder.Buffer.setOffset ( int offset)

Definition at line 11 of file Buffer.java.

11 {
12 this.position = offset;
13 }

◆ setPosition()

void com.runehive.fs.cache.decoder.Buffer.setPosition ( int offset)

Definition at line 522 of file Buffer.java.

522 {
523 this.position = offset;
524 }

◆ v()

final int com.runehive.fs.cache.decoder.Buffer.v ( int i)
package

Definition at line 99 of file Buffer.java.

99 {
100 position += 3;
101 return (0xff & array[position - 3] << 16) + (0xff & array[position - 2] << 8) + (0xff & array[position - 1]);
102 }

References array, and position.

◆ writeByte()

void com.runehive.fs.cache.decoder.Buffer.writeByte ( int i)

Definition at line 159 of file Buffer.java.

159 {
160 array[position++] = (byte) i;
161 }

References array, and position.

Referenced by encodeRSA().

Here is the caller graph for this function:

◆ writeBytes() [1/2]

void com.runehive.fs.cache.decoder.Buffer.writeBytes ( byte[] abyte0,
int i,
int j )

Definition at line 210 of file Buffer.java.

210 {
211 for (int k = j; k < j + i; k++)
212 array[position++] = abyte0[k];
213 }

References array, and position.

Referenced by encodeRSA().

Here is the caller graph for this function:

◆ writeBytes() [2/2]

void com.runehive.fs.cache.decoder.Buffer.writeBytes ( int i)

Definition at line 215 of file Buffer.java.

215 {
216 array[position - i - 1] = (byte) i;
217 }

References array, and position.

◆ writeDWord()

void com.runehive.fs.cache.decoder.Buffer.writeDWord ( int i)

Definition at line 174 of file Buffer.java.

174 {
175 array[position++] = (byte) (i >> 24);
176 array[position++] = (byte) (i >> 16);
177 array[position++] = (byte) (i >> 8);
178 array[position++] = (byte) i;
179 }

References array, and position.

◆ writeDWordBigEndian()

void com.runehive.fs.cache.decoder.Buffer.writeDWordBigEndian ( int i)

Definition at line 168 of file Buffer.java.

168 {
169 array[position++] = (byte) (i >> 16);
170 array[position++] = (byte) (i >> 8);
171 array[position++] = (byte) i;
172 }

References array, and position.

◆ writeLEShort()

void com.runehive.fs.cache.decoder.Buffer.writeLEShort ( int i)

Definition at line 436 of file Buffer.java.

436 {
437 array[position++] = (byte) i;
438 array[position++] = (byte) (i >> 8);
439 }

References array, and position.

◆ writeLEShortA()

void com.runehive.fs.cache.decoder.Buffer.writeLEShortA ( int j)

Definition at line 446 of file Buffer.java.

446 {
447 array[position++] = (byte) (j + 128);
448 array[position++] = (byte) (j >> 8);
449 }

References array, and position.

◆ writeNegatedByte()

void com.runehive.fs.cache.decoder.Buffer.writeNegatedByte ( int i)

Definition at line 408 of file Buffer.java.

408 {
409 array[position++] = (byte) (-i);
410 }

References array, and position.

◆ writeOpcode()

void com.runehive.fs.cache.decoder.Buffer.writeOpcode ( int i)

Definition at line 154 of file Buffer.java.

154 {
155 // System.out.println("Frame: " + i);
156 array[position++] = (byte) (i + encryption.getKey());
157 }

References array, encryption, and position.

◆ writeQWord()

void com.runehive.fs.cache.decoder.Buffer.writeQWord ( long l)

Definition at line 188 of file Buffer.java.

188 {
189 try {
190 array[position++] = (byte) (int) (l >> 56);
191 array[position++] = (byte) (int) (l >> 48);
192 array[position++] = (byte) (int) (l >> 40);
193 array[position++] = (byte) (int) (l >> 32);
194 array[position++] = (byte) (int) (l >> 24);
195 array[position++] = (byte) (int) (l >> 16);
196 array[position++] = (byte) (int) (l >> 8);
197 array[position++] = (byte) (int) l;
198 } catch (RuntimeException runtimeexception) {
199 throw new RuntimeException();
200 }
201 }

References array, and position.

◆ writeShort()

void com.runehive.fs.cache.decoder.Buffer.writeShort ( int i)

Definition at line 163 of file Buffer.java.

163 {
164 array[position++] = (byte) (i >> 8);
165 array[position++] = (byte) i;
166 }

References array, and position.

◆ writeShortA()

void com.runehive.fs.cache.decoder.Buffer.writeShortA ( int j)

Definition at line 441 of file Buffer.java.

441 {
442 array[position++] = (byte) (j >> 8);
443 array[position++] = (byte) (j + 128);
444 }

References array, and position.

◆ writeString()

void com.runehive.fs.cache.decoder.Buffer.writeString ( String s)

Definition at line 203 of file Buffer.java.

203 {
204 // s.getBytes(0, s.length(), buffer, currentOffset); //deprecated
205 System.arraycopy(s.getBytes(), 0, array, position, s.length());
206 position += s.length();
207 array[position++] = 10;
208 }

References array, and position.

Member Data Documentation

◆ anInt1412

int com.runehive.fs.cache.decoder.Buffer.anInt1412
staticprivate

Definition at line 520 of file Buffer.java.

◆ array

◆ BIT_MASK

final int [] com.runehive.fs.cache.decoder.Buffer.BIT_MASK = {0, 1, 3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 32767, 65535, 0x1ffff, 0x3ffff, 0x7ffff, 0xfffff, 0x1fffff, 0x3fffff, 0x7fffff, 0xffffff, 0x1ffffff, 0x3ffffff, 0x7ffffff, 0xfffffff, 0x1fffffff, 0x3fffffff, 0x7fffffff, -1}
staticprivate

Definition at line 518 of file Buffer.java.

518{0, 1, 3, 7, 15, 31, 63, 127, 255, 511, 1023, 2047, 4095, 8191, 16383, 32767, 65535, 0x1ffff, 0x3ffff, 0x7ffff, 0xfffff, 0x1fffff, 0x3fffff, 0x7fffff, 0xffffff, 0x1ffffff, 0x3ffffff, 0x7ffffff, 0xfffffff, 0x1fffffff, 0x3fffffff, 0x7fffffff, -1};

Referenced by readBits().

◆ bitPosition

int com.runehive.fs.cache.decoder.Buffer.bitPosition

Definition at line 517 of file Buffer.java.

Referenced by finishBitAccess(), initBitAccess(), and readBits().

◆ cp1252AsciiExtension

final char [] com.runehive.fs.cache.decoder.Buffer.cp1252AsciiExtension = new char[]{'€', '\u0000', '‚', 'ƒ', '„', '…', '†', '‡', 'ˆ', '‰', 'Š', '‹', 'Œ', '\u0000', 'Ž', '\u0000', '\u0000', '‘', '’', '“', '”', '•', '–', '—', '˜', '™', 'š', '›', 'œ', '\u0000', 'ž', 'Ÿ'}
static

Definition at line 335 of file Buffer.java.

335{'€', '\u0000', '‚', 'ƒ', '„', '…', '†', '‡', 'ˆ', '‰', 'Š', '‹', 'Œ', '\u0000', 'Ž', '\u0000', '\u0000', '‘', '’', '“', '”', '•', '–', '—', '˜', '™', 'š', '›', 'œ', '\u0000', 'ž', 'Ÿ'};

Referenced by decodeStringCp1252().

◆ encryption

IsaacCipher com.runehive.fs.cache.decoder.Buffer.encryption

Definition at line 519 of file Buffer.java.

Referenced by writeOpcode().

◆ position


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