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

« back to all changes in this revision

Viewing changes to src/main/org/apache/tools/tar/TarUtils.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:
27
27
 * This class provides static utility methods to work with byte streams.
28
28
 *
29
29
 */
 
30
// CheckStyle:HideUtilityClassConstructorCheck OFF (bc)
30
31
public class TarUtils {
31
32
 
 
33
    private static final int BYTE_MASK = 255;
 
34
 
32
35
    /**
33
36
     * Parse an octal string from a header buffer. This is used for the
34
37
     * file permission mode value.
59
62
            }
60
63
 
61
64
            stillPadding = false;
 
65
            // CheckStyle:MagicNumber OFF
62
66
            result = (result << 3) + (header[i] - '0');
 
67
            // CheckStyle:MagicNumber ON
63
68
        }
64
69
 
65
70
        return result;
133
138
            --idx;
134
139
        } else {
135
140
            for (long val = value; idx >= 0 && val > 0; --idx) {
 
141
                // CheckStyle:MagicNumber OFF
136
142
                buf[offset + idx] = (byte) ((byte) '0' + (byte) (val & 7));
137
143
                val = val >> 3;
 
144
                // CheckStyle:MagicNumber ON
138
145
            }
139
146
        }
140
147
 
191
198
        long sum = 0;
192
199
 
193
200
        for (int i = 0; i < buf.length; ++i) {
194
 
            sum += 255 & buf[i];
 
201
            sum += BYTE_MASK & buf[i];
195
202
        }
196
203
 
197
204
        return sum;