org.exoplatform.commons.utils
Class Text

java.lang.Object
  extended by org.exoplatform.commons.utils.Text

public abstract class Text
extends Object

Represents text that can have several internal representations in order to minimize serialization when it is possible.

Version:
$Revision$
Author:
Julien Viet

Constructor Summary
Text()
           
 
Method Summary
abstract  void appendTo(Appendable appendable)
           
static Text create(byte[] bytes)
          Create a text object from the provided byte array.
static Text create(char[] chars)
          Create a text object from the provided char array.
static Text create(String s)
          Create a text object from the provided char array.
abstract  byte[] getBytes()
           
abstract  char[] getChars()
           
abstract  void writeTo(Writer writer)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

Text

public Text()
Method Detail

create

public static Text create(byte[] bytes)
                   throws IllegalArgumentException
Create a text object from the provided byte array.

Parameters:
bytes - the markup as bytes
Returns:
the text object
Throws:
IllegalArgumentException - if the bytes is null

create

public static Text create(char[] chars)
                   throws IllegalArgumentException
Create a text object from the provided char array.

Parameters:
chars - the markup as bytes
Returns:
the text object
Throws:
IllegalArgumentException - if the chars is null

create

public static Text create(String s)
                   throws IllegalArgumentException
Create a text object from the provided char array.

Parameters:
s - the markup as bytes
Returns:
the text object
Throws:
IllegalArgumentException - if the string is null

getBytes

public abstract byte[] getBytes()

getChars

public abstract char[] getChars()

appendTo

public abstract void appendTo(Appendable appendable)
                       throws IOException
Throws:
IOException

writeTo

public abstract void writeTo(Writer writer)
                      throws IOException
Throws:
IOException


Copyright © 2009 eXo Platform SAS. All Rights Reserved.