public class TextDataSource extends AbstractDataSource implements ConfigurableUnit
Modifier and Type | Field and Description |
---|---|
protected java.util.Locale |
locale639_1
The locale like "en_US".
|
protected Locale |
locale639_2
The locale like "ger_DE".
|
protected ApplicationModel |
model
The application model.
|
static java.lang.String |
PROP_LOCALE_639_1
Represents a format specific property (java.util.Locale).
|
static java.lang.String |
PROP_LOCALE_639_2
Represents a format specific property (com.lf.commons.i18n.Locale).
|
protected char[] |
textdata
The managed content.
|
action, ACTION_FILE_EDIT, ACTION_FILE_HEXEDIT, ACTION_FILE_OPEN, ACTION_UNKNOWN, ACTION_URL_EDIT, ACTION_URL_HEXEDIT, ACTION_URL_OPEN, date, encoding, formatProps, name, path, size, type
Constructor and Description |
---|
TextDataSource()
Constructor method for i18n purposes only.
|
TextDataSource(java.lang.String name,
java.lang.String path,
java.util.Date date,
java.lang.String type,
char[] textdata,
java.lang.String encoding,
java.util.Locale locale_639_1,
Locale locale_639_2,
int action)
Init functionality.
|
TextDataSource(java.lang.String name,
java.lang.String path,
java.util.Date date,
java.lang.String type,
java.io.File textfile,
java.lang.String encoding,
java.util.Locale locale_639_1,
Locale locale_639_2,
int action)
Init functionality.
|
Modifier and Type | Method and Description |
---|---|
void |
configureUnit(java.lang.String id,
Configuration config)
Restores values from persistent data stores.
|
void |
finish(java.io.OutputStream ostream)
After the data has been written to the output stream it is flushed, closed and updated here.
|
java.lang.String |
getDisplayName()
Provides the data source display name.
|
OrderedHashtable<java.lang.String,java.lang.String> |
getFormatProperties()
Provides the format specific properties presented by the
AbstractViewer class. |
javax.swing.Icon |
getIcon()
Provides the data source specific icon (optional).
|
java.io.InputStream |
getInputStream()
This method returns an
InputStream representing the data and throws the
appropriate exception if it can not do so. |
java.io.OutputStream |
getOutputStream()
This method returns an
OutputStream where the data can be written and throws
the appropriate exception if it can not do so
Note that a new OutputStream object must be returned each time this method
is called, and the stream must be positioned at the location the data is to be written. |
char[] |
getTextData()
Provides an array with text data.
|
void |
storeUnit(java.lang.String id,
Configuration config)
Stores the current configuration values persistently.
|
void |
unitRegistered(ApplicationModel model,
java.lang.String id)
Informs the configurable unit that it was registered with a model.
|
void |
unitUnregistered(ApplicationModel model,
java.lang.String id)
Informs the configurable unit that it was unregistered with a model.
|
finalize, getAction, getContentType, getDate, getDisplayAction, getEncoding, getName, getPath, getSize, loadTemporaryFile, setAction, setContentType, setDate, setEncoding, setFormatProperty, setName, setPath, setSize, storeTemporaryFile
public static final java.lang.String PROP_LOCALE_639_1
public static final java.lang.String PROP_LOCALE_639_2
protected char[] textdata
protected java.util.Locale locale639_1
protected Locale locale639_2
protected ApplicationModel model
public TextDataSource()
public TextDataSource(java.lang.String name, java.lang.String path, java.util.Date date, java.lang.String type, char[] textdata, java.lang.String encoding, java.util.Locale locale_639_1, Locale locale_639_2, int action)
name
- The name of the represented data portion (optional)path
- The path of this object (optional)date
- The date of this object (optional)type
- The MIME type (default is "text/plain", optional)textdata
- The managed contentencoding
- The encoding (optional)locale_639_1
- The locale like "en_US" (optional)locale_639_2
- The locale like "ger_DE" (optional)action
- The load action AbstractDataSource.FILE_OPEN
, ...java.lang.NullPointerException
- If a parameter is null
public TextDataSource(java.lang.String name, java.lang.String path, java.util.Date date, java.lang.String type, java.io.File textfile, java.lang.String encoding, java.util.Locale locale_639_1, Locale locale_639_2, int action)
name
- The name of the represented data portion (optional)path
- The path of this object (optional)date
- The date of this object (optional)type
- The MIME type (default is "text/plain", optional)textfile
- The managed content, loaded hereencoding
- The encoding (optional)locale_639_1
- The locale like "en_US" (optional)locale_639_2
- The locale like "ger_DE" (optional)action
- The load action AbstractDataSource.FILE_OPEN
, ...java.lang.NullPointerException
- If a parameter is null
public java.io.InputStream getInputStream() throws java.io.IOException
InputStream
representing the data and throws the
appropriate exception if it can not do so.
Note that a new InputStream
object must be returned each time this method
is called, and the stream must be positioned at the beginning of the data.
getInputStream
in interface javax.activation.DataSource
getInputStream
in class AbstractDataSource
java.io.IOException
- If an error occurredjava.lang.NullPointerException
- If the loaded content is null
public java.io.OutputStream getOutputStream() throws java.io.IOException
OutputStream
where the data can be written and throws
the appropriate exception if it can not do so
Note that a new OutputStream
object must be returned each time this method
is called, and the stream must be positioned at the location the data is to be written.
getOutputStream
in interface javax.activation.DataSource
getOutputStream
in class AbstractDataSource
java.io.IOException
- If an error occurredpublic void finish(java.io.OutputStream ostream) throws java.io.IOException
finish
in class AbstractDataSource
ostream
- An output streamjava.io.IOException
- If an error occurredpublic OrderedHashtable<java.lang.String,java.lang.String> getFormatProperties()
AbstractViewer
class.
getFormatProperties
in class AbstractDataSource
null
or emptypublic char[] getTextData()
null
public javax.swing.Icon getIcon()
getIcon
in class AbstractDataSource
null
public void configureUnit(java.lang.String id, Configuration config)
configureUnit
in interface ConfigurableUnit
configureUnit
in class AbstractDataSource
id
- The unique identifier for the instanceconfig
- The configurationpublic void storeUnit(java.lang.String id, Configuration config)
storeUnit
in interface ConfigurableUnit
storeUnit
in class AbstractDataSource
id
- The unique identifier for the instanceconfig
- The configurationpublic void unitRegistered(ApplicationModel model, java.lang.String id)
unitRegistered
in interface ConfigurableUnit
model
- The application modelid
- The unique identifier for the instancepublic void unitUnregistered(ApplicationModel model, java.lang.String id)
unitUnregistered
in interface ConfigurableUnit
model
- The application modelid
- The unique identifier for the instancepublic java.lang.String getDisplayName()
getDisplayName
in class AbstractDataSource
null
Copyright © 2005-2023 Leisenfels GmbH. All rights reserved.