public static interface DataSource.Opener
Modifier and Type | Method and Description |
---|---|
Reader |
openReaderOnce()
Open a characters stream reader once.
|
InputStream |
openStreamOnce()
Open a bytes stream once.
|
boolean |
rawDataIsBinary()
Check if the raw data is binary.
|
boolean rawDataIsBinary()
The raw data may be either binary or characters. In both cases,
either openStreamOnce()
or openReaderOnce()
may
be called, but one will be more efficient than the other as one
will supply data as is and the other one will convert raw data
before providing it. If conversion is needed, it will also be done
using UTF8 encoding
, which may not
be suitable. This method helps the data consumer to either choose
the more efficient method or avoid wrong encoding conversion.
InputStream openStreamOnce() throws IOException
Beware that this interface is only intended for lazy opening a
stream, i.e. to delay this opening (or not open the stream at all).
It is not intended to open the stream several times and not
intended to open both the binary stream
and
the characters stream
separately (but opening
the reader may be implemented by opening the binary stream or vice-versa).
Implementations may fail if an attempt to open a stream several times is
made. This is particularly true for network-based streams.
IOException
- if stream cannot be openedReader openReaderOnce() throws IOException
Beware that this interface is only intended for lazy opening a
stream, i.e. to delay this opening (or not open the stream at all).
It is not intended to open the stream several times and not
intended to open both the binary stream
and
the characters stream
separately (but opening
the reader may be implemented by opening the binary stream or vice-versa).
Implementations may fail if an attempt to open a stream several times is
made. This is particularly true for network-based streams.
IOException
- if stream cannot be openedCopyright © 2002-2022 CS GROUP. All rights reserved.