OpenCores
URL https://opencores.org/ocsvn/openrisc/openrisc/trunk

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libjava/] [gnu/] [gcj/] [convert/] [Input_UnicodeBig.java] - Blame information for rev 756

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 756 jeremybenn
/* Copyright (C) 2004  Free Software Foundation
2
 
3
   This file is part of libgcj.
4
 
5
This software is copyrighted work licensed under the terms of the
6
Libgcj License.  Please consult the file "LIBGCJ_LICENSE" for
7
details.  */
8
 
9
package gnu.gcj.convert;
10
 
11
public class Input_UnicodeBig extends BytesToUnicode
12
{
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;
17
 
18
  public String getName() { return "UnicodeBig"; }
19
 
20
  public int read (char[] outbuffer, int outpos, int count)
21
  {
22
    int origcount = count;
23
    for (;;)
24
      {
25
        if (partial_count == 2)
26
          {
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;
37
          }
38
        else if (inpos >= inlength)
39
          break;
40
        else
41
          {
42
            int b = inbuffer[inpos++] & 0xFF;
43
            partial = (char) (((int) partial << 8) + b);
44
            partial_count++;
45
          }
46
      }
47
    return origcount - count;
48
  }
49
}

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.