11/*
2- * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//io/src/test/org/apache/commons/io/IOUtilsTestCase.java,v 1.6 2003/12/30 15:26:59 jeremias Exp $
3- * $Revision: 1.6 $
4- * $Date: 2003/12/30 15:26:59 $
2+ * $Header: /home/jerenkrantz/tmp/commons/commons-convert/cvs/home/cvs/jakarta-commons//io/src/test/org/apache/commons/io/IOUtilsTestCase.java,v 1.7 2004/01/02 06:18:40 bayard Exp $
3+ * $Revision: 1.7 $
4+ * $Date: 2004/01/02 06:18:40 $
55 *
66 * ====================================================================
77 *
@@ -139,54 +139,6 @@ private void assertEqualContent( byte[] b0, byte[] b1 )
139139 assertTrue ( "Content not equal according to java.util.Arrays#equals()" , Arrays .equals ( b0 , b1 ) );
140140 }
141141
142- public void testInputStreamToOutputStream ()
143- throws Exception
144- {
145- File destination = newFile ( "copy1.txt" );
146- FileInputStream fin = new FileInputStream ( m_testFile );
147- try {
148- FileOutputStream fout = new FileOutputStream ( destination );
149- try {
150- int count = CopyUtils .copy ( fin , fout );
151- assertTrue ( "Not all bytes were read" , fin .available () == 0 );
152- assertEquals ( "Number of bytes read should equal file size" , m_testFile .length (), count );
153- fout .flush ();
154-
155- checkFile ( destination , m_testFile );
156- checkWrite ( fout );
157- } finally {
158- fout .close ();
159- }
160- deleteFile ( destination );
161- } finally {
162- fin .close ();
163- }
164- }
165-
166- public void testInputStreamToWriter ()
167- throws Exception
168- {
169- File destination = newFile ( "copy2.txt" );
170- FileInputStream fin = new FileInputStream ( m_testFile );
171- try {
172- FileWriter fout = new FileWriter ( destination );
173- try {
174- CopyUtils .copy ( fin , fout );
175-
176- assertTrue ( "Not all bytes were read" , fin .available () == 0 );
177- fout .flush ();
178-
179- checkFile ( destination , m_testFile );
180- checkWrite ( fout );
181- } finally {
182- fout .close ();
183- }
184- deleteFile ( destination );
185- } finally {
186- fin .close ();
187- }
188- }
189-
190142 public void testInputStreamToString ()
191143 throws Exception
192144 {
@@ -202,56 +154,6 @@ public void testInputStreamToString()
202154 }
203155 }
204156
205- public void testReaderToOutputStream ()
206- throws Exception
207- {
208- File destination = newFile ( "copy3.txt" );
209- FileReader fin = new FileReader ( m_testFile );
210- try {
211- FileOutputStream fout = new FileOutputStream ( destination );
212- try {
213- CopyUtils .copy ( fin , fout );
214- //Note: this method *does* flush. It is equivalent to:
215- // OutputStreamWriter _out = new OutputStreamWriter(fout);
216- // CopyUtils.copy( fin, _out, 4096 ); // copy( Reader, Writer, int );
217- // _out.flush();
218- // out = fout;
219-
220- // Note: rely on the method to flush
221- checkFile ( destination , m_testFile );
222- checkWrite ( fout );
223- } finally {
224- fout .close ();
225- }
226- deleteFile ( destination );
227- } finally {
228- fin .close ();
229- }
230- }
231-
232- public void testReaderToWriter ()
233- throws Exception
234- {
235- File destination = newFile ( "copy4.txt" );
236- FileReader fin = new FileReader ( m_testFile );
237- try {
238- FileWriter fout = new FileWriter ( destination );
239- try {
240- int count = CopyUtils .copy ( fin , fout );
241- assertEquals ( "The number of characters returned by copy is wrong" , m_testFile .length (), count );
242-
243- fout .flush ();
244- checkFile ( destination , m_testFile );
245- checkWrite ( fout );
246- } finally {
247- fout .close ();
248- }
249- deleteFile ( destination );
250- } finally {
251- fin .close ();
252- }
253- }
254-
255157 public void testReaderToString ()
256158 throws Exception
257159 {
0 commit comments