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

Subversion Repositories openrisc

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

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 756 jeremybenn
/* Copyright (C) 1999, 2000  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
/**
12
 * Convert Unicode ISO-Latin-1 (8851-1) text.
13
 * Unrecognized characters are printed as `?'.
14
 * @author Per Bothner <bothner@cygnus.com>
15
 * @date March 1999.
16
 */
17
 
18
public class Output_8859_1 extends UnicodeToBytes
19
{
20
  public String getName() { return "8859_1"; }
21
 
22
  /**
23
   * @return number of chars converted. */
24
  public int write (char[] inbuffer, int inpos, int inlength)
25
  {
26
    int count = this.count;
27
    byte[] buf = this.buf;
28
    int avail = buf.length - count;
29
    if (inlength > avail)
30
      inlength = avail;
31
    for (int i = inlength;  --i >= 0;  )
32
      {
33
        char c = inbuffer[inpos++];
34
        buf[count++] = (byte) ((c > 0xff) ? '?' : c);
35
      }
36
    this.count = count;
37
    return inlength;
38
  }
39
 
40
  public int write (String str, int inpos, int inlength, char[] work)
41
  {
42
    int count = this.count;
43
    byte[] buf = this.buf;
44
    int avail = buf.length - count;
45
    if (inlength > avail)
46
      inlength = avail;
47
    for (int i = inlength;  --i >= 0;  )
48
      {
49
        char c = str.charAt(inpos++);
50
        buf[count++] = (byte) ((c > 0xff) ? '?' : c);
51
      }
52
    this.count = count;
53
    return inlength;
54
  }
55
}

powered by: WebSVN 2.1.0

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