我一直在試圖做一個對象序列化和Base64編碼的結果。它適用於Sun的lib:如何使用org.apache.commons.codec.binary.base64對Base64進行編碼?
Bean01 bean01 = new Bean01();
bean01.setDefaultValues();
ByteArrayOutputStream baos = new ByteArrayOutputStream();
new ObjectOutputStream(baos).writeObject(bean01);
System.out.println(Base64.encode(baos.toByteArray()));
這工作正常。不過,我想這樣做使用org.apache.commons.codec.binary.base64相同,但這並不返回相同的字符串:
System.out.println(org.apache.commons.codec.binary.Base64.encodeBase64(baos.toByteArray()));
什麼是實現正確的正確方法使用Apache的編碼器對byteArray進行Base64編碼?
哪'Base64'類中的「太陽的lib」你在你的第一個例子中使用? – QuantumMechanic
com.sun.org.apache.xerces.internal.impl.dv.util.Base64 –