Package org.rribbit.util
Class Base64Util
java.lang.Object
org.rribbit.util.Base64Util
This class provides utility methods for Base64 encoding. It is used by the
HttpRequestDispatcher and HttpRequestProcessorServlet, but feel free to use it yourself.- Author:
- G.J. Schouten
-
Method Summary
Modifier and TypeMethodDescriptionstatic <T> TdecodeInputStream(InputStream inputStream) Decodes anInputStreamthat contains a Base64 encoded String to a JavaObject.static StringencodeObject(Object object) Encodes a JavaObjectto a Base64 encoded String.
-
Method Details
-
encodeObject
Encodes a JavaObjectto a Base64 encoded String.- Parameters:
object- TheObjectto be encoded- Returns:
- The Base64 encoded
Stringthat represents theObject - Throws:
IOException
-
decodeInputStream
public static <T> T decodeInputStream(InputStream inputStream) throws IOException, ClassNotFoundException Decodes anInputStreamthat contains a Base64 encoded String to a JavaObject.- Parameters:
inputStream- TheInputStreamthat contains a Base64 encodedString- Returns:
- The
Objectrepresented by the Base64 encodedString - Throws:
IOExceptionClassNotFoundException
-