OSDN Git Service

Initial revision
[pf3gnuchains/gcc-fork.git] / libjava / gnu / gcj / convert / Input_8859_1.java
1 /* Copyright (C) 1999  Cygnus Solutions
2
3    This file is part of libgcj.
4
5 This software is copyrighted work licensed under the terms of the
6 Libgcj License.  Please consult the file "LIBGCJ_LICENSE" for
7 details.  */
8
9 package gnu.gcj.convert;
10
11 public class Input_8859_1 extends BytesToUnicode
12 {
13   public String getName() { return "8859_1"; }
14
15   public int read (char[] outbuffer, int outpos, int outlength)
16   {
17     int origpos = outpos;
18     // Make sure fields of this are in registers.
19     int inpos = this.inpos;
20     byte[] inbuffer = this.inbuffer;
21     int inavail = this.inlength - inpos;
22     int outavail = outlength - outpos;
23     if (outavail > inavail)
24       outavail = inavail;
25     while (--outavail >= 0)
26       {
27         outbuffer[outpos++] = (char) (inbuffer[inpos++] & 0xFF);
28       }
29     this.inpos = inpos;
30     return outpos - origpos;
31   }
32 }