aboutsummaryrefslogtreecommitdiff
path: root/libjava/gnu/gcj/convert/Input_8859_1.java
blob: 262099a13aa6a3bbf7ae4b502c4e2df668640a5b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/* Copyright (C) 1999  Cygnus Solutions

   This file is part of libgcj.

This software is copyrighted work licensed under the terms of the
Libgcj License.  Please consult the file "LIBGCJ_LICENSE" for
details.  */

package gnu.gcj.convert;

public class Input_8859_1 extends BytesToUnicode
{
  public String getName() { return "8859_1"; }

  public int read (char[] outbuffer, int outpos, int outlength)
  {
    int origpos = outpos;
    // Make sure fields of this are in registers.
    int inpos = this.inpos;
    byte[] inbuffer = this.inbuffer;
    int inavail = this.inlength - inpos;
    int outavail = outlength - outpos;
    if (outavail > inavail)
      outavail = inavail;
    while (--outavail >= 0)
      {
	outbuffer[outpos++] = (char) (inbuffer[inpos++] & 0xFF);
      }
    this.inpos = inpos;
    return outpos - origpos;
  }
}