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

Subversion Repositories openrisc

[/] [openrisc/] [trunk/] [gnu-dev/] [or1k-gcc/] [libjava/] [gnu/] [gcj/] [convert/] [Output_UnicodeLittleUnmarked.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
/**
12
 * Convert to Unicode Little Endian, no marker
13
 */
14
public class Output_UnicodeLittleUnmarked extends UnicodeToBytes
15
{
16
  public String getName() { return "UnicodeLittleUnmarked"; }
17
 
18
  /** Convert chars to bytes.
19
    * Converted bytes are written to buf, starting at count.
20
    * @param inbuffer source of characters to convert
21
    * @param inpos index of initial character in inbuffer to convert
22
    * @param inlength number of characters to convert
23
    * @return number of chars converted
24
    * Also, this.count is increment by the number of bytes converted.
25
    */
26
  public int write (char[] inbuffer, int inpos, int inlength)
27
  {
28
    int avail = buf.length - count;
29
    if (inlength * 2 > avail)
30
      inlength = avail / 2;
31
    for (int i = inlength; i > 0; i--)
32
      {
33
        char c = inbuffer[inpos++];
34
        buf[count] = (byte)c;
35
        buf[count+1] = (byte)(c >> 8);
36
        count += 2;
37
      }
38
    return inlength;
39
  }
40
}
41
 

powered by: WebSVN 2.1.0

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