Fixed bug in JSONObjectOutputStream and Base64Encoder

This commit is contained in:
Ziver Koc 2015-11-18 17:25:14 +01:00
parent 034166b413
commit 66bebc6f52
4 changed files with 7 additions and 7 deletions

View file

@ -140,7 +140,7 @@ public class Base64Encoder {
case (byte)(46 & 0xff): return 'u';
case (byte)(47 & 0xff): return 'v';
case (byte)(48 & 0xff): return 'w';
case (byte)(49 & 0xff): return 'w';
case (byte)(49 & 0xff): return 'x';
case (byte)(50 & 0xff): return 'y';
case (byte)(51 & 0xff): return 'z';

View file

@ -137,7 +137,7 @@ public class JSONObjectInputStream extends InputStream implements ObjectInput, C
return readPrimitive(type, json);
}
else if(type.isArray()){
if(type.getComponentType() == Byte.class)
if(type.getComponentType() == byte.class)
return Base64Decoder.decodeToByte(json.getString());
else{
Object array = Array.newInstance(type.getComponentType(), json.size());

View file

@ -88,7 +88,7 @@ public class JSONObjectOutputStream extends OutputStream implements ObjectOutput
// Add an array
else if(objClass.isArray()){
// Special case for byte arrays
if(objClass.getComponentType() == byte[].class) {
if(objClass.getComponentType() == byte.class) {
root = new DataNode(DataType.String);
root.set(Base64Encoder.encode((byte[])obj));
}