Skip to content

Commit

Permalink
Updated compiled jar file.
Browse files Browse the repository at this point in the history
  • Loading branch information
Displee committed Sep 30, 2018
1 parent 9dff402 commit 07e656f
Show file tree
Hide file tree
Showing 5 changed files with 38 additions and 27 deletions.
1 change: 0 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@
*.iml
.settings
bin
RS2-Cache-Library.jar

# virtual machine crash logs, see http://www.java.com/en/download/help/error_hotspot.xml
hs_err_pid*
Expand Down
Binary file modified RS2-Cache-Library.jar
Binary file not shown.
1 change: 0 additions & 1 deletion src/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
Manifest-Version: 1.0
Main-Class: org.displee.Main

54 changes: 29 additions & 25 deletions src/org/displee/io/Stream.java
Original file line number Diff line number Diff line change
@@ -1,15 +1,14 @@
package org.displee.io;

import java.util.Arrays;

/**
* An extendible class I/O streaming serving as a base for both I/O stream.
* @author Apache Ah64
* A class representing the base for both I/O implementations.
*
* @author Displee
*/
public abstract class Stream {

/**
* THe default capacity.
* The default capacity.
*/
public static final int DEFAULT_CAPACITY = 16;

Expand Down Expand Up @@ -37,21 +36,23 @@ public Stream() {

/**
* Construct a new {@code Stream} {@code Object}.
*
* @param capacity The capacity.
*/
public Stream(int capacity) {
try {
if(capacity < 0|| capacity >= Integer.MAX_VALUE) {
if (capacity < 0 || capacity >= Integer.MAX_VALUE) {
throw new RuntimeException("Illegal capacity");
}
buffer = new byte[capacity];
} catch(Throwable e) {
} catch (Throwable e) {
e.printStackTrace();
}
}

/**
* Construct a new {@code Stream} {@code Object}.
*
* @param bytes The bytes.
*/
public Stream(byte[] bytes) {
Expand All @@ -60,6 +61,7 @@ public Stream(byte[] bytes) {

/**
* Write an integer.
*
* @param i The integer.
*/
public void writeInt(int i) {
Expand All @@ -71,14 +73,16 @@ public void writeInt(int i) {

/**
* Read an integer.
*
* @return The integer.
*/
public int readInt() {
return ((readByte() & 0xFF) << 24) + ((readByte() & 0xFF) << 16) + ((readByte() & 0xFF) << 8) + (readByte() & 0xFF);
return (readUnsignedByte() << 24) + (readUnsignedByte() << 16) + (readUnsignedByte() << 8) + readUnsignedByte();
}

/**
* Read a byte.
*
* @return The byte.
*/
public int readByte() {
Expand All @@ -93,15 +97,6 @@ public int readUnsignedByte() {
return readByte() & 0xFF;
}

public int smf_gvlength() {
int i_20_ = readByte();
int i_21_ = 0;
for (; i_20_ < 0; i_20_ = readByte()) {
i_21_ = (i_21_ | i_20_ & 0x7f) << 7;
}
return i_21_ | i_20_;
}

/**
* Write a byte.
* @param b The byte.
Expand All @@ -120,7 +115,7 @@ public void writeByte(byte b) {

/**
* Write a byte.
* @param b The byte.
* @param b The byte.
* @param index The index.
*/
public void writeByte(byte b, int index) {
Expand All @@ -130,6 +125,7 @@ public void writeByte(byte b, int index) {

/**
* Write a boolean.
*
* @param bool The condition.
*/
public void writeBoolean(boolean bool) {
Expand All @@ -140,7 +136,7 @@ public void writeBoolean(boolean bool) {
* Expend the capacity.
*/
public void expend(int offset) {
if(offset >= buffer.length) {
if (offset >= buffer.length) {
final byte[] newBytes = new byte[offset + DEFAULT_CAPACITY];
System.arraycopy(buffer, 0, newBytes, 0, buffer.length);
buffer = newBytes;
Expand All @@ -149,6 +145,7 @@ public void expend(int offset) {

/**
* Literally clone the entire byte array.
*
* @param bytes The new bytes array.
*/
public void clone(byte[] bytes) {
Expand All @@ -157,15 +154,16 @@ public void clone(byte[] bytes) {

/**
* Clone bytes.
* @param bytes The bytes.
*
* @param bytes The bytes.
* @param offset The offset.
* @param length The length.
*/
public void clone(byte[] bytes, int offset, int length) {
if(bytes.length < length) {
if (bytes.length < length) {
bytes = new byte[length];
}
for(; offset < length; offset++) {
for (; offset < length; offset++) {
bytes[offset] = this.buffer[offset];
}
}
Expand All @@ -180,8 +178,7 @@ public void decodeXTEA(int keys[], int start, int end) {
int sum = 0xc6ef3720;
int delta = 0x9e3779b9;
for (int k2 = 32; k2-- > 0;) {
l1 -= keys[(sum & 0x1c84) >>> 11] + sum ^ (k1 >>> 5 ^ k1 << 4)
+ k1;
l1 -= keys[(sum & 0x1c84) >>> 11] + sum ^ (k1 >>> 5 ^ k1 << 4) + k1;
sum -= delta;
k1 -= (l1 >>> 5 ^ l1 << 4) + l1 ^ keys[sum & 3] + sum;
}
Expand All @@ -206,7 +203,6 @@ public final void encodeXTEA(int keys[], int start, int end) {
sum += delta;
i1 += l + (l >>> 5 ^ l << 4) ^ keys[(0x1eec & sum) >>> 11] + sum;
}

offset -= 8;
writeInt(l);
writeInt(i1);
Expand All @@ -216,6 +212,7 @@ public final void encodeXTEA(int keys[], int start, int end) {

/**
* Get the remaining size available to be read.
*
* @return The remaining size.
*/
public int getRemaining() {
Expand All @@ -231,18 +228,25 @@ public final byte[] getBytes() {

/**
* Get the offset.
*
* @return The offset.
*/
public final int getOffset() {
return offset;
}

/**
* Update the offset by added the argued amount.
*
* @param toIncrease The amount to increase the offset.
*/
public void updateOffset(int toIncrease) {
this.offset += toIncrease;
}

/**
* Set a new offset.
*
* @param offset The offset.
*/
public void setOffset(int offset) {
Expand Down
9 changes: 9 additions & 0 deletions src/org/displee/io/impl/InputStream.java
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,15 @@ public String readString() {
return Miscellaneous.method2122(buffer, i_22_, i_23_);
}

public int smf_gvlength() {
int i_20_ = readByte();
int i_21_ = 0;
for (; i_20_ < 0; i_20_ = readByte()) {
i_21_ = (i_21_ | i_20_ & 0x7f) << 7;
}
return i_21_ | i_20_;
}

/**
* Read the bytes.
* @param bytes The bytes.
Expand Down

0 comments on commit 07e656f

Please sign in to comment.