Index: 3rdParty_sources/commons-io/org/apache/commons/io/ByteOrderMark.java =================================================================== diff -u -re98540848441375f30de49a3557a5c9b0e7bea99 -rb9fa1c6ec0d498310eb2977544bd3cd9ae2b24d1 --- 3rdParty_sources/commons-io/org/apache/commons/io/ByteOrderMark.java (.../ByteOrderMark.java) (revision e98540848441375f30de49a3557a5c9b0e7bea99) +++ 3rdParty_sources/commons-io/org/apache/commons/io/ByteOrderMark.java (.../ByteOrderMark.java) (revision b9fa1c6ec0d498310eb2977544bd3cd9ae2b24d1) @@ -17,10 +17,26 @@ package org.apache.commons.io; import java.io.Serializable; +import java.nio.charset.StandardCharsets; import java.util.Locale; +import java.util.Objects; /** - * Byte Order Mark (BOM) representation - see {@link org.apache.commons.io.input.BOMInputStream}. + * Byte Order Mark (BOM) representation. See {@link org.apache.commons.io.input.BOMInputStream}. + *

+ * We define the follow BOM constants: + *

+ * + *

Deprecating Serialization

+ *

+ * Serialization is deprecated and will be removed in 3.0. + *

* * @see org.apache.commons.io.input.BOMInputStream * @see Wikipedia: Byte Order Mark @@ -32,24 +48,60 @@ private static final long serialVersionUID = 1L; - /** UTF-8 BOM. */ - public static final ByteOrderMark UTF_8 = new ByteOrderMark("UTF-8", 0xEF, 0xBB, 0xBF); + /** + * UTF-8 BOM. + *

+ * This BOM is: + *

+ *
+     * 0xEF 0xBB 0xBF
+     * 
+ */ + public static final ByteOrderMark UTF_8 = new ByteOrderMark(StandardCharsets.UTF_8.name(), 0xEF, 0xBB, 0xBF); - /** UTF-16BE BOM (Big-Endian). */ - public static final ByteOrderMark UTF_16BE = new ByteOrderMark("UTF-16BE", 0xFE, 0xFF); + /** + * UTF-16BE BOM (Big-Endian). + *

+ * This BOM is: + *

+ *
+     * 0xFE 0xFF
+     * 
+ */ + public static final ByteOrderMark UTF_16BE = new ByteOrderMark(StandardCharsets.UTF_16BE.name(), 0xFE, 0xFF); - /** UTF-16LE BOM (Little-Endian). */ - public static final ByteOrderMark UTF_16LE = new ByteOrderMark("UTF-16LE", 0xFF, 0xFE); + /** + * UTF-16LE BOM (Little-Endian). + *

+ * This BOM is: + *

+ *
+     * 0xFF 0xFE
+     * 
+ */ + public static final ByteOrderMark UTF_16LE = new ByteOrderMark(StandardCharsets.UTF_16LE.name(), 0xFF, 0xFE); /** * UTF-32BE BOM (Big-Endian). + *

+ * This BOM is: + *

+ *
+     * 0x00 0x00 0xFE 0xFF
+     * 
* * @since 2.2 */ public static final ByteOrderMark UTF_32BE = new ByteOrderMark("UTF-32BE", 0x00, 0x00, 0xFE, 0xFF); /** * UTF-32LE BOM (Little-Endian). + *

+ * This BOM is: + *

+ *
+     * 0xFF 0xFE 0x00 0x00
+     * 
* * @since 2.2 */ @@ -63,50 +115,62 @@ */ public static final char UTF_BOM = '\uFEFF'; + /** + * Charset name. + */ private final String charsetName; + + /** + * Bytes. + */ private final int[] bytes; /** - * Constructs a new BOM. + * Constructs a new instance. * * @param charsetName The name of the charset the BOM represents * @param bytes The BOM's bytes - * @throws IllegalArgumentException if the charsetName is null or - * zero length - * @throws IllegalArgumentException if the bytes are null or zero - * length + * @throws IllegalArgumentException if the charsetName is zero length + * @throws IllegalArgumentException if the bytes are zero length */ public ByteOrderMark(final String charsetName, final int... bytes) { - if (charsetName == null || charsetName.isEmpty()) { + Objects.requireNonNull(charsetName, "charsetName"); + Objects.requireNonNull(bytes, "bytes"); + if (charsetName.isEmpty()) { throw new IllegalArgumentException("No charsetName specified"); } - if (bytes == null || bytes.length == 0) { + if (bytes.length == 0) { throw new IllegalArgumentException("No bytes specified"); } this.charsetName = charsetName; - this.bytes = new int[bytes.length]; - System.arraycopy(bytes, 0, this.bytes, 0, bytes.length); + this.bytes = bytes.clone(); } /** - * Gets the name of the {@link java.nio.charset.Charset} the BOM represents. + * Indicates if this instance's bytes equals another. * - * @return the character set name + * @param obj The object to compare to + * @return true if the bom's bytes are equal, otherwise + * false */ - public String getCharsetName() { - return charsetName; + @Override + public boolean equals(final Object obj) { + if (!(obj instanceof ByteOrderMark)) { + return false; + } + final ByteOrderMark bom = (ByteOrderMark) obj; + if (bytes.length != bom.length()) { + return false; + } + for (int i = 0; i < bytes.length; i++) { + if (bytes[i] != bom.get(i)) { + return false; + } + } + return true; } /** - * Gets the length of the BOM's bytes. - * - * @return the length of the BOM's bytes - */ - public int length() { - return bytes.length; - } - - /** * Gets the byte at the specified position. * * @param pos The position @@ -124,40 +188,25 @@ public byte[] getBytes() { final byte[] copy = IOUtils.byteArray(bytes.length); for (int i = 0; i < bytes.length; i++) { - copy[i] = (byte)bytes[i]; + copy[i] = (byte) bytes[i]; } return copy; } /** - * Indicates if this BOM's bytes equals another. + * Gets the name of the {@link java.nio.charset.Charset} the BOM represents. * - * @param obj The object to compare to - * @return true if the bom's bytes are equal, otherwise - * false + * @return the character set name */ - @Override - public boolean equals(final Object obj) { - if (!(obj instanceof ByteOrderMark)) { - return false; - } - final ByteOrderMark bom = (ByteOrderMark)obj; - if (bytes.length != bom.length()) { - return false; - } - for (int i = 0; i < bytes.length; i++) { - if (bytes[i] != bom.get(i)) { - return false; - } - } - return true; + public String getCharsetName() { + return charsetName; } /** - * Computes the hashcode for this BOM. + * Computes the hash code for this BOM. * - * @return the hashcode for this BOM. - * @see java.lang.Object#hashCode() + * @return the hash code for this BOM. + * @see Object#hashCode() */ @Override public int hashCode() { @@ -169,6 +218,15 @@ } /** + * Gets the length of the BOM's bytes. + * + * @return the length of the BOM's bytes + */ + public int length() { + return bytes.length; + } + + /** * Converts this instance to a String representation of the BOM. * * @return the length of the BOM's bytes Index: 3rdParty_sources/commons-io/org/apache/commons/io/ByteOrderParser.java =================================================================== diff -u -re98540848441375f30de49a3557a5c9b0e7bea99 -rb9fa1c6ec0d498310eb2977544bd3cd9ae2b24d1 --- 3rdParty_sources/commons-io/org/apache/commons/io/ByteOrderParser.java (.../ByteOrderParser.java) (revision e98540848441375f30de49a3557a5c9b0e7bea99) +++ 3rdParty_sources/commons-io/org/apache/commons/io/ByteOrderParser.java (.../ByteOrderParser.java) (revision b9fa1c6ec0d498310eb2977544bd3cd9ae2b24d1) @@ -27,12 +27,6 @@ public final class ByteOrderParser { /** - * ByteOrderUtils is a static utility class, so prevent construction with a private constructor. - */ - private ByteOrderParser() { - } - - /** * Parses the String argument as a {@link ByteOrder}. *

* Returns {@code ByteOrder.LITTLE_ENDIAN} if the given value is {@code "LITTLE_ENDIAN"}. @@ -47,10 +41,10 @@ * * * @param value - * the {@code String} containing the ByteOrder representation to be parsed + * the {@link String} containing the ByteOrder representation to be parsed * @return the ByteOrder represented by the string argument * @throws IllegalArgumentException - * if the {@code String} containing the ByteOrder representation to be parsed is unknown. + * if the {@link String} containing the ByteOrder representation to be parsed is unknown. */ public static ByteOrder parseByteOrder(final String value) { if (ByteOrder.BIG_ENDIAN.toString().equals(value)) { @@ -63,4 +57,10 @@ ", " + ByteOrder.BIG_ENDIAN); } + /** + * ByteOrderUtils is a static utility class, so prevent construction with a private constructor. + */ + private ByteOrderParser() { + } + } Index: 3rdParty_sources/commons-io/org/apache/commons/io/Charsets.java =================================================================== diff -u -re98540848441375f30de49a3557a5c9b0e7bea99 -rb9fa1c6ec0d498310eb2977544bd3cd9ae2b24d1 --- 3rdParty_sources/commons-io/org/apache/commons/io/Charsets.java (.../Charsets.java) (revision e98540848441375f30de49a3557a5c9b0e7bea99) +++ 3rdParty_sources/commons-io/org/apache/commons/io/Charsets.java (.../Charsets.java) (revision b9fa1c6ec0d498310eb2977544bd3cd9ae2b24d1) @@ -26,7 +26,7 @@ /** * Charsets required of every implementation of the Java platform. * - * From the Java documentation + * From the Java documentation * Standard charsets: *

* Every implementation of the Java platform is required to support the following character encodings. Consult @@ -50,7 +50,7 @@ * accepted on input, big-endian used on output.) * * - * @see Standard charsets + * @see Standard charsets * @since 2.3 */ public class Charsets { @@ -74,50 +74,12 @@ } /** - * Constructs a sorted map from canonical charset names to charset objects required of every implementation of the - * Java platform. - *

- * From the Java documentation - * Standard charsets: - *

- * - * @return An immutable, case-insensitive map from canonical charset names to charset objects. - * @see Charset#availableCharsets() - * @since 2.5 - */ - public static SortedMap requiredCharsets() { - return STANDARD_CHARSET_MAP; - } - - /** - * Returns the given Charset or the default Charset if the given Charset is null. - * - * @param charset - * A charset or null. - * @return the given Charset or the default Charset if the given Charset is null - */ - public static Charset toCharset(final Charset charset) { - return charset == null ? Charset.defaultCharset() : charset; - } - - /** - * Returns a Charset for the named charset. If the name is null, return the default Charset. - * - * @param charsetName The name of the requested charset, may be null. - * @return a Charset for the named charset. - * @throws UnsupportedCharsetException If the named charset is unavailable (unchecked exception). - */ - public static Charset toCharset(final String charsetName) throws UnsupportedCharsetException { - return charsetName == null ? Charset.defaultCharset() : Charset.forName(charsetName); - } - - /** * CharEncodingISO Latin Alphabet No. 1, a.k.a. ISO-LATIN-1. *

* Every implementation of the Java platform is required to support this character encoding. *

* - * @see Standard charsets + * @see Standard charsets * @deprecated Use Java 7's {@link java.nio.charset.StandardCharsets} */ @Deprecated @@ -131,7 +93,7 @@ * Every implementation of the Java platform is required to support this character encoding. *

* - * @see Standard charsets + * @see Standard charsets * @deprecated Use Java 7's {@link java.nio.charset.StandardCharsets} */ @Deprecated @@ -146,7 +108,7 @@ * Every implementation of the Java platform is required to support this character encoding. *

* - * @see Standard charsets + * @see Standard charsets * @deprecated Use Java 7's {@link java.nio.charset.StandardCharsets} */ @Deprecated @@ -160,7 +122,7 @@ * Every implementation of the Java platform is required to support this character encoding. *

* - * @see Standard charsets + * @see Standard charsets * @deprecated Use Java 7's {@link java.nio.charset.StandardCharsets} */ @Deprecated @@ -174,7 +136,7 @@ * Every implementation of the Java platform is required to support this character encoding. *

* - * @see Standard charsets + * @see Standard charsets * @deprecated Use Java 7's {@link java.nio.charset.StandardCharsets} */ @Deprecated @@ -188,9 +150,72 @@ * Every implementation of the Java platform is required to support this character encoding. *

* - * @see Standard charsets + * @see Standard charsets * @deprecated Use Java 7's {@link java.nio.charset.StandardCharsets} */ @Deprecated public static final Charset UTF_8 = StandardCharsets.UTF_8; + + /** + * Constructs a sorted map from canonical charset names to charset objects required of every implementation of the + * Java platform. + *

+ * From the Java documentation + * Standard charsets: + *

+ * + * @return An immutable, case-insensitive map from canonical charset names to charset objects. + * @see Charset#availableCharsets() + * @since 2.5 + */ + public static SortedMap requiredCharsets() { + return STANDARD_CHARSET_MAP; + } + + /** + * Returns the given Charset or the default Charset if the given Charset is null. + * + * @param charset + * A charset or null. + * @return the given Charset or the default Charset if the given Charset is null + */ + public static Charset toCharset(final Charset charset) { + return charset == null ? Charset.defaultCharset() : charset; + } + + /** + * Returns the given charset if non-null, otherwise return defaultCharset. + * + * @param charset The charset to test, may be null. + * @param defaultCharset The charset to return if charset is null, may be null. + * @return a Charset . + * @since 2.12.0 + */ + public static Charset toCharset(final Charset charset, final Charset defaultCharset) { + return charset == null ? defaultCharset : charset; + } + + /** + * Returns a Charset for the named charset. If the name is null, return the default Charset. + * + * @param charsetName The name of the requested charset, may be null. + * @return a Charset for the named charset. + * @throws UnsupportedCharsetException If the named charset is unavailable (unchecked exception). + */ + public static Charset toCharset(final String charsetName) throws UnsupportedCharsetException { + return toCharset(charsetName, Charset.defaultCharset()); + } + + /** + * Returns a Charset for the named charset. If the name is null, return the given default Charset. + * + * @param charsetName The name of the requested charset, may be null. + * @param defaultCharset The name charset to return if charsetName is null, may be null. + * @return a Charset for the named charset. + * @throws UnsupportedCharsetException If the named charset is unavailable (unchecked exception). + * @since 2.12.0 + */ + public static Charset toCharset(final String charsetName, final Charset defaultCharset) throws UnsupportedCharsetException { + return charsetName == null ? defaultCharset : Charset.forName(charsetName); + } } Index: 3rdParty_sources/commons-io/org/apache/commons/io/CloseableURLConnection.java =================================================================== diff -u --- 3rdParty_sources/commons-io/org/apache/commons/io/CloseableURLConnection.java (revision 0) +++ 3rdParty_sources/commons-io/org/apache/commons/io/CloseableURLConnection.java (revision b9fa1c6ec0d498310eb2977544bd3cd9ae2b24d1) @@ -0,0 +1,275 @@ +/* + * Licensed to the Apache Software Foundation (ASF) under one or more + * contributor license agreements. See the NOTICE file distributed with + * this work for additional information regarding copyright ownership. + * The ASF licenses this file to You under the Apache License, Version 2.0 + * (the "License"); you may not use this file except in compliance with + * the License. You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + */ +package org.apache.commons.io; + +import java.io.IOException; +import java.io.InputStream; +import java.io.OutputStream; +import java.net.URI; +import java.net.URL; +import java.net.URLConnection; +import java.security.Permission; +import java.util.List; +import java.util.Map; +import java.util.Objects; + +/** + * Delegates to a URLConnection while implementing AutoCloseable. + */ +final class CloseableURLConnection extends URLConnection implements AutoCloseable { + + static CloseableURLConnection open(final URI uri) throws IOException { + return open(Objects.requireNonNull(uri, "uri").toURL()); + } + + static CloseableURLConnection open(final URL url) throws IOException { + return new CloseableURLConnection(url.openConnection()); + } + + private final URLConnection urlConnection; + + CloseableURLConnection(final URLConnection urlConnection) { + super(Objects.requireNonNull(urlConnection, "urlConnection").getURL()); + this.urlConnection = urlConnection; + } + + @Override + public void addRequestProperty(final String key, final String value) { + urlConnection.addRequestProperty(key, value); + } + + @Override + public void close() { + IOUtils.close(urlConnection); + } + + @Override + public void connect() throws IOException { + urlConnection.connect(); + } + + @Override + public boolean equals(final Object obj) { + return urlConnection.equals(obj); + } + + @Override + public boolean getAllowUserInteraction() { + return urlConnection.getAllowUserInteraction(); + } + + @Override + public int getConnectTimeout() { + return urlConnection.getConnectTimeout(); + } + + @Override + public Object getContent() throws IOException { + return urlConnection.getContent(); + } + + @Override + public Object getContent(@SuppressWarnings("rawtypes") final Class[] classes) throws IOException { + return urlConnection.getContent(classes); + } + + @Override + public String getContentEncoding() { + return urlConnection.getContentEncoding(); + } + + @Override + public int getContentLength() { + return urlConnection.getContentLength(); + } + + @Override + public long getContentLengthLong() { + return urlConnection.getContentLengthLong(); + } + + @Override + public String getContentType() { + return urlConnection.getContentType(); + } + + @Override + public long getDate() { + return urlConnection.getDate(); + } + + @Override + public boolean getDefaultUseCaches() { + return urlConnection.getDefaultUseCaches(); + } + + @Override + public boolean getDoInput() { + return urlConnection.getDoInput(); + } + + @Override + public boolean getDoOutput() { + return urlConnection.getDoOutput(); + } + + @Override + public long getExpiration() { + return urlConnection.getExpiration(); + } + + @Override + public String getHeaderField(final int n) { + return urlConnection.getHeaderField(n); + } + + @Override + public String getHeaderField(final String name) { + return urlConnection.getHeaderField(name); + } + + @Override + public long getHeaderFieldDate(final String name, final long Default) { + return urlConnection.getHeaderFieldDate(name, Default); + } + + @Override + public int getHeaderFieldInt(final String name, final int Default) { + return urlConnection.getHeaderFieldInt(name, Default); + } + + @Override + public String getHeaderFieldKey(final int n) { + return urlConnection.getHeaderFieldKey(n); + } + + @Override + public long getHeaderFieldLong(final String name, final long Default) { + return urlConnection.getHeaderFieldLong(name, Default); + } + + @Override + public Map> getHeaderFields() { + return urlConnection.getHeaderFields(); + } + + @Override + public long getIfModifiedSince() { + return urlConnection.getIfModifiedSince(); + } + + @Override + public InputStream getInputStream() throws IOException { + return urlConnection.getInputStream(); + } + + @Override + public long getLastModified() { + return urlConnection.getLastModified(); + } + + @Override + public OutputStream getOutputStream() throws IOException { + return urlConnection.getOutputStream(); + } + + @Override + public Permission getPermission() throws IOException { + return urlConnection.getPermission(); + } + + @Override + public int getReadTimeout() { + return urlConnection.getReadTimeout(); + } + + @Override + public Map> getRequestProperties() { + return urlConnection.getRequestProperties(); + } + + @Override + public String getRequestProperty(final String key) { + return urlConnection.getRequestProperty(key); + } + + @Override + public URL getURL() { + return urlConnection.getURL(); + } + + @Override + public boolean getUseCaches() { + return urlConnection.getUseCaches(); + } + + @Override + public int hashCode() { + return urlConnection.hashCode(); + } + + @Override + public void setAllowUserInteraction(final boolean allowUserInteraction) { + urlConnection.setAllowUserInteraction(allowUserInteraction); + } + + @Override + public void setConnectTimeout(final int timeout) { + urlConnection.setConnectTimeout(timeout); + } + + @Override + public void setDefaultUseCaches(final boolean defaultUseCaches) { + urlConnection.setDefaultUseCaches(defaultUseCaches); + } + + @Override + public void setDoInput(final boolean doInput) { + urlConnection.setDoInput(doInput); + } + + @Override + public void setDoOutput(final boolean doOutput) { + urlConnection.setDoOutput(doOutput); + } + + @Override + public void setIfModifiedSince(final long ifModifiedSince) { + urlConnection.setIfModifiedSince(ifModifiedSince); + } + + @Override + public void setReadTimeout(final int timeout) { + urlConnection.setReadTimeout(timeout); + } + + @Override + public void setRequestProperty(final String key, final String value) { + urlConnection.setRequestProperty(key, value); + } + + @Override + public void setUseCaches(final boolean useCaches) { + urlConnection.setUseCaches(useCaches); + } + + @Override + public String toString() { + return urlConnection.toString(); + } + +} Index: 3rdParty_sources/commons-io/org/apache/commons/io/CopyUtils.java =================================================================== diff -u -re98540848441375f30de49a3557a5c9b0e7bea99 -rb9fa1c6ec0d498310eb2977544bd3cd9ae2b24d1 --- 3rdParty_sources/commons-io/org/apache/commons/io/CopyUtils.java (.../CopyUtils.java) (revision e98540848441375f30de49a3557a5c9b0e7bea99) +++ 3rdParty_sources/commons-io/org/apache/commons/io/CopyUtils.java (.../CopyUtils.java) (revision b9fa1c6ec0d498310eb2977544bd3cd9ae2b24d1) @@ -31,9 +31,9 @@ /** * This class provides static utility methods for buffered - * copying between sources ({@code InputStream}, {@code Reader}, - * {@code String} and {@code byte[]}) and destinations - * ({@code OutputStream}, {@code Writer}, {@code String} and + * copying between sources ({@link InputStream}, {@link Reader}, + * {@link String} and {@code byte[]}) and destinations + * ({@link OutputStream}, {@link Writer}, {@link String} and * {@code byte[]}). *

* Unless otherwise noted, these {@code copy} methods do not @@ -103,7 +103,7 @@ * method variants to specify the encoding, each row may * correspond to up to 2 methods. *

- * Origin of code: Excalibur. + * Provenance: Excalibur. * * @deprecated Use IOUtils. Will be removed in 3.0. * Methods renamed to IOUtils.write() or IOUtils.copy(). @@ -114,14 +114,9 @@ public class CopyUtils { /** - * Instances should NOT be constructed in standard programming. - */ - public CopyUtils() { } - - /** - * Copies bytes from a {@code byte[]} to an {@code OutputStream}. + * Copies bytes from a {@code byte[]} to an {@link OutputStream}. * @param input the byte array to read from - * @param output the {@code OutputStream} to write to + * @param output the {@link OutputStream} to write to * @throws IOException In case of an I/O problem */ public static void copy(final byte[] input, final OutputStream output) throws IOException { @@ -130,10 +125,11 @@ /** * Copies and convert bytes from a {@code byte[]} to chars on a - * {@code Writer}. + * {@link Writer}. * The platform's default encoding is used for the byte-to-char conversion. + * * @param input the byte array to read from - * @param output the {@code Writer} to write to + * @param output the {@link Writer} to write to * @throws IOException In case of an I/O problem * @deprecated 2.5 use {@link #copy(byte[], Writer, String)} instead */ @@ -145,9 +141,10 @@ /** * Copies and convert bytes from a {@code byte[]} to chars on a - * {@code Writer}, using the specified encoding. + * {@link Writer}, using the specified encoding. + * * @param input the byte array to read from - * @param output the {@code Writer} to write to + * @param output the {@link Writer} to write to * @param encoding The name of a supported character encoding. See the * IANA * Charset Registry for a list of valid encoding types. @@ -159,10 +156,11 @@ } /** - * Copies bytes from an {@code InputStream} to an - * {@code OutputStream}. - * @param input the {@code InputStream} to read from - * @param output the {@code OutputStream} to write to + * Copies bytes from an {@link InputStream} to an + * {@link OutputStream}. + * + * @param input the {@link InputStream} to read from + * @param output the {@link OutputStream} to write to * @return the number of bytes copied * @throws IOException In case of an I/O problem */ @@ -177,41 +175,13 @@ return count; } - // ---------------------------------------------------------------- - // Reader -> Writer - // ---------------------------------------------------------------- - /** - * Copies chars from a {@code Reader} to a {@code Writer}. - * @param input the {@code Reader} to read from - * @param output the {@code Writer} to write to - * @return the number of characters copied - * @throws IOException In case of an I/O problem - */ - public static int copy( - final Reader input, - final Writer output) - throws IOException { - final char[] buffer = IOUtils.getCharArray(); - int count = 0; - int n; - while (EOF != (n = input.read(buffer))) { - output.write(buffer, 0, n); - count += n; - } - return count; - } - - // ---------------------------------------------------------------- - // InputStream -> Writer - // ---------------------------------------------------------------- - - /** - * Copies and convert bytes from an {@code InputStream} to chars on a - * {@code Writer}. + * Copies and convert bytes from an {@link InputStream} to chars on a + * {@link Writer}. * The platform's default encoding is used for the byte-to-char conversion. - * @param input the {@code InputStream} to read from - * @param output the {@code Writer} to write to + * + * @param input the {@link InputStream} to read from + * @param output the {@link Writer} to write to * @throws IOException In case of an I/O problem * @deprecated 2.5 use {@link #copy(InputStream, Writer, String)} instead */ @@ -226,10 +196,11 @@ } /** - * Copies and convert bytes from an {@code InputStream} to chars on a - * {@code Writer}, using the specified encoding. - * @param input the {@code InputStream} to read from - * @param output the {@code Writer} to write to + * Copies and convert bytes from an {@link InputStream} to chars on a + * {@link Writer}, using the specified encoding. + * + * @param input the {@link InputStream} to read from + * @param output the {@link Writer} to write to * @param encoding The name of a supported character encoding. See the * IANA * Charset Registry for a list of valid encoding types. @@ -244,17 +215,13 @@ copy(in, output); } - - // ---------------------------------------------------------------- - // Reader -> OutputStream - // ---------------------------------------------------------------- - /** - * Serialize chars from a {@code Reader} to bytes on an - * {@code OutputStream}, and flush the {@code OutputStream}. + * Serialize chars from a {@link Reader} to bytes on an + * {@link OutputStream}, and flush the {@link OutputStream}. * Uses the default platform encoding. - * @param input the {@code Reader} to read from - * @param output the {@code OutputStream} to write to + * + * @param input the {@link Reader} to read from + * @param output the {@link OutputStream} to write to * @throws IOException In case of an I/O problem * @deprecated 2.5 use {@link #copy(Reader, OutputStream, String)} instead */ @@ -272,10 +239,11 @@ } /** - * Serialize chars from a {@code Reader} to bytes on an - * {@code OutputStream}, and flush the {@code OutputStream}. - * @param input the {@code Reader} to read from - * @param output the {@code OutputStream} to write to + * Serialize chars from a {@link Reader} to bytes on an + * {@link OutputStream}, and flush the {@link OutputStream}. + * + * @param input the {@link Reader} to read from + * @param output the {@link OutputStream} to write to * @param encoding The name of a supported character encoding. See the * IANA * Charset Registry for a list of valid encoding types. @@ -294,17 +262,36 @@ out.flush(); } - // ---------------------------------------------------------------- - // String -> OutputStream - // ---------------------------------------------------------------- + /** + * Copies chars from a {@link Reader} to a {@link Writer}. + * + * @param input the {@link Reader} to read from + * @param output the {@link Writer} to write to + * @return the number of characters copied + * @throws IOException In case of an I/O problem + */ + public static int copy( + final Reader input, + final Writer output) + throws IOException { + final char[] buffer = IOUtils.getScratchCharArray(); + int count = 0; + int n; + while (EOF != (n = input.read(buffer))) { + output.write(buffer, 0, n); + count += n; + } + return count; + } /** - * Serialize chars from a {@code String} to bytes on an - * {@code OutputStream}, and - * flush the {@code OutputStream}. + * Serialize chars from a {@link String} to bytes on an + * {@link OutputStream}, and + * flush the {@link OutputStream}. * Uses the platform default encoding. - * @param input the {@code String} to read from - * @param output the {@code OutputStream} to write to + * + * @param input the {@link String} to read from + * @param output the {@link OutputStream} to write to * @throws IOException In case of an I/O problem * @deprecated 2.5 use {@link #copy(String, OutputStream, String)} instead */ @@ -323,11 +310,12 @@ } /** - * Serialize chars from a {@code String} to bytes on an - * {@code OutputStream}, and - * flush the {@code OutputStream}. - * @param input the {@code String} to read from - * @param output the {@code OutputStream} to write to + * Serialize chars from a {@link String} to bytes on an + * {@link OutputStream}, and + * flush the {@link OutputStream}. + * + * @param input the {@link String} to read from + * @param output the {@link OutputStream} to write to * @param encoding The name of a supported character encoding. See the * IANA * Charset Registry for a list of valid encoding types. @@ -347,19 +335,21 @@ out.flush(); } - // ---------------------------------------------------------------- - // String -> Writer - // ---------------------------------------------------------------- - /** - * Copies chars from a {@code String} to a {@code Writer}. - * @param input the {@code String} to read from - * @param output the {@code Writer} to write to + * Copies chars from a {@link String} to a {@link Writer}. + * + * @param input the {@link String} to read from + * @param output the {@link Writer} to write to * @throws IOException In case of an I/O problem */ public static void copy(final String input, final Writer output) throws IOException { output.write(input); } + /** + * Instances should NOT be constructed in standard programming. + */ + public CopyUtils() { } + } Index: 3rdParty_sources/commons-io/org/apache/commons/io/DirectoryWalker.java =================================================================== diff -u -re98540848441375f30de49a3557a5c9b0e7bea99 -rb9fa1c6ec0d498310eb2977544bd3cd9ae2b24d1 --- 3rdParty_sources/commons-io/org/apache/commons/io/DirectoryWalker.java (.../DirectoryWalker.java) (revision e98540848441375f30de49a3557a5c9b0e7bea99) +++ 3rdParty_sources/commons-io/org/apache/commons/io/DirectoryWalker.java (.../DirectoryWalker.java) (revision b9fa1c6ec0d498310eb2977544bd3cd9ae2b24d1) @@ -40,8 +40,8 @@ * The following sections describe: *

* * @@ -123,7 +123,7 @@ * *

* The third constructor option is to specify separate filters, one for directories and one for files. These are - * combined internally to form the correct {@code FileFilter}, something which is very easy to get wrong when + * combined internally to form the correct {@link FileFilter}, something which is very easy to get wrong when * attempted manually, particularly when trying to express constructs like 'any file in directories named docs'. *

*

@@ -154,7 +154,7 @@ * implementation. *

*

- * What {@code DirectoryWalker} does provide for cancellation is: + * What {@link DirectoryWalker} does provide for cancellation is: *

*