Dead
[official-gcc.git] / gomp-20050608-branch / libjava / gnu / gcj / convert / Output_UnicodeLittleUnmarked.java
bloba6b6336a216ffc7a09231113fdb4c6a1b58edb14
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 /**
12 * Convert to Unicode Little Endian, no marker
14 public class Output_UnicodeLittleUnmarked extends UnicodeToBytes
16 public String getName() { return "UnicodeLittleUnmarked"; }
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.
26 public int write (char[] inbuffer, int inpos, int inlength)
28 int avail = buf.length - count;
29 if (inlength * 2 > avail)
30 inlength = avail / 2;
31 for (int i = inlength; i > 0; i--)
33 char c = inbuffer[inpos++];
34 buf[count] = (byte)c;
35 buf[count+1] = (byte)(c >> 8);
36 count += 2;
38 return inlength;