public class ByteArrayDataSource extends DataSource
DEFAULT_INTRO_LIMIT, MARK_WORKAROUND_PROPERTY
Constructor and Description |
---|
ByteArrayDataSource(java.lang.String name,
byte[] buffer)
Constructor.
|
Modifier and Type | Method and Description |
---|---|
java.lang.String |
getName()
Returns a name for this source.
|
java.io.InputStream |
getRawInputStream()
Provides a new InputStream for this data source.
|
long |
getRawLength()
Returns the length in bytes of the stream returned by
getRawInputStream , if known. |
close, forceCompression, getCompression, getHybridInputStream, getInputStream, getInputStream, getIntro, getIntroLimit, getLength, getMarkWorkaround, getPosition, getSystemId, getURL, makeDataSource, makeDataSource, makeDataSource, setCompression, setIntroLimit, setMarkWorkaround, setName, setPosition, toString
public ByteArrayDataSource(java.lang.String name, byte[] buffer)
name
- data source namebuffer
- containing byte content of the sourcepublic java.lang.String getName()
DataSource
DataSource.getURL()
method
(or some suitable class-specific method) should be used.
If this source has a position, it should probably form part of
this name.getName
in class DataSource
public java.io.InputStream getRawInputStream()
DataSource
getRawInputStream
in class DataSource
public long getRawLength()
DataSource
getRawInputStream
, if known. If the length is not known
then -1 should be returned.
The implementation of this method in DataSource
returns -1;
subclasses should override it if they can determine their length.getRawLength
in class DataSource