1 /* Copyright (C) 1999 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 Ascii with \ u XXXX-escapes to Unicode.
13 * @author Per Bothner <bothner@cygnus.com>
17 public class Input_JavaSrc
extends BytesToUnicode
19 public String
getName() { return "JavaSrc"; }
23 // 2: seen '\\' and 'u'
24 // 3: seen '\\' and need to emit value.
25 // 4, 5, 6, 7: seen '\\u', 'u' and (state-3) hex digits.
30 public int read (char[] outbuffer
, int outpos
, int count
)
35 if (inpos
>= inlength
)
37 if (outpos
- origpos
>= count
)
39 char b
= (char) (inbuffer
[inpos
++] & 0xFF);
65 default: // case 4: case 5: case 6: case 7:
66 int digit
= Character
.digit(b
, 16);
74 value
= value
* 16 + digit
;
84 outbuffer
[outpos
++] = b
;
86 return outpos
- origpos
;