UnicodeToBytes.java (write(String,int,int,char[])): New overloading, allows greater efficiency.

�
	* gnu/gcj/convert/UnicodeToBytes.java (write(String,int,int,char[])):
	New overloading, allows greater efficiency.
	* gnu/gcj/convert/Output_8859_1.java (write(String,int,int,char[])):
	New overloading (for efficiency - avoids copying).
	* gnu/gcj/convert/Output_UTF8.java:  Fix typo: 0xC0 -> 0c3F.
	* gnu/gcj/convert/Input_UTF8.java:  Fix typos in bit masks.

From-SVN: r26494
This commit is contained in:
Per Bothner
1999-04-16 10:22:02 -07:00
parent c80eb46728
commit 2012fd2db0
3 changed files with 51 additions and 4 deletions
@@ -8,6 +8,13 @@ details. */
package gnu.gcj.convert;
/**
* Convert Unicode ISO-Latin-1 (8851-1) text.
* The high-order byte of each character is truncated.
* @author Per Bothner <bothner@cygnus.com>
* @date Match 1999.
*/
public class Output_8859_1 extends UnicodeToBytes
{
public String getName() { return "8859_1"; }
@@ -28,4 +35,19 @@ public class Output_8859_1 extends UnicodeToBytes
this.count = count;
return inlength;
}
public int write (String str, int inpos, int inlength, char[] work)
{
int count = this.count;
byte[] buf = this.buf;
int avail = buf.length - count;
if (inlength > avail)
inlength = avail;
for (int i = inlength; --i >= 0; )
{
buf[count++] = (byte) str.charAt(inpos++);
}
this.count = count;
return inlength;
}
}