@Test public void testSaveFile() throws IOException { File file = File.createTempFile("tmp", ".tmp"); file.delete(); file.mkdir(); file.deleteOnExit(); File child = new File(file, "child.txt"); child.createNewFile(); child.deleteOnExit(); aeshContext.setCurrentWorkingDirectory(new FileResource(file)); resource = aeshContext.getCurrentWorkingDirectory(); FileUtils.saveFile(resource.list().get(0), "foo", false); File f = new File(resource.list().get(0).getAbsolutePath()); Assert.assertEquals(new String(Files.readAllBytes(f.toPath())), "foo"); }
public static void saveFile(Resource file, String text, boolean append) throws IOException { if(file.isDirectory()) { throw new IOException(file+": Is a directory"); } try (OutputStream out = file.write(append);) { out.write(text.getBytes()); } }
FileUtils { public static void saveFile(Resource file, String text, boolean append) throws IOException { if(file.isDirectory()) { throw new IOException(file+": Is a directory"); } try (OutputStream out = file.write(append);) { out.write(text.getBytes()); } } }
FileUtils { public static void saveFile(Resource file, String text, boolean append) throws IOException { if(file.isDirectory()) { throw new IOException(file+": Is a directory"); } try (OutputStream out = file.write(append);) { out.write(text.getBytes()); } }  }
FileUtils { public static void saveFile(Resource file, String text, boolean append) throws IOException { if(file.isDirectory()) { throw new IOException(file+": Is a directory"); } try (OutputStream out = file.write(append);) { out.write(text.getBytes()); } }  static void saveFile(Resource file, String text, boolean append); }
FileUtils { public static void saveFile(Resource file, String text, boolean append) throws IOException { if(file.isDirectory()) { throw new IOException(file+": Is a directory"); } try (OutputStream out = file.write(append);) { out.write(text.getBytes()); } }  static void saveFile(Resource file, String text, boolean append);  }