org.activemath.presentation
Class Fragment

java.lang.Object
  extended by org.activemath.presentation.Fragment
All Implemented Interfaces:
Serializable

public class Fragment
extends Object
implements Serializable

A transformed content item. Content is stored as bytes, supposed to be UTF-8 encoded. Implements Serializable for use as cache objects in org.apache.cache.Cache. Since we are not using a persistent cache, no care has been taken to provide a custum serialization. See Chapter 10 of "Effective Java" by Joshua Bloch.

Version:
$Revision: 1.10 $ $Date: 2005/04/18 07:52:48 $
See Also:
Serialized Form

Field Summary
protected static Category log
           
 
Constructor Summary
Fragment(String id, String format, String lang)
           
 
Method Summary
 byte[] getContent()
           
 String getContentUTF8()
          Convert the content of this fragment as UTF-8 string.
 String getFormat()
           
 String getId()
           
 String getLang()
           
 long getTimeStamp()
           
 void setContent(byte[] content)
          Set the content for this fragment.
 void setTimeStamp(long timeStamp)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

log

protected static Category log
Constructor Detail

Fragment

public Fragment(String id,
                String format,
                String lang)
Method Detail

getId

public String getId()

getFormat

public String getFormat()

getLang

public String getLang()

getTimeStamp

public long getTimeStamp()

getContent

public byte[] getContent()

getContentUTF8

public String getContentUTF8()
Convert the content of this fragment as UTF-8 string. Takes about 15ms for 180KB buffer. This string is currently not stored because of excessive memory requirements (for storing n KB of HTML, we would need 3*n KB of storage).

Returns:
content of this fragment as UTF-8 string.

setContent

public void setContent(byte[] content)
Set the content for this fragment.

Parameters:
content - content as bytes

setTimeStamp

public void setTimeStamp(long timeStamp)