| @@ -26,6 +26,7 @@ import java.io.FileInputStream; | |||||
| import java.io.FileOutputStream; | import java.io.FileOutputStream; | ||||
| import java.io.InputStream; | import java.io.InputStream; | ||||
| import java.io.OutputStream; | import java.io.OutputStream; | ||||
| import java.nio.file.Files; | |||||
| /** | /** | ||||
| * Base class for the uuencode/decode test tasks. | * Base class for the uuencode/decode test tasks. | ||||
| @@ -54,8 +55,8 @@ abstract public class BaseTask extends Task { | |||||
| OutputStream outputStream = null; | OutputStream outputStream = null; | ||||
| try { | try { | ||||
| inputStream = new BufferedInputStream( | inputStream = new BufferedInputStream( | ||||
| new FileInputStream(getInFile())); | |||||
| outputStream = new FileOutputStream(getOutFile()); | |||||
| Files.newInputStream(getInFile().toPath())); | |||||
| outputStream = Files.newOutputStream(getOutFile().toPath()); | |||||
| doit(inputStream, outputStream); | doit(inputStream, outputStream); | ||||
| } catch (Exception ex) { | } catch (Exception ex) { | ||||
| throw new BuildException(ex); | throw new BuildException(ex); | ||||
| @@ -29,6 +29,7 @@ import java.io.File; | |||||
| import java.io.FileInputStream; | import java.io.FileInputStream; | ||||
| import java.io.IOException; | import java.io.IOException; | ||||
| import java.io.InputStream; | import java.io.InputStream; | ||||
| import java.nio.file.Files; | |||||
| import static org.hamcrest.Matchers.endsWith; | import static org.hamcrest.Matchers.endsWith; | ||||
| import static org.junit.Assert.assertEquals; | import static org.junit.Assert.assertEquals; | ||||
| @@ -68,12 +69,12 @@ public class BZip2Test { | |||||
| File actualFile = new File(outputDir, "asf-logo-huge.tar.bz2"); | File actualFile = new File(outputDir, "asf-logo-huge.tar.bz2"); | ||||
| InputStream originalIn = | InputStream originalIn = | ||||
| new BufferedInputStream(new FileInputStream(originalFile)); | |||||
| new BufferedInputStream(Files.newInputStream(originalFile.toPath())); | |||||
| assertEquals((byte) 'B', originalIn.read()); | assertEquals((byte) 'B', originalIn.read()); | ||||
| assertEquals((byte) 'Z', originalIn.read()); | assertEquals((byte) 'Z', originalIn.read()); | ||||
| InputStream actualIn = | InputStream actualIn = | ||||
| new BufferedInputStream(new FileInputStream(actualFile)); | |||||
| new BufferedInputStream(Files.newInputStream(actualFile.toPath())); | |||||
| assertEquals((byte) 'B', actualIn.read()); | assertEquals((byte) 'B', actualIn.read()); | ||||
| assertEquals((byte) 'Z', actualIn.read()); | assertEquals((byte) 'Z', actualIn.read()); | ||||
| @@ -23,6 +23,7 @@ import java.io.File; | |||||
| import java.io.FileInputStream; | import java.io.FileInputStream; | ||||
| import java.io.IOException; | import java.io.IOException; | ||||
| import java.io.InputStream; | import java.io.InputStream; | ||||
| import java.nio.file.Files; | |||||
| import junit.framework.AssertionFailedError; | import junit.framework.AssertionFailedError; | ||||
| @@ -234,8 +235,8 @@ public class FixCrLfTest { | |||||
| public void assertEqualContent(File expect, File result) throws AssertionFailedError, IOException { | public void assertEqualContent(File expect, File result) throws AssertionFailedError, IOException { | ||||
| assertTrue("Expected file " + result + " doesn\'t exist", result.exists()); | assertTrue("Expected file " + result + " doesn\'t exist", result.exists()); | ||||
| try (InputStream inExpect = new BufferedInputStream(new FileInputStream(expect)); | |||||
| InputStream inResult = new BufferedInputStream(new FileInputStream(result))) { | |||||
| try (InputStream inExpect = new BufferedInputStream(Files.newInputStream(expect.toPath())); | |||||
| InputStream inResult = new BufferedInputStream(Files.newInputStream(result.toPath()))) { | |||||
| int expectedByte = inExpect.read(); | int expectedByte = inExpect.read(); | ||||
| while (expectedByte != -1) { | while (expectedByte != -1) { | ||||
| @@ -23,6 +23,7 @@ import java.io.File; | |||||
| import java.io.FileInputStream; | import java.io.FileInputStream; | ||||
| import java.io.IOException; | import java.io.IOException; | ||||
| import java.io.InputStream; | import java.io.InputStream; | ||||
| import java.nio.file.Files; | |||||
| import org.apache.tools.ant.BuildException; | import org.apache.tools.ant.BuildException; | ||||
| import org.apache.tools.ant.BuildFileRule; | import org.apache.tools.ant.BuildFileRule; | ||||
| @@ -144,8 +145,8 @@ public class ReplaceTest { | |||||
| public void assertEqualContent(File expect, File result) throws IOException { | public void assertEqualContent(File expect, File result) throws IOException { | ||||
| assertTrue("Expected file " + result + " doesn't exist", result.exists()); | assertTrue("Expected file " + result + " doesn't exist", result.exists()); | ||||
| try (InputStream inExpect = new BufferedInputStream(new FileInputStream(expect)); | |||||
| InputStream inResult = new BufferedInputStream(new FileInputStream(result))) { | |||||
| try (InputStream inExpect = new BufferedInputStream(Files.newInputStream(expect.toPath())); | |||||
| InputStream inResult = new BufferedInputStream(Files.newInputStream(result.toPath()))) { | |||||
| int expectedByte = inExpect.read(); | int expectedByte = inExpect.read(); | ||||
| while (expectedByte != -1) { | while (expectedByte != -1) { | ||||
| assertEquals(expectedByte, inResult.read()); | assertEquals(expectedByte, inResult.read()); | ||||