Package org.apache.juneau.swaps
Class InputStreamSwap
- Direct Known Subclasses:
InputStreamSwap.Base64
,InputStreamSwap.Hex
,InputStreamSwap.SpacedHex
-
Nested Class Summary
Modifier and TypeClassDescriptionstatic class
ConvertsInputStreams
to BASE-64 encoding.static class
ConvertsInputStreams
to hex encoding.static class
ConvertsInputStreams
to spaced-hex encoding. -
Field Summary
Fields inherited from class org.apache.juneau.swap.ObjectSwap
NULL
-
Constructor Summary
-
Method Summary
Modifier and TypeMethodDescriptionprotected byte[]
toBytes
(InputStream is) Convert the specified input stream to a byte array.protected InputStream
Convert the specified byte array into an input stream.Methods inherited from class org.apache.juneau.swap.StringSwap
swap, unswap
Methods 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.
-