1 /* Copyright (C) 2004 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
;
11 public class Input_UnicodeLittle
extends BytesToUnicode
13 /** 0, 8, or 16 bits of a partially constructed character. */
15 /** How many bytes of partial are valid. */
18 public String
getName() { return "UnicodeLittle"; }
20 public int read (char[] outbuffer
, int outpos
, int count
)
22 int origcount
= count
;
25 if (partial_count
== 2)
29 if (partial
== 0xFEFF)
30 ; // drop byte order mark
31 // else if (partial >= 0xFFFe) ERROR;
33 outbuffer
[outpos
++] = partial
;
38 else if (inpos
>= inlength
)
42 int b
= inbuffer
[inpos
++] & 0xFF;
43 partial
= (char) (partial
| (b
<< (8 * partial_count
)));
47 return origcount
- count
;