Package net.officefloor.server.http
Class UsAsciiUtil
java.lang.Object
net.officefloor.server.http.UsAsciiUtil
Utility methods to help in US-ASCII testing.
- Author:
- Daniel Sagenschneider
-
Field Summary
Fields -
Method Summary
Modifier and TypeMethodDescriptionstatic voidassertEquals(String expected, byte[] actual) Asserts the US-ASCII content matches the expected String.static voidassertEquals(String message, String expected, byte[] actual) Asserts the US-ASCII content matches the expected String.static charconvertToChar(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 StringconvertToString(byte[] ascii) Converts the input US-ASCII to String.static byteconvertToUsAscii(char character) Converts the input character into US-ASCII character.static byte[]convertToUsAscii(String text) Converts the input text into US-ASCII format.
-
Field Details
-
US_ASCII
US-ASCIICharset.
-
-
Method Details
-
assertEquals
Asserts the US-ASCII content matches the expected String.- Parameters:
message- Message.expected- Expected text.actual- Actual US-ASCII text.
-
assertEquals
Asserts the US-ASCII content matches the expected String.- Parameters:
expected- Expected text.actual- Actual US-ASCII text.
-
convertToUsAscii
Converts the input text into US-ASCII format.- Parameters:
text- Text.- Returns:
- Text in US-ASCII format.
-
convertToHttp
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
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.
-