2000-11-02 01:00:02 +08:00
|
|
|
/* Copyright (C) 1999, 2000 Free Software Foundation
|
1999-04-07 22:42:40 +08:00
|
|
|
|
|
|
|
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;
|
|
|
|
|
1999-04-17 01:25:08 +08:00
|
|
|
/**
|
2000-11-02 01:00:02 +08:00
|
|
|
* Convert ISO-Latin-1 (8859-1) text to Unicode.
|
1999-04-17 01:25:08 +08:00
|
|
|
* @author Per Bothner <bothner@cygnus.com>
|
1999-07-02 01:01:00 +08:00
|
|
|
* @date March 1999.
|
1999-04-17 01:25:08 +08:00
|
|
|
*/
|
|
|
|
|
1999-04-07 22:42:40 +08:00
|
|
|
public class Input_8859_1 extends BytesToUnicode
|
|
|
|
{
|
|
|
|
public String getName() { return "8859_1"; }
|
|
|
|
|
1999-07-02 01:01:00 +08:00
|
|
|
public int read (char[] outbuffer, int outpos, int count)
|
1999-04-07 22:42:40 +08:00
|
|
|
{
|
|
|
|
int origpos = outpos;
|
|
|
|
// Make sure fields of this are in registers.
|
|
|
|
int inpos = this.inpos;
|
|
|
|
byte[] inbuffer = this.inbuffer;
|
|
|
|
int inavail = this.inlength - inpos;
|
1999-07-02 01:01:00 +08:00
|
|
|
int outavail = count;
|
1999-04-07 22:42:40 +08:00
|
|
|
if (outavail > inavail)
|
|
|
|
outavail = inavail;
|
|
|
|
while (--outavail >= 0)
|
|
|
|
{
|
|
|
|
outbuffer[outpos++] = (char) (inbuffer[inpos++] & 0xFF);
|
|
|
|
}
|
|
|
|
this.inpos = inpos;
|
|
|
|
return outpos - origpos;
|
|
|
|
}
|
|
|
|
}
|