|
Version: 1.1.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.biomoby.shared.MobyData org.biomoby.shared.MobyPrimaryData org.biomoby.shared.MobyPrimaryDataSimple org.biomoby.shared.data.MobyDataObject org.biomoby.shared.data.MobyDataComposite org.biomoby.shared.data.MobyDataBytes
public class MobyDataBytes
A convenience class generally intended for the transmission of binary data that will be Base64 encoded to fit in the MOBY XML envelope. It will also decode Base64 and UUEncoded strings. All members of the object can be accessed as they normally would be in a MobyDataComposite (including the Base64 representation of the bytes in the "contents" member), but the getBytes() and getObject() method, for convenience, return the bytes encoded by the "contents" member of the class. Note: changing the "contents" member's underlying StringBuffer changes the byte output! This class could be used to handle a JPEG's raw data for example.
Nested Class Summary |
---|
Nested classes/interfaces inherited from interface java.util.Map |
---|
Map.Entry<K,V> |
Field Summary | |
---|---|
static String |
BASE64_DATATYPE
|
static int |
BYTE_READ_SIZE
How much is read from a input stream (e.g. file) at once |
static String |
ENCODED_MEMBER_NAME
|
Fields inherited from interface org.biomoby.shared.data.MobyDataInstance |
---|
CENTRAL_XML_MODE, SERVICE_XML_MODE |
Constructor Summary | |
---|---|
MobyDataBytes(Element element)
Construct the object using a DOM fragment. |
|
MobyDataBytes(Element element,
Registry registry)
|
|
MobyDataBytes(String name,
byte[] data)
C-tor to use when you have binary data to encode |
|
MobyDataBytes(String name,
byte[] data,
MobyDataType inputDataType)
C-tor to use when you have binary data to encode |
|
MobyDataBytes(String name,
byte[] data,
Registry registry)
|
|
MobyDataBytes(String name,
CharSequence data)
C-tor to use when you have received text-encoded binary. |
|
MobyDataBytes(String name,
CharSequence data,
MobyDataType inputDataType)
C-tor to use when you have received text-encoded binary. |
|
MobyDataBytes(String name,
CharSequence data,
Registry registry)
|
|
MobyDataBytes(String name,
URL resourceURL)
C-tor to use when you want to encode a resource, such as an image file. |
|
MobyDataBytes(String name,
URL resourceURL,
MobyDataType inputDataType)
C-tor to use when you want to encode a resource, such as an image file. |
|
MobyDataBytes(String name,
URL resourceURL,
Registry registry)
|
Method Summary | |
---|---|
byte[] |
getBytes()
The same as getObject, but doesn't require a cast of the result |
InputStream |
getInputStream()
Convenience method that returns an InputStream for use in image loaders, file savers, etc. |
Object |
getObject()
Gives access to the Java object instance underlying the MobyData instance. |
Methods inherited from class org.biomoby.shared.data.MobyDataComposite |
---|
clear, clone, containsKey, containsValue, entrySet, equals, get, hashCode, isEmpty, isObjectValid, keySet, put, putAll, putIfAbsent, remove, remove, replace, replace, size, toXML, values |
Methods inherited from class org.biomoby.shared.data.MobyDataObject |
---|
addCrossReference, addCrossReferences, addCrossReferences, addProvisionInfo, compareTo, createInstanceFromDOM, createInstanceFromDOM, createInstanceFromString, createInstanceFromString, createInstanceFromXML, getCrossReferences, getId, getName, getPrimaryNamespace, getProvisionInfo, getTextContents, getValue, getXmlMode, hasCrossReferences, setId, setName, setPrimaryNamespace, setProvisionInfo, setXmlMode, toString |
Methods inherited from class org.biomoby.shared.MobyPrimaryDataSimple |
---|
addNamespace, format, getDataType, getNamespaces, removeNamespace, removeNamespace, setDataType, setNamespaces |
Methods inherited from class org.biomoby.shared.MobyPrimaryData |
---|
isPrimary |
Methods inherited from class org.biomoby.shared.MobyData |
---|
getId, getName, getUserData, setUserData |
Methods inherited from class java.lang.Object |
---|
getClass, notify, notifyAll, wait, wait, wait |
Methods inherited from interface org.biomoby.shared.data.MobyDataInstance |
---|
getName, getUserData, setUserData |
Field Detail |
---|
public static final String BASE64_DATATYPE
public static final String ENCODED_MEMBER_NAME
public static final int BYTE_READ_SIZE
Constructor Detail |
---|
public MobyDataBytes(Element element) throws MobyException
IllegalArgumentException
- if the element is not a text-base64 tag, or doesn't inherit from it
MobyException
public MobyDataBytes(Element element, Registry registry) throws MobyException
MobyException
public MobyDataBytes(String name, byte[] data) throws MobyException
MobyException
- if the data provided is null, or could not be encoded(?!)public MobyDataBytes(String name, byte[] data, Registry registry) throws MobyException
MobyException
public MobyDataBytes(String name, byte[] data, MobyDataType inputDataType) throws MobyException
MobyException
public MobyDataBytes(String name, CharSequence data)
public MobyDataBytes(String name, CharSequence data, Registry registry)
public MobyDataBytes(String name, CharSequence data, MobyDataType inputDataType) throws MobyException
MobyException
public MobyDataBytes(String name, URL resourceURL) throws MobyException, IOException
resourceURL
- the URL of the resource to encode, such as "file:..." or "http:..."
MobyException
IOException
public MobyDataBytes(String name, URL resourceURL, Registry registry) throws MobyException, IOException
MobyException
IOException
public MobyDataBytes(String name, URL resourceURL, MobyDataType inputDataType) throws IOException, MobyException
resourceURL
- the URL of the resource to encode, such as "file:..." or "http:..."
IOException
MobyException
Method Detail |
---|
public InputStream getInputStream()
public Object getObject()
MobyDataObject
getObject
in interface MobyDataInstance
getObject
in class MobyDataComposite
public byte[] getBytes()
|
Version: 1.1.1 | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |