代码拉取完成,页面将自动刷新
import java.util.Base64;
import java.io.InputStream;
import java.io.ByteArrayInputStream;
import java.io.ObjectInputStream;
import java.io.OptionalDataException;
import java.io.StreamCorruptedException;
import java.util.Arrays;
public class DecodeObject{
public static void main(String args[]) throws Exception{
int skip=0;
int remainder = 0;
String b64 = args[0];
byte[] bytes = Base64.getDecoder().decode(b64);
ByteArrayInputStream bis = new ByteArrayInputStream(bytes);
int origSize = bis.available();
System.out.println("Data Length: "+origSize);
Object o = null;
while(o == null){
try{
bis.reset();
bis.skip(skip);
ObjectInputStream ois = new ObjectInputStream(bis);
o = ois.readObject();
System.out.println("Object found...");
System.out.println(o.getClass().getName());
System.out.println("Bytes skipped: "+skip);
System.out.println("Bytes left: "+bis.available());
skip = origSize - bis.available();
}
catch (StreamCorruptedException ode){
skip = skip+1;
bis.skip(1);
}
catch (OptionalDataException ode){
bis.skip(1);
skip = skip+1;
}
catch (ClassNotFoundException cnf)
{
System.out.println("Object found..."+cnf.getMessage());
System.out.println("Bytes skipped: "+skip);
System.out.println("Bytes left: "+bis.available());
skip = origSize - bis.available();
}
}
}
}
此处可能存在不合适展示的内容,页面不予展示。您可通过相关编辑功能自查并修改。
如您确认内容无涉及 不当用语 / 纯广告导流 / 暴力 / 低俗色情 / 侵权 / 盗版 / 虚假 / 无价值内容或违法国家有关法律法规的内容,可点击提交进行申诉,我们将尽快为您处理。