public class SourceData extends java.lang.Object implements Serializator
Modifier and Type | Field and Description |
---|---|
private java.lang.String |
fileName
The file name if such source was created.
|
private BaseDataType |
origSrc
Local reference to stream (or stream name), as configured in constructor.
|
private java.lang.String |
origType
Local copy of the stream type configured in constructor.
|
static java.lang.String |
SD_READ_JSON
Constant used to identify the calls from READ-JSON method.
|
static java.lang.String |
SD_READ_XML
Constant used to identify the calls from READ-XML method.
|
static java.lang.String |
SD_READ_XMLSCHEMA
Constant used to identify the calls from READ-XMLSCHEMA method.
|
private java.io.InputStream |
stream
Normalized input stream
|
private static java.util.Map<java.lang.String,java.lang.Integer> |
supportedStreams |
SER_FILE, SER_HANDLE, SER_JSON_ARRAY, SER_JSON_OBJECT, SER_LONGCHAR, SER_MEMPTR, SER_STREAM, SER_STREAM_HANDLE, TYPE_FILE, TYPE_HANDLE, TYPE_JSON_ARRAY, TYPE_JSON_OBJECT, TYPE_LONGCHAR, TYPE_MEMPTR, TYPE_STREAM, TYPE_STREAM_HANDLE
Constructor and Description |
---|
SourceData(character type,
BaseDataType source)
The constructor saves the configured parameters but does not process them in any way.
|
SourceData(java.lang.String type,
BaseDataType source)
The constructor saves the configured parameters but does not process them in any way.
|
SourceData(java.lang.String type,
java.lang.String source)
The constructor saves the configured parameters but does not process them in any way.
|
Modifier and Type | Method and Description |
---|---|
void |
close()
Close the input stream underlying this data source.
|
boolean |
configureSupportedSources(java.lang.String method,
java.lang.String widgetType)
Configures the resource stream types for the current usage.
|
java.lang.String |
getFileName()
Obtain the file name of the source, if one was used to create the source.
|
BaseDataType |
getSource()
Obtain the original source.
|
java.io.InputStream |
getStream()
Get the input stream representing the source resource from which data will be read.
|
java.lang.String |
getType()
Obtain the type of source this objects wraps.
|
private java.io.InputStream stream
private java.lang.String fileName
public static final java.lang.String SD_READ_XML
public static final java.lang.String SD_READ_XMLSCHEMA
public static final java.lang.String SD_READ_JSON
private static final java.util.Map<java.lang.String,java.lang.Integer> supportedStreams
private final java.lang.String origType
private final BaseDataType origSrc
public SourceData(character type, BaseDataType source)
type
- The source stream type.source
- The reference to resource or the file name.public SourceData(java.lang.String type, BaseDataType source)
type
- The source stream type.source
- The reference to resource or the file name.public SourceData(java.lang.String type, java.lang.String source)
type
- The source stream type.source
- The file name.public boolean configureSupportedSources(java.lang.String method, java.lang.String widgetType)
method
- The identifier for the method using the source stream. It is used to get the set of acceptable
stream types to check against them.widgetType
- The parent widget. Only used for composing the error messages.true
if the parameters configured in constructor seems correct. This method does not
check the content, only the variable types. If there is not a match with the possible streams
supported by the method
, false
is returned, after eventually raising a specific
error condition.public java.io.InputStream getStream() throws java.io.IOException
getStream
in interface Serializator
java.io.IOException
- if the method encounters issues with the resource.public void close() throws java.io.IOException
close
in interface java.io.Closeable
close
in interface java.lang.AutoCloseable
java.io.IOException
- if there is an error closing the stream.public java.lang.String getFileName()
null
.public BaseDataType getSource()
public java.lang.String getType()