public final class StreamUtil extends Object
IInputStream
and IOutputStream
.
Most importantly, the methods here are used for conversions:
Modifier and Type | Method and Description |
---|---|
static InputStream |
castStream(IInputStream in)
Casts an
IInputStream as InputStream , if possible; or
converts it by instantiating a new bridge instance, if a simple Java cast is not possible. |
static IInputStream |
castStream(InputStream in)
Casts an
InputStream as IInputStream , if possible; or
converts it by instantiating a new bridge instance, if a simple Java cast is not possible. |
static OutputStream |
castStream(IOutputStream out)
Casts an
IOutputStream as OutputStream , if possible; or
converts it by instantiating a new bridge instance, if a simple Java cast is not possible. |
static IOutputStream |
castStream(OutputStream out)
Casts an
OutputStream as IOutputStream , if possible; or
converts it by instantiating a new bridge instance, if a simple Java cast is not possible. |
public static IInputStream castStream(InputStream in)
InputStream
as IInputStream
, if possible; or
converts it by instantiating a new bridge instance, if a simple Java cast is not possible.
Note that the bridge object (if its instantiation was needed) both subclasses InputStream
and implements IInputStream
. Thus subsequent castStream(...)
invocations on
the result object always are simple Java casts.
in
- the InputStream
to be converted (by Java cast or bridge object). May be null
.in
, if a simple Java cast was possible; or a new
bridge object implementing the desired interface and delegating to the underlying object.
May be null
(only if the input argument is null
).public static InputStream castStream(IInputStream in)
IInputStream
as InputStream
, if possible; or
converts it by instantiating a new bridge instance, if a simple Java cast is not possible.
Note that the bridge object (if its instantiation was needed) both subclasses InputStream
and implements IInputStream
. Thus subsequent castStream(...)
invocations on
the result object always are simple Java casts.
in
- the IInputStream
to be converted (by Java cast or bridge object). May be null
.in
, if a simple Java cast was possible; or a new
bridge object extending InputStream
and delegating to the underlying object.
May be null
(only if the input argument is null
).public static IOutputStream castStream(OutputStream out)
OutputStream
as IOutputStream
, if possible; or
converts it by instantiating a new bridge instance, if a simple Java cast is not possible.
Note that the bridge object (if its instantiation was needed) both subclasses OutputStream
and implements IOutputStream
. Thus subsequent castStream(...)
invocations on
the result object always are simple Java casts.
out
- the OutputStream
to be converted (by Java cast or bridge object). May be null
.out
, if a simple Java cast was possible; or a new
bridge object implementing the desired interface and delegating to the underlying object.
May be null
(only if the input argument is null
).public static OutputStream castStream(IOutputStream out)
IOutputStream
as OutputStream
, if possible; or
converts it by instantiating a new bridge instance, if a simple Java cast is not possible.
Note that the bridge object (if its instantiation was needed) both subclasses OutputStream
and implements IOutputStream
. Thus subsequent castStream(...)
invocations on
the result object always are simple Java casts.
out
- the IOutputStream
to be converted (by Java cast or bridge object). May be null
.out
, if a simple Java cast was possible; or a new
bridge object extending OutputStream
and delegating to the underlying object.
May be null
(only if the input argument is null
).Copyright © 2013–2019. All rights reserved.