160 lines
4.4 KiB
Java
160 lines
4.4 KiB
Java
/*
|
|
* Decompiled with CFR 0.152.
|
|
*
|
|
* Could not load the following classes:
|
|
* javax.baja.nre.util.Base64
|
|
*/
|
|
package javax.baja.sys;
|
|
|
|
import java.io.DataInput;
|
|
import java.io.DataOutput;
|
|
import java.io.IOException;
|
|
import javax.baja.nre.util.Base64;
|
|
import javax.baja.sys.BObject;
|
|
import javax.baja.sys.BSimple;
|
|
import javax.baja.sys.Sys;
|
|
import javax.baja.sys.Type;
|
|
|
|
/*
|
|
* Illegal identifiers - consider using --renameillegalidents true
|
|
*/
|
|
public final class BBlob
|
|
extends BSimple {
|
|
public static final BBlob DEFAULT = new BBlob(new byte[0]);
|
|
public static final Type TYPE;
|
|
byte[] value;
|
|
int hashCode;
|
|
static /* synthetic */ Class class$javax$baja$sys$BBlob;
|
|
|
|
public static final BBlob make(byte[] byArray) {
|
|
return BBlob.make(byArray, 0, byArray.length);
|
|
}
|
|
|
|
public static final BBlob make(byte[] byArray, int n, int n2) {
|
|
if (n2 == 0) {
|
|
return DEFAULT;
|
|
}
|
|
byte[] byArray2 = new byte[n2];
|
|
System.arraycopy(byArray, n, byArray2, 0, n2);
|
|
return new BBlob(byArray2);
|
|
}
|
|
|
|
public final int length() {
|
|
return this.value.length;
|
|
}
|
|
|
|
public final byte byteAt(int n) {
|
|
return this.value[n];
|
|
}
|
|
|
|
public final void copy(byte[] byArray) {
|
|
System.arraycopy(this.value, 0, byArray, 0, this.value.length);
|
|
}
|
|
|
|
public final void copyBytes(int n, byte[] byArray, int n2, int n3) {
|
|
System.arraycopy(this.value, n, byArray, n2, n3);
|
|
}
|
|
|
|
public final byte[] copyBytes() {
|
|
byte[] byArray = new byte[this.value.length];
|
|
System.arraycopy(this.value, 0, byArray, 0, byArray.length);
|
|
return byArray;
|
|
}
|
|
|
|
public final int hashCode() {
|
|
if (this.hashCode == 0) {
|
|
int n = 31;
|
|
byte[] byArray = this.value;
|
|
int n2 = 0;
|
|
while (n2 < byArray.length) {
|
|
n = 31 * n + byArray[n2];
|
|
++n2;
|
|
}
|
|
this.hashCode = n;
|
|
}
|
|
return this.hashCode;
|
|
}
|
|
|
|
public final boolean equals(Object object) {
|
|
if (object instanceof BBlob) {
|
|
byte[] byArray = this.value;
|
|
byte[] byArray2 = ((BBlob)object).value;
|
|
if (byArray.length != byArray2.length) {
|
|
return false;
|
|
}
|
|
int n = 0;
|
|
while (n < byArray.length) {
|
|
if (byArray[n] != byArray2[n]) {
|
|
return false;
|
|
}
|
|
++n;
|
|
}
|
|
return true;
|
|
}
|
|
return false;
|
|
}
|
|
|
|
public final void encode(DataOutput dataOutput) throws IOException {
|
|
dataOutput.writeInt(45323);
|
|
dataOutput.writeInt(this.value.length);
|
|
dataOutput.write(this.value, 0, this.value.length);
|
|
}
|
|
|
|
public final BObject decode(DataInput dataInput) throws IOException {
|
|
int n = dataInput.readInt();
|
|
if (n != 45323) {
|
|
throw new IOException("Invalid BBlob magic number 0x" + Integer.toHexString(n));
|
|
}
|
|
int n2 = dataInput.readInt();
|
|
if (n2 == 0) {
|
|
return DEFAULT;
|
|
}
|
|
try {
|
|
byte[] byArray = new byte[n2];
|
|
dataInput.readFully(byArray, 0, n2);
|
|
return new BBlob(byArray);
|
|
}
|
|
catch (OutOfMemoryError outOfMemoryError) {
|
|
throw new IOException("Invalid byte array length: " + n2);
|
|
}
|
|
}
|
|
|
|
public final String encodeToString() throws IOException {
|
|
return Base64.encode((byte[])this.value);
|
|
}
|
|
|
|
public final BObject decodeFromString(String string) throws IOException {
|
|
return new BBlob(Base64.decode((String)string));
|
|
}
|
|
|
|
public final Type getType() {
|
|
return TYPE;
|
|
}
|
|
|
|
static /* synthetic */ Class class(String string, boolean bl) {
|
|
try {
|
|
Class<?> clazz = Class.forName(string);
|
|
if (!bl) {
|
|
clazz = clazz.getComponentType();
|
|
}
|
|
return clazz;
|
|
}
|
|
catch (ClassNotFoundException classNotFoundException) {
|
|
throw new NoClassDefFoundError(classNotFoundException.getMessage());
|
|
}
|
|
}
|
|
|
|
private BBlob(byte[] byArray) {
|
|
this.value = byArray;
|
|
}
|
|
|
|
static {
|
|
Class clazz = class$javax$baja$sys$BBlob;
|
|
if (clazz == null) {
|
|
clazz = class$javax$baja$sys$BBlob = BBlob.class("[Ljavax.baja.sys.BBlob;", false);
|
|
}
|
|
TYPE = Sys.loadType(clazz);
|
|
}
|
|
}
|
|
|