gnu.iou
Class utf8

java.lang.Object
  |
  +--gnu.iou.utf8

public abstract class utf8
extends java.lang.Object

This class contains two static tools for doing UTF-8 encoding and decoding.

UTF-8 is ASCII- transparent. It supports character sets requiring more than the seven bit ASCII base range of UTF-8, including Unicode, ISO-8859, ISO-10646, etc..

We do not use an ISO UCS code signature, and we do not use a Java Data I/O- style strlen prefix.

Author:
John Pritchard (john@syntelos.org)

Constructor Summary
utf8()
           
 
Method Summary
static char[] decode(byte[] code)
           
static char[] decode(byte[] code, int off, int many)
          Terminates decoding at a null character, value 0x0.
static byte[] encode(char[] str)
           
static bbuf encode(char[] str, bbuf bytbuf)
           
static byte[] encode(java.lang.String s)
           
static byte[] encode(java.lang.String s, int paddedlen)
          Add null padding to paddedlen if necessary.
static int encoded(char[] str)
          Length encoded
static int encoded(java.lang.String s)
          Length encoded
static java.lang.String ETag(java.io.File f)
          Hash of path and last modified date used in "HTTP/1.1".
static long xor_fold(byte[] b)
          The ubiquitous exclusive- or operation over input bits.
static long xor_fold(java.lang.String str)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

utf8

public utf8()
Method Detail

decode

public static final char[] decode(byte[] code)

decode

public static final char[] decode(byte[] code,
                                  int off,
                                  int many)
Terminates decoding at a null character, value 0x0.

encode

public static final byte[] encode(char[] str)

encode

public static final bbuf encode(char[] str,
                                bbuf bytbuf)

encode

public static final byte[] encode(java.lang.String s)

encode

public static final byte[] encode(java.lang.String s,
                                  int paddedlen)
Add null padding to paddedlen if necessary.

encoded

public static final int encoded(java.lang.String s)
Length encoded

encoded

public static final int encoded(char[] str)
Length encoded

xor_fold

public static final long xor_fold(byte[] b)
The ubiquitous exclusive- or operation over input bits. Uses big- endian byte order into the integer hash value.

xor_fold

public static final long xor_fold(java.lang.String str)

ETag

public static final java.lang.String ETag(java.io.File f)
Hash of path and last modified date used in "HTTP/1.1".