privatestatic String toBase64Encode(Serializable o)
{
ByteArrayOutputStream baos = new ByteArrayOutputStream();
ObjectOutputStream oos;
try
{
oos = new ObjectOutputStream( baos );
oos.writeObject( o );
oos.close();
}
catch (IOException e)
e.printStackTrace();
returnnew String(Base64.encodeBytes(baos.toByteArray()));
}
privatestatic Object toBase64Decode(String s)
{
byte [] data = Base64.decode(s);
ObjectInputStream ois;
try
{
ois = new ObjectInputStream(new ByteArrayInputStream(data));
Object o = ois.readObject();
ois.close();
return o;
}
catch (IOException e)
e.printStackTrace();
catch (ClassNotFoundException e)
e.printStackTrace();
returnnull;
}
Saturday, December 4, 2010
Base64 – Encode and Decode JAVA Functions
Find information on Wikipedia about Base64
Subscribe to:
Post Comments (Atom)
Integration of SQLite3 and Netbeans C/C++ IDE
Few days back, I wanted to use SQLite database for one of my project. I spend couple of hours to find a way to integrate with Netbeans. Mayb...
-
Few days back, I wanted to use SQLite database for one of my project. I spend couple of hours to find a way to integrate with Netbeans. Mayb...
-
Note: I am using LINUX with following specifications, g++ (Ubuntu/Linaro 4.6.1-9ubuntu3) 4.6.1. SESC: Cycle Accurate Architectural Simula...
-
Introduction: While studying one of the most important thing which is required is Internet, and when university configures new settings or p...
good
ReplyDeleteIncredible! :)
ReplyDelete