org.apache.james.mailboxmanager.torque
Class MessageUtils

java.lang.Object
  extended by org.apache.james.mailboxmanager.torque.MessageUtils

public class MessageUtils
extends java.lang.Object

Utility methods for messages.


Field Summary
static byte CR
           
static byte LF
           
 
Constructor Summary
MessageUtils()
           
 
Method Summary
static long countUnnormalLines(byte[] contents)
          Counts the number of CR's and LF's which do are part of CRLFs.
static void normalisedWriteTo(byte[] contents, java.lang.StringBuffer buffer)
          Writes bytes into the buffer using naive encoding and converts isolated LF and CR to CRLF.
static byte[] toByteArray(java.io.InputStream is)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

CR

public static final byte CR
See Also:
Constant Field Values

LF

public static final byte LF
See Also:
Constant Field Values
Constructor Detail

MessageUtils

public MessageUtils()
Method Detail

countUnnormalLines

public static long countUnnormalLines(byte[] contents)
Counts the number of CR's and LF's which do are part of CRLFs.

Parameters:
contents - bytes, not null
Returns:
the number of lines which are not normal CRLF

normalisedWriteTo

public static void normalisedWriteTo(byte[] contents,
                                     java.lang.StringBuffer buffer)
Writes bytes into the buffer using naive encoding and converts isolated LF and CR to CRLF.

Parameters:
contents - bytes to write, not null
buffer - StringBuffer sink, not null

toByteArray

public static byte[] toByteArray(java.io.InputStream is)
                          throws java.io.IOException
Throws:
java.io.IOException


Copyright © 2002-2008 The Apache Software Foundation. All Rights Reserved.