FileDocCategorySizeDatePackage
ISO8859_1_Reader.javaAPI DocJ2ME CLDC 1.11675Wed Feb 05 15:55:58 GMT 2003com.sun.cldc.i18n.j2me

ISO8859_1_Reader

public class ISO8859_1_Reader extends StreamReader
Default J2ME class for input stream readers
author
Nik Shaylor, Antero Taivalsaari
version
1.0 10/18/99
version
1.1 03/29/02

Fields Summary
private static int
BBUF_LEN
Constructors Summary
Methods Summary
public synchronized intread()
Read a single character.

exception
IOException If an I/O error occurs


                      
          
        return in.read();
    
public synchronized intread(char[] cbuf, int off, int len)
Read characters into a portion of an array.

exception
IOException If an I/O error occurs


        // Allocate a private buffer to speed up reading
        int bbuflen = (len > BBUF_LEN) ? BBUF_LEN : len;
        byte bbuf[] = new byte[bbuflen];

        int count = 0;
        while (count < len) {
            int nbytes = len - count;
            if (nbytes > bbuflen) nbytes = bbuflen;
            nbytes = in.read(bbuf, 0, nbytes);

            if (nbytes == -1) {
                return (count == 0) ? -1 : count;
            }

            for (int i = 0; i < nbytes; i++) {
                cbuf[off++] = (char)(bbuf[i] & 0xFF);
            }

            count += nbytes;
        }
        return len;
    
public intsizeOf(byte[] array, int offset, int length)
Get the size in chars of an array of bytes

        return length;