edu.harvard.hul.ois.mets.helper
Class Base64

java.lang.Object
  extended byedu.harvard.hul.ois.mets.helper.Base64
All Implemented Interfaces:
MetsSerializable

public class Base64
extends java.lang.Object
implements MetsSerializable

Class encapsulating a Base64-encoded content string. For reference, see RFC 2045.


Constructor Summary
Base64()
          Instantiate a Base64 object.
Base64(java.io.InputStream stream)
          Instantiate a Base64 object with a content stream.
Base64(java.lang.String content)
          Instantiate a Base64 object with encoded content.
 
Method Summary
 void add(java.lang.String content)
          Add additional Base64-encoded content.
 void decode(MetsWriter w)
          De-serialize this element and its content model as Base64.
 void encode(MetsWriter w)
          Serialize this element and its content model as Base64.
 java.util.List getContent()
          Get content model.
 void read(MetsReader r)
          De-serialize this element and its content model.
static Base64 reader(MetsReader r)
          Instantiate a Base64 object de-serialized from the input stream.
 void write(MetsWriter w)
          Serialize this element and its content model.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Base64

public Base64()
Instantiate a Base64 object.


Base64

public Base64(java.lang.String content)
Instantiate a Base64 object with encoded content.

Parameters:
content - Encoded content

Base64

public Base64(java.io.InputStream stream)
Instantiate a Base64 object with a content stream. Objects instantiated with this constructor must not attempt to add content to the list returned by the getContent() method.

Parameters:
stream - Input stream
Method Detail

getContent

public java.util.List getContent()
Get content model.

Specified by:
getContent in interface MetsSerializable
Returns:
Null

add

public void add(java.lang.String content)
Add additional Base64-encoded content.

Parameters:
content - Encoded content

decode

public void decode(MetsWriter w)
            throws MetsException
De-serialize this element and its content model as Base64. Reference XML Schema Datatype description for base64Binary. Note that any whitespace characters ('\t','\r','\n',' ') are replaced with a space and subsequently any continuous whitespace characters are collapsed into a single space, per the XML Schema Datatype definition of the base64Binary type.

Parameters:
w - Writer
Throws:
MetsException

encode

public void encode(MetsWriter w)
            throws MetsException
Serialize this element and its content model as Base64.

Parameters:
w - Writer
Throws:
MetsException

reader

public static Base64 reader(MetsReader r)
                     throws MetsException
Instantiate a Base64 object de-serialized from the input stream.

Parameters:
r - Reader
Returns:
Base64 object
Throws:
MetsException - De-serializing exception

read

public void read(MetsReader r)
          throws MetsException
De-serialize this element and its content model.

Specified by:
read in interface MetsSerializable
Parameters:
r - Reader
Throws:
MetsException

write

public void write(MetsWriter w)
           throws MetsException
Serialize this element and its content model. Calls encode().

Specified by:
write in interface MetsSerializable
Parameters:
w - Writer
Throws:
MetsException