| 1 |
package fileIO; |
| 2 |
|
| 3 |
import java.io.IOException; |
| 4 |
import java.io.InputStream; |
| 5 |
|
| 6 |
public class OpenFile { |
| 7 |
|
| 8 |
public static void main(String[] args){ |
| 9 |
InputStream is=ReadWrite.getRawInputStream(args[0], false); |
| 10 |
byte[] line=new byte[100]; |
| 11 |
try { |
| 12 |
int r=is.read(line, 0, 100); |
| 13 |
if(r>0){ |
| 14 |
System.err.println("'"+new String(line, 0, r)+"'"); |
| 15 |
} |
| 16 |
} catch (IOException e) { |
| 17 |
|
| 18 |
e.printStackTrace(); |
| 19 |
} |
| 20 |
try { |
| 21 |
is.close(); |
| 22 |
} catch (IOException e) { |
| 23 |
|
| 24 |
e.printStackTrace(); |
| 25 |
} |
| 26 |
} |
| 27 |
|
| 28 |
} |