ref_send API 2.17
defensive programming in Java

org.joe_e.charset
Class ASCII

java.lang.Object
  extended by org.joe_e.charset.ASCII

public final class ASCII
extends java.lang.Object

ASCII I/O.


Method Summary
static java.lang.String decode(byte[] buffer)
          Decodes a US-ASCII string.
static java.lang.String decode(byte[] buffer, int off, int len)
          Decodes a US-ASCII string.
static byte[] encode(java.lang.String text)
          Encodes a string in US-ASCII.
static java.io.Reader input(java.io.InputStream in)
          Constructs an ASCII reader.
static java.io.Writer output(java.io.OutputStream out)
          Constructs an ASCII writer.
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

encode

public static byte[] encode(java.lang.String text)
Encodes a string in US-ASCII.

Parameters:
text - The text to encode.
Returns:
The ASCII bytes.

decode

public static java.lang.String decode(byte[] buffer)
Decodes a US-ASCII string. Each byte not corresponding to a US-ASCII character decodes to the Unicode replacement character U+FFFD. This method is equivalent to decode(buffer, 0, buffer.length).

Parameters:
buffer - the ASCII-encoded string to decode
Returns:
The corresponding string
Throws:
java.lang.IndexOutOfBoundsException

decode

public static java.lang.String decode(byte[] buffer,
                                      int off,
                                      int len)
Decodes a US-ASCII string. Each byte not corresponding to a US-ASCII character decodes to the Unicode replacement character U+FFFD.

Parameters:
buffer - the ASCII-encoded string to decode
off - where to start decoding
len - how many bytes to decode
Returns:
the corresponding string
Throws:
java.lang.IndexOutOfBoundsException

input

public static java.io.Reader input(java.io.InputStream in)
Constructs an ASCII reader.

Parameters:
in - The binary input stream
Returns:
the ASCII character reader.

output

public static java.io.Writer output(java.io.OutputStream out)
Constructs an ASCII writer.

Parameters:
out - the output stream.

ref_send API 2.17
defensive programming in Java

Submit a bug or feature, or get help

Copyright 1998-2009 Waterken Inc. under the terms of the MIT X license.