1 /* Copyright (C) 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 ASCII
13 * Unrecognized characters are printed as `?'.
17 public class Output_ASCII
extends UnicodeToBytes
19 public String
getName() { return "ASCII"; }
22 * @return number of chars converted. */
23 public int write (char[] inbuffer
, int inpos
, int inlength
)
25 int count
= this.count
;
26 byte[] buf
= this.buf
;
27 int avail
= buf
.length
- count
;
30 for (int i
= inlength
; --i
>= 0; )
32 char c
= inbuffer
[inpos
++];
33 buf
[count
++] = (byte) ((c
> 0x7f) ?
'?' : c
);
39 public int write (String str
, int inpos
, int inlength
, char[] work
)
41 int count
= this.count
;
42 byte[] buf
= this.buf
;
43 int avail
= buf
.length
- count
;
46 for (int i
= inlength
; --i
>= 0; )
48 char c
= str
.charAt(inpos
++);
49 buf
[count
++] = (byte) ((c
> 0x7f) ?
'?' : c
);