com.acsinet_solutions.util.text
Class TransferableText

java.lang.Object
  extended by com.acsinet_solutions.util.text.TransferableText
All Implemented Interfaces:
java.io.Serializable

public final class TransferableText
extends java.lang.Object
implements java.io.Serializable

Implementation of a simple class that implements a serializable text holder that may locally use a stream for storing its value. If the class is serialized, the stream is transformed to a String to support serialization.

Author:
Santiago Arriaga
See Also:
Serialized Form

Constructor Summary
TransferableText(java.io.Reader reader)
          Public constructor
TransferableText(java.io.Reader reader, java.lang.String type)
          Public constructor
TransferableText(java.lang.String string)
          Public constructor
TransferableText(java.lang.String string, java.lang.String type)
          Public constructor
 
Method Summary
 java.io.Reader getReader()
          Get the text as a Reader value
 java.lang.String getString()
          Get the text as a String value
 java.lang.String getType()
          Return the type of the text
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

TransferableText

public TransferableText(java.lang.String string)
Public constructor

Parameters:
string - A not-null not-empty String instance
type - A valid MIME type value

TransferableText

public TransferableText(java.lang.String string,
                        java.lang.String type)
Public constructor

Parameters:
string - A not-null not-empty String instance

TransferableText

public TransferableText(java.io.Reader reader)
Public constructor

Parameters:
reader - A not-null open java.io.Reader instance

TransferableText

public TransferableText(java.io.Reader reader,
                        java.lang.String type)
Public constructor

Parameters:
reader - A not-null open java.io.Reader instance
type - A valid MIME type value
Method Detail

getType

public final java.lang.String getType()
Return the type of the text


getString

public final java.lang.String getString()
                                 throws java.io.IOException
Get the text as a String value

Returns:
A not-null not-empty String instance
Throws:
java.io.IOException

getReader

public final java.io.Reader getReader()
Get the text as a Reader value

Returns:
A not-null valid java.io.Reader instance