# com.bea.content.manager
ContentHelper Class

public class ContentHelper
extends `Object`

Helper class for dealing with Content

Hierarchy
  `Object`
  `ContentHelper`

## Constructor Summary

ContentHelper()

## Method Summary

`public static `String`` | `pathInfoEncode`(`String` pathInfo) Correctly URLEncode a path-info string.
`public static byte[]` | `toByteArray`(`InputStream` inputStream) Converts an InputStream to a byte[].
`public static byte[]` | `toByteArray`(`InputStream` inputStream, int maxSize) Converts an InputStream to a byte[].
`public static byte[]` | `toByteArray`(`InputStream` inputStream, long start, long length) Converts an InputStream to a byte[].
`public static `String`` | `toHTML`(`String` in) Convert an arbitrary string to HTML which will display as the original string intended.

Methods from class `java.lang.`Object``
`clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

## Constructor Detail

### ContentHelper

    public ContentHelper()

## Method Detail

### pathInfoEncode(String) Method

    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.

### toByteArray(InputStream) Method

    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(InputStream, int) Method

    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.

#### Exceptions

``RepositoryException``

### toByteArray(InputStream, long, long) Method

    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.

### toHTML(String) Method

    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.