Repaired 'ant clean'

This commit is contained in:
Bruce Eckel 2015-04-21 20:00:54 -07:00
parent 1b5906d6af
commit 03f8233eab
18 changed files with 9 additions and 114 deletions

3
.gitignore vendored
View File

@ -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

View File

@ -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) *///:~

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -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) *///:~

View File

@ -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());
}
} ///:~

BIN
io/X.file

Binary file not shown.

View File

@ -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>

Binary file not shown.

Binary file not shown.

View File

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -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);
}
} ///:~

View File

@ -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
}
}
} ///:~

Binary file not shown.