net.officefloor.plugin.socket.server.http.parse
Class UsAsciiUtil

java.lang.Object
  extended by net.officefloor.plugin.socket.server.http.parse.UsAsciiUtil

public class UsAsciiUtil
extends Object

Utility methods to help in US-ASCII testing.

Author:
Daniel Sagenschneider

Field Summary
static Charset US_ASCII
          US-ASCII Charset.
 
Method Summary
static void assertEquals(String expected, byte[] actual)
          Asserts the US-ASCII content matches the expected String.
static void assertEquals(String message, String expected, byte[] actual)
          Asserts the US-ASCII content matches the expected String.
static char convertToChar(byte asciiChar)
          Converts the input US-ASCII character to a char.
static byte[] convertToHttp(byte[] ascii)
          Ensures that CR characters are followed by a LF.
static byte[] convertToHttp(String text)
          Convenience method to convert to US-ASCII and HTTP form.
static String convertToString(byte[] ascii)
          Converts the input US-ASCII to String.
static byte convertToUsAscii(char character)
          Converts the input character into US-ASCII character.
static byte[] convertToUsAscii(String text)
          Converts the input text into US-ASCII format.
static org.easymock.ArgumentsMatcher createUsAsciiMatcher()
          Creates a ArgumentsMatcher for method with only one parameter being US-ASCII characters.
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

US_ASCII

public static final Charset US_ASCII
US-ASCII Charset.

Method Detail

assertEquals

public static void assertEquals(String message,
                                String expected,
                                byte[] actual)
Asserts the US-ASCII content matches the expected String.

Parameters:
message - Message.
expected - Expected text.
actual - Actual US-ASCII text.

assertEquals

public static void assertEquals(String expected,
                                byte[] actual)
Asserts the US-ASCII content matches the expected String.

Parameters:
expected - Expected text.
actual - Actual US-ASCII text.

convertToUsAscii

public static byte[] convertToUsAscii(String text)
Converts the input text into US-ASCII format.

Parameters:
text - Text.
Returns:
Text in US-ASCII format.

convertToHttp

public static byte[] convertToHttp(String text)
Convenience method to convert to US-ASCII and HTTP form.

Parameters:
text - Text.
Returns:
HTTP.

convertToHttp

public static byte[] convertToHttp(byte[] ascii)
Ensures that CR characters are followed by a LF.

Parameters:
ascii - Ascii content.
Returns:
HTTP.

convertToString

public static String convertToString(byte[] ascii)
Converts the input US-ASCII to String.

Parameters:
ascii - US-ASCII.
Returns:
US-ASCII characters as a String.

convertToChar

public static char convertToChar(byte asciiChar)
Converts the input US-ASCII character to a char.

Parameters:
asciiChar - US-ASCII character.
Returns:
char.

convertToUsAscii

public static byte convertToUsAscii(char character)
Converts the input character into US-ASCII character.

Parameters:
character - Character.
Returns:
US-ASCII character.

createUsAsciiMatcher

public static org.easymock.ArgumentsMatcher createUsAsciiMatcher()
Creates a ArgumentsMatcher for method with only one parameter being US-ASCII characters.

Returns:
ArgumentsMatcher.


Copyright © 2005-2011. All Rights Reserved.