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
9 package gnu
.gcj
.convert
;
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
)
31 for (int i
= inlength
; i
> 0; i
--)
33 char c
= inbuffer
[inpos
++];
35 buf
[count
+1] = (byte)(c
>> 8);