[e-lang] Joe-E taming error in java.lang.String.taming

David Hopwood david.hopwood at industrial-designers.co.uk
Sat Sep 22 12:43:23 EDT 2007


Tyler Close wrote:
> So now that I've tamed away all the string encoding methods from
> java.lang.String, I find I need another method in the
> org.joe_e.charset.ASCII API. In particular,
> 
>     /**
>      * Decodes a US-ASCII string.
>      * @return The corresponding string
>      */
>     static public String
>     decode(final byte[] buffer, final int off, final int len) {
>         try {
>             return new String(buffer, off, len, "US-ASCII");
>         } catch (final UnsupportedEncodingException e) {
>             // This should never happen, as US-ASCII is a required encoding
>             throw new AssertionError("US-ASCII encoding not supported");
>         }
>     }

A corresponding method should also be added to org.joe_e.charset.UTF8.

-- 
David Hopwood <david.hopwood at industrial-designers.co.uk>



More information about the e-lang mailing list