com.bea.content.manager
Class ContentHelper

java.lang.Object
  extended by com.bea.content.manager.ContentHelper

public class ContentHelper
extends Object

Helper class for dealing with Content


Constructor Summary
ContentHelper()
           
 
Method Summary
static String pathInfoEncode(String pathInfo)
          Correctly URLEncode a path-info string.
static byte[] toByteArray(InputStream inputStream)
          Converts an InputStream to a byte[].
static byte[] toByteArray(InputStream inputStream, int maxSize)
          Converts an InputStream to a byte[].
static byte[] toByteArray(InputStream inputStream, long start, long length)
          Converts an InputStream to a byte[].
static String toHTML(String in)
          Convert an arbitrary string to HTML which will display as the original string intended.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

ContentHelper

public ContentHelper()
Method Detail

pathInfoEncode

public static String pathInfoEncode(String pathInfo)
Correctly URLEncode a path-info string.

This can be used to pass a contentId as Path-Info to the ShowDocServlet.

This will url encode the pathInfo, but will leave "/"'s alone.


toHTML

public static String toHTML(String in)
Convert an arbitrary string to HTML which will display as the original string intended.

This will replace the characters '&', '"', '<', and '>' with '&amp;', &quot;', '&lt;', and '&gt;', respectively.


toByteArray

public static byte[] toByteArray(InputStream inputStream)
Converts an InputStream to a byte[].

Parameters
inputStream - - the InputStream to convert to the byte[].
Returns
byte[] - the byte[] converted from the InputStream.

toByteArray

public static byte[] toByteArray(InputStream inputStream,
                                 int maxSize)
                          throws RepositoryException
Converts an InputStream to a byte[]. If the input stream won't fit into the cache (maxSize is exceeded), then return null. Otherwise, we can fit the InputStream data into the cache, and will return that byte array instead of the InputStream.

Parameters
inputStream - - the InputStream to convert to the byte[].
Returns
byte[] - the byte[] converted from the InputStream, or null if the InputStream size is larger than maxSize.
Throws
RepositoryException

toByteArray

public static byte[] toByteArray(InputStream inputStream,
                                 long start,
                                 long length)
Converts an InputStream to a byte[].

Parameters
inputStream - - the InputStream to convert to the byte[].
start - - the index to start at.
length - - the index to end at.
Returns
byte[] - the byte[] converted from the InputStream.


Copyright © 2006 BEA Systems, Inc. All Rights Reserved