~ubuntu-branches/ubuntu/maverick/ant/maverick

« back to all changes in this revision

Viewing changes to src/main/org/apache/tools/ant/util/UUEncoder.java

  • Committer: Bazaar Package Importer
  • Author(s): Matthias Klose
  • Date: 2008-09-30 14:47:45 UTC
  • mfrom: (1.2.3 upstream)
  • Revision ID: james.westby@ubuntu.com-20080930144745-0x8uzivd9t15dua3
Tags: 1.7.1-0ubuntu1
* New upstream version (bug fix release).
  - mainly a bugfix release.
  - has extended support for Java6 features.
  - <script> now has support for JavaFX.
  - release notes: http://apache.linux-mirror.org/ant/README.html
* Remove debian/patches/05_ant-bug433444.patch. Obsoleted.

Show diffs side-by-side

added added

removed removed

Lines of Context:
33
33
public class UUEncoder {
34
34
    protected static final int DEFAULT_MODE = 644;
35
35
    private static final int MAX_CHARS_PER_LINE = 45;
 
36
    private static final int INPUT_BUFFER_SIZE = MAX_CHARS_PER_LINE * 100;
36
37
    private OutputStream out;
37
38
    private String name;
38
39
 
60
61
        throws IOException {
61
62
        this.out = out;
62
63
        encodeBegin();
63
 
        byte[] buffer = new byte[MAX_CHARS_PER_LINE * 100];
 
64
        byte[] buffer = new byte[INPUT_BUFFER_SIZE];
64
65
        int count;
65
66
        while ((count = is.read(buffer, 0, buffer.length)) != -1) {
66
67
            int pos = 0;
108
109
        byte[] data, int offset, int length, OutputStream out)
109
110
        throws IOException {
110
111
        // write out the number of characters encoded in this line.
 
112
        // CheckStyle:MagicNumber OFF
111
113
        out.write((byte) ((length & 0x3F) + ' '));
 
114
        // CheckStyle:MagicNumber ON
112
115
        byte a;
113
116
        byte b;
114
117
        byte c;
126
129
                }
127
130
            }
128
131
 
 
132
            // CheckStyle:MagicNumber OFF
129
133
            byte d1 = (byte) (((a >>> 2) & 0x3F) + ' ');
130
134
            byte d2 = (byte) ((((a << 4) & 0x30) | ((b >>> 4) & 0x0F)) + ' ');
131
135
            byte d3 = (byte) ((((b << 2) & 0x3C) | ((c >>> 6) & 0x3)) + ' ');
132
136
            byte d4 = (byte) ((c & 0x3F) + ' ');
 
137
            // CheckStyle:MagicNumber ON
133
138
 
134
139
            out.write(d1);
135
140
            out.write(d2);