aboutsummaryrefslogtreecommitdiff
path: root/libjava/gnu
diff options
context:
space:
mode:
authorDavid Daney <ddaney@avtrex.com>2004-10-28 15:22:44 +0000
committerDavid Daney <daney@gcc.gnu.org>2004-10-28 15:22:44 +0000
commit86ce0e3d22f4e6c973397e0fd65b2cf0dbfdf633 (patch)
treea8255f1ca0e3d38eefce5ac602045247b25767ea /libjava/gnu
parent9054261dcf97f9b99d9e564049b357a01b45774f (diff)
downloadgcc-86ce0e3d22f4e6c973397e0fd65b2cf0dbfdf633.zip
gcc-86ce0e3d22f4e6c973397e0fd65b2cf0dbfdf633.tar.gz
gcc-86ce0e3d22f4e6c973397e0fd65b2cf0dbfdf633.tar.bz2
Output_UnicodeLittleUnmarked.java: New file.
2004-10-28 David Daney <ddaney@avtrex.com> * gnu/gcj/convert/Output_UnicodeLittleUnmarked.java: New file. * Makefile.am: Build it. * Makefile.in: Regenerate. From-SVN: r89763
Diffstat (limited to 'libjava/gnu')
-rw-r--r--libjava/gnu/gcj/convert/Output_UnicodeLittleUnmarked.java41
1 files changed, 41 insertions, 0 deletions
diff --git a/libjava/gnu/gcj/convert/Output_UnicodeLittleUnmarked.java b/libjava/gnu/gcj/convert/Output_UnicodeLittleUnmarked.java
new file mode 100644
index 0000000..a6b6336
--- /dev/null
+++ b/libjava/gnu/gcj/convert/Output_UnicodeLittleUnmarked.java
@@ -0,0 +1,41 @@
+/* Copyright (C) 2004 Free Software Foundation
+
+ This file is part of libgcj.
+
+This software is copyrighted work licensed under the terms of the
+Libgcj License. Please consult the file "LIBGCJ_LICENSE" for
+details. */
+
+package gnu.gcj.convert;
+
+/**
+ * Convert to Unicode Little Endian, no marker
+ */
+public class Output_UnicodeLittleUnmarked extends UnicodeToBytes
+{
+ public String getName() { return "UnicodeLittleUnmarked"; }
+
+ /** Convert chars to bytes.
+ * Converted bytes are written to buf, starting at count.
+ * @param inbuffer source of characters to convert
+ * @param inpos index of initial character in inbuffer to convert
+ * @param inlength number of characters to convert
+ * @return number of chars converted
+ * Also, this.count is increment by the number of bytes converted.
+ */
+ public int write (char[] inbuffer, int inpos, int inlength)
+ {
+ int avail = buf.length - count;
+ if (inlength * 2 > avail)
+ inlength = avail / 2;
+ for (int i = inlength; i > 0; i--)
+ {
+ char c = inbuffer[inpos++];
+ buf[count] = (byte)c;
+ buf[count+1] = (byte)(c >> 8);
+ count += 2;
+ }
+ return inlength;
+ }
+}
+