1:
8:
9: package ;
10:
11:
16:
17: public class Output_ASCII extends UnicodeToBytes
18: {
19: public String getName() { return "ASCII"; }
20:
21:
23: public int write (char[] inbuffer, int inpos, int inlength)
24: {
25: int count = this.count;
26: byte[] buf = this.buf;
27: int avail = buf.length - count;
28: if (inlength > avail)
29: inlength = avail;
30: for (int i = inlength; --i >= 0; )
31: {
32: char c = inbuffer[inpos++];
33: buf[count++] = (byte) ((c > 0x7f) ? '?' : c);
34: }
35: this.count = count;
36: return inlength;
37: }
38:
39: public int write (String str, int inpos, int inlength, char[] work)
40: {
41: int count = this.count;
42: byte[] buf = this.buf;
43: int avail = buf.length - count;
44: if (inlength > avail)
45: inlength = avail;
46: for (int i = inlength; --i >= 0; )
47: {
48: char c = str.charAt(inpos++);
49: buf[count++] = (byte) ((c > 0x7f) ? '?' : c);
50: }
51: this.count = count;
52: return inlength;
53: }
54: }