/Users/lyon/j4p/src/futils/Examples.java

1    /* 
2     * Created by IntelliJ IDEA. 
3     * User: lyon 
4     * Date: Oct 12, 2002 
5     * Time: 7:48:23 AM 
6     * To change template for new class use 
7     * Code Style | Class Templates options (Tools | IDE Options). 
8     */ 
9    package futils; 
10    
11   import java.io.*; 
12    
13   public class Examples { 
14       public static void testBinaryCopyFile() { 
15           try { 
16               Futil.binaryCopyFile( 
17                       new FileInputStream( 
18                               Futil.getReadFile("select input file")), 
19                       new FileOutputStream( 
20                               Futil.getWriteFile("select output file"))); 
21               System.out.println("binaryCopyFile done."); 
22           } catch (IOException e) { 
23           } 
24       } 
25    
26       public static void testReadBytes() { 
27           byte b[] = Futil.readBytes(Futil.getReadFile("select a file")); 
28           System.out.println("you read: " + b.length + " bytes"); 
29           Futil.print(b); 
30       } 
31    
32       public static void testCopyFile() { 
33           try { 
34               Futil.copyFile( 
35                       new BufferedReader( 
36                               new FileReader( 
37                                       Futil.getReadFile("select .txt file"))), 
38                       new BufferedWriter( 
39                               new FileWriter( 
40                                       Futil.getWriteFile("output .txt file")))); 
41           } catch (IOException e) { 
42               e.printStackTrace(); 
43           } 
44           System.out.println("Copy done"); 
45       } 
46   } 
47