function printClass(c){
var str = "-------------------------------\n";
str += "|" + JSON.stringify(c) + "\n";
var fields = c.getClass().getFields();
for(var index in fields){
var field = fields[index];
var fieldName = "";
var value = "";
try{
fieldName = field.getName();
value = field.get(c);
}catch(e){
}
if(fieldName == ""){
continue;
}
str += "|" + fieldName + ":" + printValue(value) + "\n";
}
str += "------------------------------\n\n\n";
return str;
}
function printValue(value){
try{
var newValue = Java.cast(value, Java.use("java.lang.Object"))
switch(newValue.getClass().getName()){
case "[B":
return printBytes(value)
}
return value;
}catch(e){
return value;
}
}
function printBytes(result){
try{
var ByteArrayOutputStreamClass = Java.use("java.io.ByteArrayOutputStream");
var out = ByteArrayOutputStreamClass.$new()
var ObjectOutputStreamClass = Java.use("java.io.ObjectOutputStream");
var sOut = ObjectOutputStreamClass.$new(out);
sOut.writeObject(result);
sOut.flush();
var bytes = out.toByteArray();
var argsArray = [];
for(var i = 0; i < bytes.length; i++) {
argsArray.push(bytes[i]);
}
return "["+argsArray.join(",")+"]";
}catch(e){
console.log(e);
return result;
}
}