Author: niallp Date: Wed Feb 6 11:25:47 2008 New Revision: 619112 URL: http://svn.apache.org/viewvc?rev=619112&view=rev Log: IO-140 JDK 1.5 changes: Use StringBuilder (not-sync) instead of StringBuffer
Modified: commons/proper/io/trunk/src/java/org/apache/commons/io/FileSystemUtils.java commons/proper/io/trunk/src/java/org/apache/commons/io/FilenameUtils.java commons/proper/io/trunk/src/java/org/apache/commons/io/HexDump.java commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/AndFileFilter.java commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/NameFileFilter.java commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/OrFileFilter.java commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/PrefixFileFilter.java commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/SuffixFileFilter.java commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/WildcardFileFilter.java Modified: commons/proper/io/trunk/src/java/org/apache/commons/io/FileSystemUtils.java URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/java/org/apache/commons/io/FileSystemUtils.java?rev=619112&r1=619111&r2=619112&view=diff ============================================================================== --- commons/proper/io/trunk/src/java/org/apache/commons/io/FileSystemUtils.java (original) +++ commons/proper/io/trunk/src/java/org/apache/commons/io/FileSystemUtils.java Wed Feb 6 11:25:47 2008 @@ -283,7 +283,7 @@ } // remove commas and dots in the bytes count - StringBuffer buf = new StringBuffer(line.substring(bytesStart, bytesEnd)); + StringBuilder buf = new StringBuilder(line.substring(bytesStart, bytesEnd)); for (int k = 0; k < buf.length(); k++) { if (buf.charAt(k) == ',' || buf.charAt(k) == '.') { buf.deleteCharAt(k--); Modified: commons/proper/io/trunk/src/java/org/apache/commons/io/FilenameUtils.java URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/java/org/apache/commons/io/FilenameUtils.java?rev=619112&r1=619111&r2=619112&view=diff ============================================================================== --- commons/proper/io/trunk/src/java/org/apache/commons/io/FilenameUtils.java (original) +++ commons/proper/io/trunk/src/java/org/apache/commons/io/FilenameUtils.java Wed Feb 6 11:25:47 2008 @@ -1233,7 +1233,7 @@ char[] array = text.toCharArray(); ArrayList<String> list = new ArrayList<String>(); - StringBuffer buffer = new StringBuffer(); + StringBuilder buffer = new StringBuilder(); for (int i = 0; i < array.length; i++) { if (array[i] == '?' || array[i] == '*') { if (buffer.length() != 0) { Modified: commons/proper/io/trunk/src/java/org/apache/commons/io/HexDump.java URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/java/org/apache/commons/io/HexDump.java?rev=619112&r1=619111&r2=619112&view=diff ============================================================================== --- commons/proper/io/trunk/src/java/org/apache/commons/io/HexDump.java (original) +++ commons/proper/io/trunk/src/java/org/apache/commons/io/HexDump.java Wed Feb 6 11:25:47 2008 @@ -70,7 +70,7 @@ throw new IllegalArgumentException("cannot write to nullstream"); } long display_offset = offset + index; - StringBuffer buffer = new StringBuffer(74); + StringBuilder buffer = new StringBuilder(74); for (int j = index; j < data.length; j += 16) { int chars_read = data.length - j; @@ -118,13 +118,13 @@ }; /** - * Dump a long value into a StringBuffer. + * Dump a long value into a StringBuilder. * - * @param _lbuffer the StringBuffer to dump the value in + * @param _lbuffer the StringBuilder to dump the value in * @param value the long value to be dumped - * @return StringBuffer containing the dumped value. + * @return StringBuilder containing the dumped value. */ - private static StringBuffer dump(StringBuffer _lbuffer, long value) { + private static StringBuilder dump(StringBuilder _lbuffer, long value) { for (int j = 0; j < 8; j++) { _lbuffer .append(_hexcodes[((int) (value >> _shifts[j])) & 15]); @@ -133,13 +133,13 @@ } /** - * Dump a byte value into a StringBuffer. + * Dump a byte value into a StringBuilder. * - * @param _cbuffer the StringBuffer to dump the value in + * @param _cbuffer the StringBuilder to dump the value in * @param value the byte value to be dumped - * @return StringBuffer containing the dumped value. + * @return StringBuilder containing the dumped value. */ - private static StringBuffer dump(StringBuffer _cbuffer, byte value) { + private static StringBuilder dump(StringBuilder _cbuffer, byte value) { for (int j = 0; j < 2; j++) { _cbuffer.append(_hexcodes[(value >> _shifts[j + 6]) & 15]); } Modified: commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/AndFileFilter.java URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/AndFileFilter.java?rev=619112&r1=619111&r2=619112&view=diff ============================================================================== --- commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/AndFileFilter.java (original) +++ commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/AndFileFilter.java Wed Feb 6 11:25:47 2008 @@ -145,7 +145,7 @@ * @return a String representaion */ public String toString() { - StringBuffer buffer = new StringBuffer(); + StringBuilder buffer = new StringBuilder(); buffer.append(super.toString()); buffer.append("("); if (fileFilters != null) { Modified: commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/NameFileFilter.java URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/NameFileFilter.java?rev=619112&r1=619111&r2=619112&view=diff ============================================================================== --- commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/NameFileFilter.java (original) +++ commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/NameFileFilter.java Wed Feb 6 11:25:47 2008 @@ -173,7 +173,7 @@ * @return a String representaion */ public String toString() { - StringBuffer buffer = new StringBuffer(); + StringBuilder buffer = new StringBuilder(); buffer.append(super.toString()); buffer.append("("); if (names != null) { Modified: commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/OrFileFilter.java URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/OrFileFilter.java?rev=619112&r1=619111&r2=619112&view=diff ============================================================================== --- commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/OrFileFilter.java (original) +++ commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/OrFileFilter.java Wed Feb 6 11:25:47 2008 @@ -139,7 +139,7 @@ * @return a String representaion */ public String toString() { - StringBuffer buffer = new StringBuffer(); + StringBuilder buffer = new StringBuilder(); buffer.append(super.toString()); buffer.append("("); if (fileFilters != null) { Modified: commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/PrefixFileFilter.java URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/PrefixFileFilter.java?rev=619112&r1=619111&r2=619112&view=diff ============================================================================== --- commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/PrefixFileFilter.java (original) +++ commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/PrefixFileFilter.java Wed Feb 6 11:25:47 2008 @@ -179,7 +179,7 @@ * @return a String representaion */ public String toString() { - StringBuffer buffer = new StringBuffer(); + StringBuilder buffer = new StringBuilder(); buffer.append(super.toString()); buffer.append("("); if (prefixes != null) { Modified: commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/SuffixFileFilter.java URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/SuffixFileFilter.java?rev=619112&r1=619111&r2=619112&view=diff ============================================================================== --- commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/SuffixFileFilter.java (original) +++ commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/SuffixFileFilter.java Wed Feb 6 11:25:47 2008 @@ -180,7 +180,7 @@ * @return a String representaion */ public String toString() { - StringBuffer buffer = new StringBuffer(); + StringBuilder buffer = new StringBuilder(); buffer.append(super.toString()); buffer.append("("); if (suffixes != null) { Modified: commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/WildcardFileFilter.java URL: http://svn.apache.org/viewvc/commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/WildcardFileFilter.java?rev=619112&r1=619111&r2=619112&view=diff ============================================================================== --- commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/WildcardFileFilter.java (original) +++ commons/proper/io/trunk/src/java/org/apache/commons/io/filefilter/WildcardFileFilter.java Wed Feb 6 11:25:47 2008 @@ -178,7 +178,7 @@ * @return a String representaion */ public String toString() { - StringBuffer buffer = new StringBuffer(); + StringBuilder buffer = new StringBuilder(); buffer.append(super.toString()); buffer.append("("); if (wildcards != null) {