Fixed bug in JSONObjectOutputStream and Base64Encoder
This commit is contained in:
parent
034166b413
commit
66bebc6f52
4 changed files with 7 additions and 7 deletions
|
|
@ -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';
|
||||
|
||||
|
|
|
|||
|
|
@ -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());
|
||||
|
|
|
|||
|
|
@ -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));
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue