Package org.apache.juneau.swaps
Class InputStreamSwap
- Direct Known Subclasses:
InputStreamSwap.Base64,InputStreamSwap.Hex,InputStreamSwap.SpacedHex
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic classConvertsInputStreamsto BASE-64 encoding.static classConvertsInputStreamsto hex encoding.static classConvertsInputStreamsto spaced-hex encoding. -
Field Summary
Fields inherited from class org.apache.juneau.swap.ObjectSwap
NULL -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionprotected byte[]toBytes(InputStream is) Convert the specified input stream to a byte array.protected InputStreamConvert the specified byte array into an input stream.Methods inherited from class org.apache.juneau.swap.StringSwap
swap, unswapMethods inherited from class org.apache.juneau.swap.ObjectSwap
forMediaTypes, forMediaTypes, getNormalClass, getSwapClass, getSwapClassMeta, isNormalObject, isSwappedObject, match, swap, toString, unswap, withTemplate, withTemplate
-
Constructor Details
-
InputStreamSwap
public InputStreamSwap()
-
-
Method Details
-
toBytes
Convert the specified input stream to a byte array.- Parameters:
is- The input stream to convert to bytes.
Can benull .
The stream is automatically closed.- Returns:
- The byte array.
- Throws:
IOException- Thrown by input stream.
-
toStream
Convert the specified byte array into an input stream.- Parameters:
b- The byte array.hint- Contains a hint about what subtype is being requested.- Returns:
- The byte array.
-