kamaci
kamaci

Reputation: 75257

How to Convert That Java 1.7 Code to Java 1.6?

I am converting an existing Java 1.7 project into 1.6. I have changed diamond operations and try with resources. However 1.7 has some File operations capability that 1.6 does not have. How can I change that lines of code into 1.6:

OutputStream fileStream = Files.newOutputStream(path); //there is no Files class
java.nio.file.Files.createDirectories(outputRoot.toPath()); //there is not toPath() method

also Path class

Upvotes: 1

Views: 982

Answers (1)

Josh M
Josh M

Reputation: 11947

You can replace the first line with:

OutputStream fileStream = new FileOutputStream(path);

And you could replace the second line with:

outputRoot.mkdirs();

Upvotes: 1

Related Questions