Repaired 'ant clean'
This commit is contained in:
parent
1b5906d6af
commit
03f8233eab
3
.gitignore
vendored
3
.gitignore
vendored
@ -48,5 +48,6 @@ People.xml
|
||||
annotations/Test0.txt
|
||||
annotations/Test1.txt
|
||||
annotations/Test2.txt
|
||||
io/Logon.out
|
||||
io/*.out
|
||||
io/*.txt
|
||||
io/test.zip
|
||||
|
@ -1,21 +0,0 @@
|
||||
1: //: io/BasicFileOutput.java
|
||||
2: import java.io.*;
|
||||
3:
|
||||
4: public class BasicFileOutput {
|
||||
5: static String file = "BasicFileOutput.out";
|
||||
6: public static void main(String[] args)
|
||||
7: throws IOException {
|
||||
8: BufferedReader in = new BufferedReader(
|
||||
9: new StringReader(
|
||||
10: BufferedInputFile.read("BasicFileOutput.java")));
|
||||
11: PrintWriter out = new PrintWriter(
|
||||
12: new BufferedWriter(new FileWriter(file)));
|
||||
13: int lineCount = 1;
|
||||
14: String s;
|
||||
15: while((s = in.readLine()) != null )
|
||||
16: out.println(lineCount++ + ": " + s);
|
||||
17: out.close();
|
||||
18: // Show the stored file:
|
||||
19: System.out.println(BufferedInputFile.read(file));
|
||||
20: }
|
||||
21: } /* (Execute to see output) *///:~
|
BIN
io/Blip3.out
BIN
io/Blip3.out
Binary file not shown.
BIN
io/Blips.out
BIN
io/Blips.out
Binary file not shown.
BIN
io/CADState.out
BIN
io/CADState.out
Binary file not shown.
@ -1,21 +0,0 @@
|
||||
1: //: io/FileOutputShortcut.java
|
||||
2: import java.io.*;
|
||||
3:
|
||||
4: public class FileOutputShortcut {
|
||||
5: static String file = "FileOutputShortcut.out";
|
||||
6: public static void main(String[] args)
|
||||
7: throws IOException {
|
||||
8: BufferedReader in = new BufferedReader(
|
||||
9: new StringReader(
|
||||
10: BufferedInputFile.read("FileOutputShortcut.java")));
|
||||
11: // Here's the shortcut:
|
||||
12: PrintWriter out = new PrintWriter(file);
|
||||
13: int lineCount = 1;
|
||||
14: String s;
|
||||
15: while((s = in.readLine()) != null )
|
||||
16: out.println(lineCount++ + ": " + s);
|
||||
17: out.close();
|
||||
18: // Show the stored file:
|
||||
19: System.out.println(BufferedInputFile.read(file));
|
||||
20: }
|
||||
21: } /* (Execute to see output) *///:~
|
@ -1,20 +0,0 @@
|
||||
//: io/TransferTo.java
|
||||
// Using transferTo() between channels
|
||||
// {Args: TransferTo.java TransferTo.txt}
|
||||
import java.nio.channels.*;
|
||||
import java.io.*;
|
||||
|
||||
public class TransferTo {
|
||||
public static void main(String[] args) throws Exception {
|
||||
if(args.length != 2) {
|
||||
System.out.println("arguments: sourcefile destfile");
|
||||
System.exit(1);
|
||||
}
|
||||
FileChannel
|
||||
in = new FileInputStream(args[0]).getChannel(),
|
||||
out = new FileOutputStream(args[1]).getChannel();
|
||||
in.transferTo(0, in.size(), out);
|
||||
// Or:
|
||||
// out.transferFrom(in, 0, in.size());
|
||||
}
|
||||
} ///:~
|
@ -518,9 +518,15 @@
|
||||
<fileset dir="${basedir}" includes="**/*Output.txt"/>
|
||||
<fileset dir="${basedir}" includes="**/log.txt"/>
|
||||
<fileset dir="${basedir}" includes="failures"/>
|
||||
<fileset dir="${basedir}" includes="Logon.out"/>
|
||||
<fileset dir="${basedir}" includes="*.out"/>
|
||||
<fileset dir="${basedir}" includes="*.txt"/>
|
||||
<fileset dir="${basedir}" includes="test.zip"/>
|
||||
<fileset dir="${basedir}" includes="X.file"/>
|
||||
<fileset dir="${basedir}" includes="*.dat"/>
|
||||
<fileset dir="${basedir}" includes="*.tmp"/>
|
||||
<fileset dir="${basedir}" includes="test.gz"/>
|
||||
</delete>
|
||||
<delete dir="MakeDirectoriesTest" />
|
||||
<echo message="clean successful"/>
|
||||
</target>
|
||||
|
||||
|
BIN
io/data.txt
BIN
io/data.txt
Binary file not shown.
BIN
io/data2.txt
BIN
io/data2.txt
Binary file not shown.
BIN
io/rtest.dat
BIN
io/rtest.dat
Binary file not shown.
BIN
io/temp.tmp
BIN
io/temp.tmp
Binary file not shown.
BIN
io/test.gz
BIN
io/test.gz
Binary file not shown.
25
io/test.out
25
io/test.out
@ -1,25 +0,0 @@
|
||||
//: io/Redirecting.java
|
||||
// Demonstrates standard I/O redirection.
|
||||
import java.io.*;
|
||||
|
||||
public class Redirecting {
|
||||
public static void main(String[] args)
|
||||
throws IOException {
|
||||
PrintStream console = System.out;
|
||||
BufferedInputStream in = new BufferedInputStream(
|
||||
new FileInputStream("Redirecting.java"));
|
||||
PrintStream out = new PrintStream(
|
||||
new BufferedOutputStream(
|
||||
new FileOutputStream("test.out")));
|
||||
System.setIn(in);
|
||||
System.setOut(out);
|
||||
System.setErr(out);
|
||||
BufferedReader br = new BufferedReader(
|
||||
new InputStreamReader(System.in));
|
||||
String s;
|
||||
while((s = br.readLine()) != null)
|
||||
System.out.println(s);
|
||||
out.close(); // Remember this!
|
||||
System.setOut(console);
|
||||
}
|
||||
} ///:~
|
25
io/test.txt
25
io/test.txt
@ -1,25 +0,0 @@
|
||||
//: io/ChannelCopy.java
|
||||
// Copying a file using channels and buffers
|
||||
// {Args: ChannelCopy.java test.txt}
|
||||
import java.nio.*;
|
||||
import java.nio.channels.*;
|
||||
import java.io.*;
|
||||
|
||||
public class ChannelCopy {
|
||||
private static final int BSIZE = 1024;
|
||||
public static void main(String[] args) throws Exception {
|
||||
if(args.length != 2) {
|
||||
System.out.println("arguments: sourcefile destfile");
|
||||
System.exit(1);
|
||||
}
|
||||
FileChannel
|
||||
in = new FileInputStream(args[0]).getChannel(),
|
||||
out = new FileOutputStream(args[1]).getChannel();
|
||||
ByteBuffer buffer = ByteBuffer.allocate(BSIZE);
|
||||
while(in.read(buffer) != -1) {
|
||||
buffer.flip(); // Prepare for writing
|
||||
out.write(buffer);
|
||||
buffer.clear(); // Prepare for reading
|
||||
}
|
||||
}
|
||||
} ///:~
|
BIN
io/worm.out
BIN
io/worm.out
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user