1 /* Copyright (C) 1999, 2000 Free Software Foundation
3 This file is part of libgcj.
5 This software is copyrighted work licensed under the terms of the
6 Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
9 package gnu
.gcj
.convert
;
12 * Convert Unicode ISO-Latin-1 (8851-1) text.
13 * Unrecognized characters are printed as `?'.
14 * @author Per Bothner <bothner@cygnus.com>
18 public class Output_8859_1
extends UnicodeToBytes
20 public String
getName() { return "8859_1"; }
23 * @return number of chars converted. */
24 public int write (char[] inbuffer
, int inpos
, int inlength
)
26 int count
= this.count
;
27 byte[] buf
= this.buf
;
28 int avail
= buf
.length
- count
;
31 for (int i
= inlength
; --i
>= 0; )
33 char c
= inbuffer
[inpos
++];
34 buf
[count
++] = (byte) ((c
> 0xff) ?
'?' : c
);
40 public int write (String str
, int inpos
, int inlength
, char[] work
)
42 int count
= this.count
;
43 byte[] buf
= this.buf
;
44 int avail
= buf
.length
- count
;
47 for (int i
= inlength
; --i
>= 0; )
49 char c
= str
.charAt(inpos
++);
50 buf
[count
++] = (byte) ((c
> 0xff) ?
'?' : c
);