Return-Path: Delivered-To: apmail-jakarta-commons-dev-archive@www.apache.org Received: (qmail 62815 invoked from network); 30 Dec 2003 07:06:52 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 30 Dec 2003 07:06:52 -0000 Received: (qmail 52179 invoked by uid 500); 30 Dec 2003 07:06:25 -0000 Delivered-To: apmail-jakarta-commons-dev-archive@jakarta.apache.org Received: (qmail 52123 invoked by uid 500); 30 Dec 2003 07:06:25 -0000 Mailing-List: contact commons-dev-help@jakarta.apache.org; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Help: List-Post: List-Id: "Jakarta Commons Developers List" Reply-To: "Jakarta Commons Developers List" Delivered-To: mailing list commons-dev@jakarta.apache.org Received: (qmail 52110 invoked by uid 500); 30 Dec 2003 07:06:25 -0000 Received: (qmail 52106 invoked from network); 30 Dec 2003 07:06:25 -0000 Received: from unknown (HELO minotaur.apache.org) (209.237.227.194) by daedalus.apache.org with SMTP; 30 Dec 2003 07:06:25 -0000 Received: (qmail 62777 invoked by uid 1360); 30 Dec 2003 07:06:47 -0000 Date: 30 Dec 2003 07:06:47 -0000 Message-ID: <20031230070647.62776.qmail@minotaur.apache.org> From: bayard@apache.org To: jakarta-commons-sandbox-cvs@apache.org Subject: cvs commit: jakarta-commons-sandbox/io/src/test/org/apache/commons/io IOUtilsTestCase.java X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N bayard 2003/12/29 23:06:46 Modified: io/src/java/org/apache/commons/io IOUtils.java io/src/test/org/apache/commons/io IOUtilsTestCase.java Log: removed deprecated methods from IOUtils Revision Changes Path 1.10 +9 -373 jakarta-commons-sandbox/io/src/java/org/apache/commons/io/IOUtils.java Index: IOUtils.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/io/src/java/org/apache/commons/io/IOUtils.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -r1.9 -r1.10 --- IOUtils.java 30 Dec 2003 06:50:16 -0000 1.9 +++ IOUtils.java 30 Dec 2003 07:06:46 -0000 1.10 @@ -242,171 +242,6 @@ } } - /////////////////////////////////////////////////////////////// - // Core copy methods - /////////////////////////////////////////////////////////////// - - /** - * Copy bytes from an InputStream to an OutputStream. - * @param input the InputStream to read from - * @param output the OutputStream to write to - * @return the number of bytes copied - * @throws IOException In case of an I/O problem - * @deprecated Replaced by {@link CopyUtils#copy(InputStream, OutputStream)} - */ - public static int copy( InputStream input, OutputStream output ) - throws IOException - { - return copy( input, output, DEFAULT_BUFFER_SIZE ); - } - - /** - * Copy bytes from an InputStream to an OutputStream. - * @param input the InputStream to read from - * @param output the OutputStream to write to - * @param bufferSize Size of internal buffer to use. - * @return the number of bytes copied - * @throws IOException In case of an I/O problem - * @deprecated Replaced by {@link CopyUtils#copy(InputStream, OutputStream, int)} - */ - public static int copy( InputStream input, - OutputStream output, - int bufferSize ) - throws IOException - { - byte[] buffer = new byte[ bufferSize ]; - int count = 0; - int n = 0; - while( -1 != ( n = input.read( buffer ) ) ) - { - output.write( buffer, 0, n ); - count += n; - } - return count; - } - - /** - * Copy chars from a Reader to a Writer. - * @param input the Reader to read from - * @param output the Writer to write to - * @return the number of characters copied - * @throws IOException In case of an I/O problem - * @deprecated Replaced by {@link CopyUtils#copy(Reader, Writer)} - */ - public static int copy( Reader input, Writer output ) - throws IOException - { - return copy( input, output, DEFAULT_BUFFER_SIZE ); - } - - /** - * Copy chars from a Reader to a Writer. - * @param input the Reader to read from - * @param output the Writer to write to - * @param bufferSize Size of internal buffer to use. - * @return the number of characters copied - * @throws IOException In case of an I/O problem - * @deprecated Replaced by {@link CopyUtils#copy(Reader, Writer, int)} - */ - public static int copy( Reader input, Writer output, int bufferSize ) - throws IOException - { - char[] buffer = new char[ bufferSize ]; - int count = 0; - int n = 0; - while( -1 != ( n = input.read( buffer ) ) ) - { - output.write( buffer, 0, n ); - count += n; - } - return count; - } - - /////////////////////////////////////////////////////////////// - // Derived copy methods - // InputStream -> * - /////////////////////////////////////////////////////////////// - - - /////////////////////////////////////////////////////////////// - // InputStream -> Writer - - /** - * Copy and convert bytes from an InputStream to chars on a - * Writer. - * The platform's default encoding is used for the byte-to-char conversion. - * @param input the InputStream to read from - * @param output the Writer to write to - * @throws IOException In case of an I/O problem - * @deprecated Replaced by {@link CopyUtils#copy(InputStream, Writer)} - */ - public static void copy( InputStream input, Writer output ) - throws IOException - { - copy( input, output, DEFAULT_BUFFER_SIZE ); - } - - /** - * Copy and convert bytes from an InputStream to chars on a - * Writer. - * The platform's default encoding is used for the byte-to-char conversion. - * @param input the InputStream to read from - * @param output the Writer to write to - * @param bufferSize Size of internal buffer to use. - * @throws IOException In case of an I/O problem - * @deprecated Replaced by {@link CopyUtils#copy(InputStream, Writer, int)} - */ - public static void copy( InputStream input, Writer output, int bufferSize ) - throws IOException - { - InputStreamReader in = new InputStreamReader( input ); - copy( in, output, bufferSize ); - } - - /** - * Copy and convert bytes from an InputStream to chars on a - * Writer, using the specified encoding. - * @param input the InputStream to read from - * @param output the 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. - * @throws IOException In case of an I/O problem - * @deprecated Replaced by {@link CopyUtils#copy(InputStream, Writer, String)} - */ - public static void copy( InputStream input, Writer output, String encoding ) - throws IOException - { - InputStreamReader in = new InputStreamReader( input, encoding ); - copy( in, output ); - } - - /** - * Copy and convert bytes from an InputStream to chars on a - * Writer, using the specified encoding. - * @param input the InputStream to read from - * @param output the 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. - * @param bufferSize Size of internal buffer to use. - * @throws IOException In case of an I/O problem - * @deprecated Replaced by {@link CopyUtils#copy(InputStream, Writer, String, int)} - */ - public static void copy( InputStream input, - Writer output, - String encoding, - int bufferSize ) - throws IOException - { - InputStreamReader in = new InputStreamReader( input, encoding ); - copy( in, output, bufferSize ); - } - - - /////////////////////////////////////////////////////////////// - // InputStream -> String - /** * Get the contents of an InputStream as a String. * The platform's default encoding is used for the byte-to-char conversion. @@ -432,7 +267,7 @@ throws IOException { StringWriter sw = new StringWriter(); - copy( input, sw, bufferSize ); + CopyUtils.copy( input, sw, bufferSize ); return sw.toString(); } @@ -467,7 +302,7 @@ throws IOException { StringWriter sw = new StringWriter(); - copy( input, sw, encoding, bufferSize ); + CopyUtils.copy( input, sw, encoding, bufferSize ); return sw.toString(); } @@ -497,7 +332,7 @@ throws IOException { ByteArrayOutputStream output = new ByteArrayOutputStream(); - copy( input, output, bufferSize ); + CopyUtils.copy( input, output, bufferSize ); return output.toByteArray(); } @@ -508,41 +343,6 @@ /////////////////////////////////////////////////////////////// /////////////////////////////////////////////////////////////// - // Reader -> OutputStream - /** - * Serialize chars from a Reader to bytes on an OutputStream, and - * flush the OutputStream. - * @param input the Reader to read from - * @param output the OutputStream to write to - * @throws IOException In case of an I/O problem - * @deprecated Replaced by {@link CopyUtils#copy(Reader, OutputStream)} - */ - public static void copy( Reader input, OutputStream output ) - throws IOException - { - copy( input, output, DEFAULT_BUFFER_SIZE ); - } - - /** - * Serialize chars from a Reader to bytes on an OutputStream, and - * flush the OutputStream. - * @param input the Reader to read from - * @param output the OutputStream to write to - * @param bufferSize Size of internal buffer to use. - * @throws IOException In case of an I/O problem - * @deprecated Replaced by {@link CopyUtils#copy(Reader, OutputStream, int)} - */ - public static void copy( Reader input, OutputStream output, int bufferSize ) - throws IOException - { - OutputStreamWriter out = new OutputStreamWriter( output ); - copy( input, out, bufferSize ); - // NOTE: Unless anyone is planning on rewriting OutputStreamWriter, we have to flush - // here. - out.flush(); - } - - /////////////////////////////////////////////////////////////// // Reader -> String /** * Get the contents of a Reader as a String. @@ -567,7 +367,7 @@ throws IOException { StringWriter sw = new StringWriter(); - copy( input, sw, bufferSize ); + CopyUtils.copy( input, sw, bufferSize ); return sw.toString(); } @@ -597,7 +397,7 @@ throws IOException { ByteArrayOutputStream output = new ByteArrayOutputStream(); - copy( input, output, bufferSize ); + CopyUtils.copy( input, output, bufferSize ); return output.toByteArray(); } @@ -609,61 +409,6 @@ /////////////////////////////////////////////////////////////// - // String -> OutputStream - - /** - * Serialize chars from a String to bytes on an OutputStream, and - * flush the OutputStream. - * @param input the String to read from - * @param output the OutputStream to write to - * @throws IOException In case of an I/O problem - * @deprecated Replaced by {@link CopyUtils#copy(String, OutputStream)} - */ - public static void copy( String input, OutputStream output ) - throws IOException - { - copy( input, output, DEFAULT_BUFFER_SIZE ); - } - - /** - * Serialize chars from a String to bytes on an OutputStream, and - * flush the OutputStream. - * @param input the String to read from - * @param output the OutputStream to write to - * @param bufferSize Size of internal buffer to use. - * @throws IOException In case of an I/O problem - * @deprecated Replaced by {@link CopyUtils#copy(String, OutputStream, int)} - */ - public static void copy( String input, OutputStream output, int bufferSize ) - throws IOException - { - StringReader in = new StringReader( input ); - OutputStreamWriter out = new OutputStreamWriter( output ); - copy( in, out, bufferSize ); - // NOTE: Unless anyone is planning on rewriting OutputStreamWriter, we have to flush - // here. - out.flush(); - } - - - - /////////////////////////////////////////////////////////////// - // String -> Writer - - /** - * Copy chars from a String to a Writer. - * @param input the String to read from - * @param output the Writer to write to - * @throws IOException In case of an I/O problem - * @deprecated Replaced by {@link CopyUtils#copy(String, Writer)} - */ - public static void copy( String input, Writer output ) - throws IOException - { - output.write( input ); - } - - /////////////////////////////////////////////////////////////// // String -> byte[] /** * Get the contents of a String as a byte[]. @@ -688,7 +433,7 @@ throws IOException { ByteArrayOutputStream output = new ByteArrayOutputStream(); - copy( input, output, bufferSize ); + CopyUtils.copy( input, output, bufferSize ); return output.toByteArray(); } @@ -699,83 +444,6 @@ // byte[] -> * /////////////////////////////////////////////////////////////// - - /////////////////////////////////////////////////////////////// - // byte[] -> Writer - - /** - * Copy and convert bytes from a byte[] to chars on a - * 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 Writer to write to - * @throws IOException In case of an I/O problem - * @deprecated Replaced by {@link CopyUtils#copy(byte[], Writer)} - */ - public static void copy( byte[] input, Writer output ) - throws IOException - { - copy( input, output, DEFAULT_BUFFER_SIZE ); - } - - /** - * Copy and convert bytes from a byte[] to chars on a - * 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 Writer to write to - * @param bufferSize Size of internal buffer to use. - * @throws IOException In case of an I/O problem - * @deprecated Replaced by {@link CopyUtils#copy(byte[], Writer, int)} - */ - public static void copy( byte[] input, Writer output, int bufferSize ) - throws IOException - { - ByteArrayInputStream in = new ByteArrayInputStream( input ); - copy( in, output, bufferSize ); - } - - /** - * Copy and convert bytes from a byte[] to chars on a - * Writer, using the specified encoding. - * @param input the byte array to read from - * @param output the 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. - * @throws IOException In case of an I/O problem - * @deprecated Replaced by {@link CopyUtils#copy(byte[], Writer, String)} - */ - public static void copy( byte[] input, Writer output, String encoding ) - throws IOException - { - ByteArrayInputStream in = new ByteArrayInputStream( input ); - copy( in, output, encoding ); - } - - /** - * Copy and convert bytes from a byte[] to chars on a - * Writer, using the specified encoding. - * @param input the byte array to read from - * @param output the 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. - * @param bufferSize Size of internal buffer to use. - * @throws IOException In case of an I/O problem - * @deprecated Replaced by {@link CopyUtils#copy(byte[], Writer, String, int)} - */ - public static void copy( byte[] input, - Writer output, - String encoding, - int bufferSize ) - throws IOException - { - ByteArrayInputStream in = new ByteArrayInputStream( input ); - copy( in, output, encoding, bufferSize ); - } - - /////////////////////////////////////////////////////////////// // byte[] -> String @@ -804,7 +472,7 @@ throws IOException { StringWriter sw = new StringWriter(); - copy( input, sw, bufferSize ); + CopyUtils.copy( input, sw, bufferSize ); return sw.toString(); } @@ -839,42 +507,10 @@ throws IOException { StringWriter sw = new StringWriter(); - copy( input, sw, encoding, bufferSize ); + CopyUtils.copy( input, sw, encoding, bufferSize ); return sw.toString(); } - - /////////////////////////////////////////////////////////////// - // byte[] -> OutputStream - - /** - * Copy bytes from a byte[] to an OutputStream. - * @param input the byte array to read from - * @param output the OutputStream to write to - * @throws IOException In case of an I/O problem - * @deprecated Replaced by {@link CopyUtils#copy(byte[], OutputStream)} - */ - public static void copy( byte[] input, OutputStream output ) - throws IOException - { - copy( input, output, DEFAULT_BUFFER_SIZE ); - } - - /** - * Copy bytes from a byte[] to an OutputStream. - * @param input the byte array to read from - * @param output the OutputStream to write to - * @param bufferSize Size of internal buffer to use. - * @throws IOException In case of an I/O problem - * @deprecated Replaced by {@link CopyUtils#copy(byte[], OutputStream, int)} - */ - public static void copy( byte[] input, - OutputStream output, - int bufferSize ) - throws IOException - { - output.write( input ); - } /** * Compare the contents of two Streams to determine if they are equal or not. 1.5 +13 -13 jakarta-commons-sandbox/io/src/test/org/apache/commons/io/IOUtilsTestCase.java Index: IOUtilsTestCase.java =================================================================== RCS file: /home/cvs/jakarta-commons-sandbox/io/src/test/org/apache/commons/io/IOUtilsTestCase.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -r1.4 -r1.5 --- IOUtilsTestCase.java 30 Dec 2003 07:00:03 -0000 1.4 +++ IOUtilsTestCase.java 30 Dec 2003 07:06:46 -0000 1.5 @@ -147,7 +147,7 @@ try { FileOutputStream fout = new FileOutputStream( destination ); try { - int count = IOUtils.copy( fin, fout ); + int count = CopyUtils.copy( fin, fout ); assertTrue( "Not all bytes were read", fin.available() == 0 ); assertEquals( "Number of bytes read should equal file size", m_testFile.length(), count ); fout.flush(); @@ -171,7 +171,7 @@ try { FileWriter fout = new FileWriter( destination ); try { - IOUtils.copy( fin, fout ); + CopyUtils.copy( fin, fout ); assertTrue( "Not all bytes were read", fin.available() == 0 ); fout.flush(); @@ -210,10 +210,10 @@ try { FileOutputStream fout = new FileOutputStream( destination ); try { - IOUtils.copy( fin, fout ); + CopyUtils.copy( fin, fout ); //Note: this method *does* flush. It is equivalent to: // OutputStreamWriter _out = new OutputStreamWriter(fout); - // IOUtils.copy( fin, _out, 4096 ); // copy( Reader, Writer, int ); + // CopyUtils.copy( fin, _out, 4096 ); // copy( Reader, Writer, int ); // _out.flush(); // out = fout; @@ -237,7 +237,7 @@ try { FileWriter fout = new FileWriter( destination ); try { - int count = IOUtils.copy( fin, fout ); + int count = CopyUtils.copy( fin, fout ); assertEquals( "The number of characters returned by copy is wrong", m_testFile.length(), count); fout.flush(); @@ -282,10 +282,10 @@ FileOutputStream fout = new FileOutputStream( destination ); try { - IOUtils.copy( str, fout ); + CopyUtils.copy( str, fout ); //Note: this method *does* flush. It is equivalent to: // OutputStreamWriter _out = new OutputStreamWriter(fout); - // IOUtils.copy( str, _out, 4096 ); // copy( Reader, Writer, int ); + // CopyUtils.copy( str, _out, 4096 ); // copy( Reader, Writer, int ); // _out.flush(); // out = fout; // note: we don't flush here; this IOUtils method does it for us @@ -313,7 +313,7 @@ FileWriter fout = new FileWriter( destination ); try { - IOUtils.copy( str, fout ); + CopyUtils.copy( str, fout ); fout.flush(); checkFile( destination, m_testFile ); @@ -370,7 +370,7 @@ FileWriter fout = new FileWriter( destination ); try { - IOUtils.copy( in, fout ); + CopyUtils.copy( in, fout ); fout.flush(); checkFile( destination, m_testFile ); checkWrite( fout ); @@ -409,7 +409,7 @@ FileOutputStream fout = new FileOutputStream( destination ); try { - IOUtils.copy( in, fout ); + CopyUtils.copy( in, fout ); fout.flush(); --------------------------------------------------------------------- To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org For additional commands, e-mail: commons-dev-help@jakarta.apache.org