private static ByteArrayOutputStream read(InputStream in) throws IOException { if (in == null) { throw new NullPointerException(); } ByteArrayOutputStream baos = new ByteArrayOutputStream(); copy(in, baos); return baos; }
private void copyConf(org.crsh.vfs.File src, File dst) throws IOException { if (!src.hasChildren()) { if (!dst.exists()) { Resource resource = ResourceManager.loadConf(src); if (resource != null) { log.info("Copied resource " + src.getPath().getValue() + " to " + dst.getCanonicalPath()); Utils.copy(new ByteArrayInputStream(resource.getContent()), new FileOutputStream(dst)); } } } }
private void copyCmd(org.crsh.vfs.File src, File dst) throws IOException { if (src.hasChildren()) { if (!dst.exists()) { if (dst.mkdir()) { log.fine("Could not create dir " + dst.getCanonicalPath()); } } if (dst.exists() && dst.isDirectory()) { for (org.crsh.vfs.File child : src.children()) { copyCmd(child, new File(dst, child.getName())); } } } else { if (!dst.exists()) { Resource resource = src.getResource(); if (resource != null) { log.info("Copied command " + src.getPath().getValue() + " to " + dst.getCanonicalPath()); Utils.copy(new ByteArrayInputStream(resource.getContent()), new FileOutputStream(dst)); } } } }
private static ByteArrayOutputStream read(InputStream in) throws IOException { if (in == null) { throw new NullPointerException(); } ByteArrayOutputStream baos = new ByteArrayOutputStream(); copy(in, baos); return baos; }
private static ByteArrayOutputStream read(InputStream in) throws IOException { if (in == null) { throw new NullPointerException(); } ByteArrayOutputStream baos = new ByteArrayOutputStream(); copy(in, baos); return baos; }
public void file(String fileName, int length, InputStream data) throws IOException { out.write("C0644 ".getBytes()); out.write(Integer.toString(length).getBytes()); out.write(" ".getBytes()); out.write(fileName.getBytes()); out.write("\n".getBytes()); out.flush(); readAck(); Utils.copy(data, out); ack(); readAck(); } public void endDirectory(String directoryName) throws IOException {
public void file(String fileName, int length, InputStream data) throws IOException { out.write("C0644 ".getBytes()); out.write(Integer.toString(length).getBytes()); out.write(" ".getBytes()); out.write(fileName.getBytes()); out.write("\n".getBytes()); out.flush(); readAck(); Utils.copy(data, out); ack(); readAck(); } public void endDirectory(String directoryName) throws IOException {
private void copyConf(org.crsh.vfs.File src, File dst) throws IOException { if (!src.hasChildren()) { if (!dst.exists()) { Resource resource = ResourceManager.loadConf(src); if (resource != null) { log.info("Copied resource " + src.getPath().getValue() + " to " + dst.getCanonicalPath()); Utils.copy(new ByteArrayInputStream(resource.getContent()), new FileOutputStream(dst)); } } } }
private void copyConf(org.crsh.vfs.File src, File dst) throws IOException { if (!src.hasChildren()) { if (!dst.exists()) { Resource resource = ResourceManager.loadConf(src); if (resource != null) { log.info("Copied resource " + src.getPath().getValue() + " to " + dst.getCanonicalPath()); Utils.copy(new ByteArrayInputStream(resource.getContent()), new FileOutputStream(dst)); } } } }
private void copyCmd(org.crsh.vfs.File src, File dst) throws IOException { if (src.hasChildren()) { if (!dst.exists()) { if (dst.mkdir()) { log.fine("Could not create dir " + dst.getCanonicalPath()); } } if (dst.exists() && dst.isDirectory()) { for (org.crsh.vfs.File child : src.children()) { copyCmd(child, new File(dst, child.getName())); } } } else { if (!dst.exists()) { Resource resource = src.getResource(); if (resource != null) { log.info("Copied command " + src.getPath().getValue() + " to " + dst.getCanonicalPath()); Utils.copy(new ByteArrayInputStream(resource.getContent()), new FileOutputStream(dst)); } } } }
private void copyCmd(org.crsh.vfs.File src, File dst) throws IOException { if (src.hasChildren()) { if (!dst.exists()) { if (dst.mkdir()) { log.fine("Could not create dir " + dst.getCanonicalPath()); } } if (dst.exists() && dst.isDirectory()) { for (org.crsh.vfs.File child : src.children()) { copyCmd(child, new File(dst, child.getName())); } } } else { if (!dst.exists()) { Resource resource = src.getResource(); if (resource != null) { log.info("Copied command " + src.getPath().getValue() + " to " + dst.getCanonicalPath()); Utils.copy(new ByteArrayInputStream(resource.getContent()), new FileOutputStream(dst)); } } } }