PIVOT-1044: Fix BXMLExplorerDocument to use the new Files methods to
avoid instantiating a FileInputStream.
git-svn-id: https://svn.apache.org/repos/asf/pivot/trunk@1861203 13f79535-47bb-0310-9956-ffa450edef68
diff --git a/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/BXMLExplorerDocument.java b/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/BXMLExplorerDocument.java
index 6a635ac..5e31e2c 100644
--- a/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/BXMLExplorerDocument.java
+++ b/tutorials/src/org/apache/pivot/tutorials/bxmlexplorer/BXMLExplorerDocument.java
@@ -18,9 +18,10 @@
import java.awt.Color;
import java.io.File;
-import java.io.FileInputStream;
+import java.io.InputStream;
import java.io.IOException;
import java.net.URL;
+import java.nio.file.Files;
import java.util.HashMap;
import javax.xml.parsers.ParserConfigurationException;
@@ -205,7 +206,7 @@
ParserConfigurationException, SAXException {
BXMLSerializer serializer = new BXMLSerializer();
serializer.setLocation(f.toURI().toURL());
- try (FileInputStream in = new FileInputStream(f)) {
+ try (InputStream in = Files.newInputStream(f.toPath())) {
Object obj = serializer.readObject(in);
if (!(obj instanceof Component)) {
throw new IllegalStateException("obj " + obj + " is of class " + obj.getClass()
@@ -231,7 +232,7 @@
this.loadedComponent = (Component) obj;
playgroundCardPane.add((Component) obj);
}
- try (FileInputStream in2 = new FileInputStream(f)) {
+ try (InputStream in2 = Files.newInputStream(f.toPath())) {
CreateHighlightedXML xml = new CreateHighlightedXML();
bxmlSourceTextPane.setDocument(xml.prettyPrint(in2));
}