net.wimpi.pim.contact.model
Interface Key

All Superinterfaces:
java.io.Serializable
All Known Implementing Classes:
DataContainer

public interface Key
extends java.io.Serializable

An interface modeling a key based on the types and information of the vCard Mime directory profile standard specification.

For reference see RFC 2426:
3.7.2 KEY Type Definition

Note that a key might be either inlined as encoded binary data (MimeBase64 Encoding), as 8-bit encoded ASCII or represented by an URI reference (extension to the specification).
Should refer to or contain data of an IANA registered public key or authentication certificate format for maximum compatibility.

Version:
0.1 (22/07/2003)
Author:
Dieter Wimberger

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.
 

Method Detail

isURI

public boolean isURI()
Tests if this Key is given as an URI reference.

Returns:
true if given as URI, false otherwise.

getURI

public java.lang.String getURI()
Returns the URI reference representing this Key.

Returns:
the URI reference as String.

setURI

public void setURI(java.lang.String uri)
Sets the URI reference representing this Key.

Parameters:
uri - the URI reference as String.

isData

public boolean isData()
Tests if this Key is given as binary data.

Returns:
true if given as binary data, false otherwise.

getContentType

public java.lang.String getContentType()
Returns the content type of this Key.

Returns:
the content type as String.

setContentType

public void setContentType(java.lang.String ctype)
Sets the content type of this Key.

Parameters:
ctype - the content type as String.

getData

public byte[] getData()
Returns the non-encoded binary data representing this Key.

Returns:
the non-encoded binary data as byte[].

setData

public void setData(byte[] data)
Sets the non-encoded binary data representing this 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
Sets the non-encoded binary data as obtained from the given uri.

Parameters:
uri - an URI as String.
java.io.IOException
java.net.MalformedURLException

getInputStream

public java.io.InputStream getInputStream()
                                   throws java.io.IOException,
                                          java.net.MalformedURLException
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).

Returns:
an InputStream instance.
java.io.IOException
java.net.MalformedURLException

getDataFromURI

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

Returns:
a byte[].
java.io.IOException
java.net.MalformedURLException


Copyright © 2001-2003 jpim team.