Remove old autovect-branch by moving to "dead" directory.
[official-gcc.git] / old-autovect-branch / libjava / gnu / gcj / convert / Input_UnicodeLittle.java
blob89d9c53cd567260923cf0b89ab3bc2b542fbe654
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
7 details. */
9 package gnu.gcj.convert;
11 public class Input_UnicodeLittle extends BytesToUnicode
13 /** 0, 8, or 16 bits of a partially constructed character. */
14 char partial;
15 /** How many bytes of partial are valid. */
16 int partial_count;
18 public String getName() { return "UnicodeLittle"; }
20 public int read (char[] outbuffer, int outpos, int count)
22 int origcount = count;
23 for (;;)
25 if (partial_count == 2)
27 if (count == 0)
28 break;
29 if (partial == 0xFEFF)
30 ; // drop byte order mark
31 // else if (partial >= 0xFFFe) ERROR;
32 else
33 outbuffer[outpos++] = partial;
34 count--;
35 partial_count = 0;
36 partial = 0;
38 else if (inpos >= inlength)
39 break;
40 else
42 int b = inbuffer[inpos++] & 0xFF;
43 partial = (char) (partial | (b << (8 * partial_count)));
44 partial_count++;
47 return origcount - count;