本文整理了Java中org.crsh.util.Utils.copy()
方法的一些代码示例,展示了Utils.copy()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Utils.copy()
方法的具体详情如下:
包路径:org.crsh.util.Utils
类名称:Utils
方法名:copy
暂无
代码示例来源:origin: crashub/crash
private static ByteArrayOutputStream read(InputStream in) throws IOException {
if (in == null) {
throw new NullPointerException();
}
ByteArrayOutputStream baos = new ByteArrayOutputStream();
copy(in, baos);
return baos;
}
代码示例来源:origin: crashub/crash
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));
}
}
}
}
代码示例来源:origin: crashub/crash
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));
}
}
}
}
代码示例来源:origin: org.crashub/crash.shell
private static ByteArrayOutputStream read(InputStream in) throws IOException {
if (in == null) {
throw new NullPointerException();
}
ByteArrayOutputStream baos = new ByteArrayOutputStream();
copy(in, baos);
return baos;
}
代码示例来源:origin: com.github.corda.crash/crash.shell
private static ByteArrayOutputStream read(InputStream in) throws IOException {
if (in == null) {
throw new NullPointerException();
}
ByteArrayOutputStream baos = new ByteArrayOutputStream();
copy(in, baos);
return baos;
}
代码示例来源:origin: org.crashub/crash.plugins.jcr.core
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 {
代码示例来源:origin: org.crashub/jcr.core
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 {
代码示例来源:origin: com.github.corda.crash/crash.shell
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));
}
}
}
}
代码示例来源:origin: org.crashub/crash.shell
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));
}
}
}
}
代码示例来源:origin: org.crashub/crash.shell
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));
}
}
}
}
代码示例来源:origin: com.github.corda.crash/crash.shell
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));
}
}
}
}
内容来源于网络,如有侵权,请联系作者删除!