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> T
decodeInputStream
(InputStream inputStream) Decodes anInputStream
that contains a Base64 encoded String to a JavaObject
.static String
encodeObject
(Object object) Encodes a JavaObject
to a Base64 encoded String.
-
Method Details
-
encodeObject
Encodes a JavaObject
to a Base64 encoded String.- Parameters:
object
- TheObject
to be encoded- Returns:
- The Base64 encoded
String
that represents theObject
- Throws:
IOException
-
decodeInputStream
public static <T> T decodeInputStream(InputStream inputStream) throws IOException, ClassNotFoundException Decodes anInputStream
that contains a Base64 encoded String to a JavaObject
.- Parameters:
inputStream
- TheInputStream
that contains a Base64 encodedString
- Returns:
- The
Object
represented by the Base64 encodedString
- Throws:
IOException
ClassNotFoundException
-