org.apache.james.mime4j.util
Class ContentUtil

java.lang.Object
  extended by org.apache.james.mime4j.util.ContentUtil

public class ContentUtil
extends java.lang.Object

Utility methods for converting textual content of a message.


Method Summary
static java.lang.String decode(ByteSequence byteSequence)
          Decodes the specified sequence of bytes into a string using the US-ASCII charset.
static java.lang.String decode(ByteSequence byteSequence, int offset, int length)
          Decodes a sub-sequence of the specified sequence of bytes into a string using the US-ASCII charset.
static java.lang.String decode(java.nio.charset.Charset charset, ByteSequence byteSequence)
          Decodes the specified sequence of bytes into a string using the specified charset.
static java.lang.String decode(java.nio.charset.Charset charset, ByteSequence byteSequence, int offset, int length)
          Decodes a sub-sequence of the specified sequence of bytes into a string using the specified charset.
static ByteSequence encode(java.nio.charset.Charset charset, java.lang.String string)
          Encodes the specified string into an immutable sequence of bytes using the specified charset.
static ByteSequence encode(java.lang.String string)
          Encodes the specified string into an immutable sequence of bytes using the US-ASCII charset.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

encode

public static ByteSequence encode(java.lang.String string)
Encodes the specified string into an immutable sequence of bytes using the US-ASCII charset.

Parameters:
string - string to encode.
Returns:
encoded string as an immutable sequence of bytes.

encode

public static ByteSequence encode(java.nio.charset.Charset charset,
                                  java.lang.String string)
Encodes the specified string into an immutable sequence of bytes using the specified charset.

Parameters:
charset - Java charset to be used for the conversion.
string - string to encode.
Returns:
encoded string as an immutable sequence of bytes.

decode

public static java.lang.String decode(ByteSequence byteSequence)
Decodes the specified sequence of bytes into a string using the US-ASCII charset.

Parameters:
byteSequence - sequence of bytes to decode.
Returns:
decoded string.

decode

public static java.lang.String decode(java.nio.charset.Charset charset,
                                      ByteSequence byteSequence)
Decodes the specified sequence of bytes into a string using the specified charset.

Parameters:
charset - Java charset to be used for the conversion.
byteSequence - sequence of bytes to decode.
Returns:
decoded string.

decode

public static java.lang.String decode(ByteSequence byteSequence,
                                      int offset,
                                      int length)
Decodes a sub-sequence of the specified sequence of bytes into a string using the US-ASCII charset.

Parameters:
byteSequence - sequence of bytes to decode.
offset - offset into the byte sequence.
length - number of bytes.
Returns:
decoded string.

decode

public static java.lang.String decode(java.nio.charset.Charset charset,
                                      ByteSequence byteSequence,
                                      int offset,
                                      int length)
Decodes a sub-sequence of the specified sequence of bytes into a string using the specified charset.

Parameters:
charset - Java charset to be used for the conversion.
byteSequence - sequence of bytes to decode.
offset - offset into the byte sequence.
length - number of bytes.
Returns:
decoded string.


Copyright © 2004-2011. All Rights Reserved.