net.wimpi.pim.contact.basicimpl
Class DataContainer

java.lang.Object
  |
  +--net.wimpi.pim.contact.basicimpl.DataContainer
All Implemented Interfaces:
Image, Key, java.io.Serializable, Sound

public class DataContainer
extends java.lang.Object
implements Key, Sound, Image

A basic, simple and generic implementation of Key, Sound and Image.

Version:
0.1 (22/07/2003)
Author:
Dieter Wimberger
See Also:
Serialized Form

Field Summary
protected  java.lang.String m_ContentType
           
protected  byte[] m_Data
           
protected  boolean m_isUri
           
protected  java.lang.String m_Uri
           
 
Constructor Summary
DataContainer()
           
 
Method Summary
 java.lang.String getContentType()
          Returns the content type of this Key.
 byte[] getData()
          Returns the non-encoded binary data representing this Key.
 byte[] getDataFromURI()
          Returns the data obtained from the uri of this Key.
 java.io.InputStream getInputStream()
          Returns an InputStream providing access to the data of this Key.
 java.lang.String getURI()
          Returns the URI reference representing this Key.
 boolean isData()
          Tests if this Key is given as binary data.
 boolean isURI()
          Tests if this Key is given as an URI reference.
 void setContentType(java.lang.String ctype)
          Sets the content type of this Key.
 void setData(byte[] data)
          Sets the non-encoded binary data representing this Key.
 void setData(java.lang.String uri)
          Sets the non-encoded binary data as obtained from the given uri.
 void setURI(java.lang.String uri)
          Sets the URI reference representing this Key.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

m_Uri

protected java.lang.String m_Uri

m_ContentType

protected java.lang.String m_ContentType

m_Data

protected byte[] m_Data

m_isUri

protected boolean m_isUri
Constructor Detail

DataContainer

public DataContainer()
Method Detail

isData

public boolean isData()
Description copied from interface: Key
Tests if this Key is given as binary data.

Specified by:
isData in interface Key
Returns:
true if given as binary data, false otherwise.

getContentType

public java.lang.String getContentType()
Description copied from interface: Key
Returns the content type of this Key.

Specified by:
getContentType in interface Key
Returns:
the content type as String.

setContentType

public void setContentType(java.lang.String ctype)
Description copied from interface: Key
Sets the content type of this Key.

Specified by:
setContentType in interface Key
Parameters:
ctype - the content type as String.

setData

public void setData(byte[] data)
Description copied from interface: Key
Sets the non-encoded binary data representing this Key.

Specified by:
setData in interface Key
Parameters:
data - the non-encoded binary data as byte[].

setData

public void setData(java.lang.String uri)
             throws java.io.IOException,
                    java.net.MalformedURLException
Description copied from interface: Key
Sets the non-encoded binary data as obtained from the given uri.

Specified by:
setData in interface Key
Parameters:
uri - an URI as String.
java.io.IOException
java.net.MalformedURLException

getData

public byte[] getData()
Description copied from interface: Key
Returns the non-encoded binary data representing this Key.

Specified by:
getData in interface Key
Returns:
the non-encoded binary data as byte[].

getURI

public java.lang.String getURI()
Description copied from interface: Key
Returns the URI reference representing this Key.

Specified by:
getURI in interface Key
Returns:
the URI reference as String.

setURI

public void setURI(java.lang.String uri)
Description copied from interface: Key
Sets the URI reference representing this Key.

Specified by:
setURI in interface Key
Parameters:
uri - the URI reference as String.

isURI

public boolean isURI()
Description copied from interface: Key
Tests if this Key is given as an URI reference.

Specified by:
isURI in interface Key
Returns:
true if given as URI, false otherwise.

getInputStream

public java.io.InputStream getInputStream()
                                   throws java.io.IOException,
                                          java.net.MalformedURLException
Description copied from interface: Key
Returns an InputStream providing access to the data of this Key.

An implementation might use a ByteArrayInputStream for inlined data, or return the input stream which can be obtained from the URI (i.e. using java.net.URL).

Specified by:
getInputStream in interface Key
Returns:
an InputStream instance.
java.io.IOException
java.net.MalformedURLException

getDataFromURI

public byte[] getDataFromURI()
                      throws java.io.IOException,
                             java.net.MalformedURLException
Description copied from interface: Key
Returns the data obtained from the uri of this Key.

Specified by:
getDataFromURI in interface Key
Returns:
a byte[].
java.io.IOException
java.net.MalformedURLException


Copyright © 2001-2003 jpim team.