public abstract class AbstractDataSource
extends java.lang.Object
implements javax.activation.DataSource
getOutputStream()
method.
Modifier and Type | Field and Description |
---|---|
protected int |
action
The load action of the resource
FILE_OPEN , ... |
static int |
ACTION_FILE_EDIT
Represents editing a local file.
|
static int |
ACTION_FILE_HEXEDIT
Represents editing a local file.
|
static int |
ACTION_FILE_OPEN
Represents opening a local file.
|
static int |
ACTION_UNKNOWN
Represents not available.
|
static int |
ACTION_URL_EDIT
Represents editing a network file.
|
static int |
ACTION_URL_HEXEDIT
Represents editing a network file.
|
static int |
ACTION_URL_OPEN
Represents opening a network file.
|
protected java.util.Date |
date
The date and time of the represented data portion.
|
protected java.lang.String |
encoding
The character set of the represented data portion.
|
protected OrderedHashtable<java.lang.String,java.lang.String> |
formatProps
The format specific properties presented by the
AbstractViewer class. |
protected java.lang.String |
name
The name of the represented data portion.
|
protected java.lang.String |
path
The path of the represented data portion.
|
protected long |
size
The size of the represented data portion.
|
protected java.lang.String |
type
The MIME type (default is "application/octet-stream").
|
Constructor and Description |
---|
AbstractDataSource()
Constructor method for i18n purposes only.
|
Modifier and Type | Method and Description |
---|---|
void |
configureUnit(java.lang.String id,
Configuration config)
Restores values from persistent data stores.
|
protected void |
finalize()
Clean-up method to help the gc.
|
abstract void |
finish(java.io.OutputStream ostream)
After the data has been written to the output stream it is flushed, closed and updated here.
|
int |
getAction()
Provides the load action of the resource
FILE_OPEN , ... |
java.lang.String |
getContentType()
This method returns the MIME type of the data in the form of a string.
|
java.util.Date |
getDate()
Provides the date and time for this data source.
|
java.lang.String |
getDisplayAction(java.lang.String fallback)
Provides the load action of the resource to be displayed.
|
java.lang.String |
getEncoding()
Provides the encoding of this data source.
|
OrderedHashtable<java.lang.String,java.lang.String> |
getFormatProperties()
Provides the format specific properties presented by the
AbstractViewer class. |
abstract javax.swing.Icon |
getIcon()
Provides the data source specific icon (optional).
|
abstract java.io.InputStream |
getInputStream()
This method returns an
InputStream representing the data and throws the
appropriate exception if it can not do so. |
java.lang.String |
getName()
Return the name of this object where the name of the object is dependant on the nature
of the underlying objects.
|
abstract 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. |
java.lang.String |
getPath()
Provides the path for this data source.
|
long |
getSize()
Provides the size for this data source in bytes.
|
void |
loadTemporaryFile(java.lang.String id,
Configuration config,
ApplicationModel model)
Restores values from persistent data stores.
|
void |
setAction(int action)
Setter for the the load action of the resource
FILE_OPEN , ... |
void |
setContentType(java.lang.String type)
Setter for the MIME content type.
|
void |
setDate(java.util.Date date)
Setter for the date.
|
void |
setEncoding(java.lang.String encoding)
Setter for the encoding of this data source.
|
protected void |
setFormatProperty(java.lang.String prop,
java.lang.String value)
Add another format specific property to provide for this data source.
|
void |
setName(java.lang.String name)
Setter for the name.
|
void |
setPath(java.lang.String path)
Setter for the path.
|
void |
setSize(long size)
Setter for the size.
|
void |
storeTemporaryFile(java.lang.String id,
Configuration config,
ApplicationModel model)
Stores the current configuration values persistently.
|
void |
storeUnit(java.lang.String id,
Configuration config)
Stores the current configuration values persistently.
|
public static final int ACTION_UNKNOWN
public static final int ACTION_FILE_OPEN
public static final int ACTION_FILE_EDIT
public static final int ACTION_FILE_HEXEDIT
public static final int ACTION_URL_OPEN
public static final int ACTION_URL_EDIT
public static final int ACTION_URL_HEXEDIT
protected java.lang.String name
protected java.lang.String path
protected long size
protected java.util.Date date
protected java.lang.String type
protected java.lang.String encoding
protected int action
FILE_OPEN
, ...protected OrderedHashtable<java.lang.String,java.lang.String> formatProps
AbstractViewer
class.public AbstractDataSource()
protected void finalize() throws java.lang.Throwable
finalize
in class java.lang.Object
java.lang.Throwable
public java.lang.String getName()
getName
in interface javax.activation.DataSource
public java.lang.String getPath()
public long getSize()
public java.util.Date getDate()
public java.lang.String getContentType()
DataSource
implementation can not determine the data type.
getContentType
in interface javax.activation.DataSource
public java.lang.String getEncoding()
null
public int getAction()
FILE_OPEN
, ...
public java.lang.String getDisplayAction(java.lang.String fallback)
fallback
- The defaultpublic void setName(java.lang.String name)
name
- The name of the objectpublic void setPath(java.lang.String path)
path
- The path of the objectpublic void setSize(long size)
size
- The size of the objectpublic void setDate(java.util.Date date)
date
- The date of the objectpublic void setContentType(java.lang.String type)
type
- The type of the objectpublic void setEncoding(java.lang.String encoding)
encoding
- The encoding, may be null
public void setAction(int action)
FILE_OPEN
, ...
action
- The action, -1 if unknownpublic abstract 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
java.io.IOException
- If an error occurredjava.lang.NullPointerException
- If the loaded content is null
public abstract 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
java.io.IOException
- If an error occurredpublic abstract void finish(java.io.OutputStream ostream) throws java.io.IOException
ostream
- An output streamjava.io.IOException
- If an error occurredprotected void setFormatProperty(java.lang.String prop, java.lang.String value)
prop
- The propertyvalue
- The valuejava.lang.NullPointerException
- If a parameter is null
public OrderedHashtable<java.lang.String,java.lang.String> getFormatProperties()
AbstractViewer
class.
public abstract javax.swing.Icon getIcon()
null
public void configureUnit(java.lang.String id, Configuration config)
id
- The unique identifier for the instanceconfig
- The configurationpublic void storeUnit(java.lang.String id, Configuration config)
id
- The unique identifier for the instanceconfig
- The configurationpublic void loadTemporaryFile(java.lang.String id, Configuration config, ApplicationModel model)
id
- The unique identifier for the instanceconfig
- The configurationmodel
- The application modelpublic void storeTemporaryFile(java.lang.String id, Configuration config, ApplicationModel model)
id
- The unique identifier for the instanceconfig
- The configurationmodel
- The application modelCopyright © 2005-2013 Leisenfels UG (haftungsbeschränkt). All rights reserved.