本文整理了Java中java.io.InputStream.transferTo()
方法的一些代码示例,展示了InputStream.transferTo()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。InputStream.transferTo()
方法的具体详情如下:
包路径:java.io.InputStream
类名称:InputStream
方法名:transferTo
暂无
代码示例来源:origin: net.dongliu/xhttp-json-api
@Override
public long transferTo(OutputStream out) throws IOException {
return super.transferTo(out);
}
代码示例来源:origin: net.dongliu/xhttp
/**
* Write response body to file
*/
public Response<Path> writeTo(Path path) {
return handle((charset, ri) -> {
try (var out = Files.newOutputStream(path)) {
ri.body().transferTo(out);
}
return null;
});
}
代码示例来源:origin: net.dongliu/xhttp
/**
* Write response body to OutputStream. OutputStream will not be closed.
*/
public Response<Void> writeTo(OutputStream out) {
return handle((charset, ri) -> {
ri.body().transferTo(out);
return null;
});
}
代码示例来源:origin: org.sejda/sejda-commons
/**
* @param input
* @return the content of the input stream as a byte[]
* @throws IOException
*/
public static byte[] toByteArray(InputStream input) throws IOException {
FastByteArrayOutputStream output = new FastByteArrayOutputStream();
input.transferTo(output);
return output.toByteArray();
}
代码示例来源:origin: apache/sis
/**
* Copies the content of the specified binary file to the specified output stream.
*
* @param file the regular file to copy inside the ZIP file.
* @param bundle the ZIP file where to copy the given regular file.
*/
private static void copy(final File file, final ZipOutputStream bundle) throws IOException {
final String name = file.getName();
final ZipEntry entry = new ZipEntry(name);
if (name.endsWith(".png")) {
final long size = file.length();
entry.setMethod(ZipOutputStream.STORED);
entry.setSize(size);
entry.setCompressedSize(size);
entry.setCrc(getCRC32(file));
}
bundle.putNextEntry(entry);
try (InputStream in = new FileInputStream(file)) {
in.transferTo(bundle);
}
bundle.closeEntry();
}
代码示例来源:origin: apache/sis
if (!name.startsWith(NATIVE_DIRECTORY)) {
out.putNextEntry(new ZipEntry(name));
eis.transferTo(out); // Copy the entry verbatim.
out.closeEntry();
} else if (!entry.isDirectory()) {
代码示例来源:origin: apache/sis
inStream.transferTo(out);
out.closeEntry();
代码示例来源:origin: com.io7m.minisite/com.io7m.minisite.maven_plugin
try (final InputStream in =
MinSite.class.getResourceAsStream("minisite.css")) {
in.transferTo(out);
内容来源于网络,如有侵权,请联系作者删除!