InputStream is ;

ByteArrayOutputStream baos = new ByteArrayOutputStream();

byte[] b = new byte[1024];

int len = 0;

while((len = is.read(b)) != -1) {

baos.write(b,o,len);

}

baos.toByteArray();

java io InputStream 转 byte的更多相关文章

  1. 【java】io流之字节输入流:java.io.InputStream类及子类java.io.FileInputStream

    package 文件操作; import java.io.File; import java.io.FileInputStream; import java.io.IOException; impor ...

  2. struts2文件下载 出现Can not find a java.io.InputStream with the name的错误

    成功代码: 前台界面jsp: <a style="text-decoration:none;" href="<%=path %>/main/frontN ...

  3. struts2文件下载出现Can not find a java.io.InputStream with the name的错误

    今天在用struts2就行文件下载时出现如下错误: Servlet.service() for servlet default threw exception java.lang.IllegalArg ...

  4. Error: Default interface methods are only supported starting with Android N (--min-api 24): java.io.InputStream org.apache.poi.sl.usermodel.ObjectShape.readObjectData()

    项目运行的时候,如果报错 Error: Default interface methods are only supported starting with Android N (--min-api ...

  5. Can not find a java.io.InputStream with the name [downloadFile] in the invocation stack.

    1.错误描写叙述 八月 14, 2015 4:22:45 下午 com.opensymphony.xwork2.util.logging.jdk.JdkLogger error 严重: Excepti ...

  6. 关于Java IO InputStream 的一点整理!

    程序的开发其中一直在用文件的读写.可是对于java其中输入流以及输出流仅仅是会用不理解,一直以来想搞清楚其,可是一直没有运行(悲剧).今天早上抽出半个小时通过JDK API1.6.0中文版帮助逐步的了 ...

  7. 基于java的InputStream.read(byte[] b,int off,int len)算法学习

    public int read(byte[] b, int off, int len) throws IOException 将输入流中最多 len 个数据字节读入字节数组.尝试读取多达 len 字节 ...

  8. java IO文件读写例子(OutputStream,InputStream,Writer,Reader)

    一,File创建文件 File file = new File("D:" + File.separator + "yi.txt"); 代码示例: package ...

  9. ava.io.InputStream & java.io.FileInputStream

    java.io.InputStream & java.io.FileInputStream java.io.InputStream,这个抽象类是表示字节输入流的超类,这个抽象类的共性的方法有: ...

随机推荐

  1. 026. asp.net中将图片以二进制方式保存到数据库并以HTTP流方式输出

    保存到数据库中 protected void imgbtnCreate_Click(object sender, ImageClickEventArgs e) { string PerHomeName ...

  2. Zend 安装 OpenExplorer插件

    转自:http://blog.csdn.net/binyao02123202/article/details/8954249 OpenExplorer是一款打开导进来的项目文件或文件夹所在磁盘的位置的 ...

  3. 虚拟化之vmware-vsphere (web) client

    两种客户端 vsphere client 配置>软件>高级设置里的变量 uservars.supressshellwarning=1 vsphere web client 安装完vSphe ...

  4. xunsearch安装配置

    1.wget http://www.xunsearch.com/download/xunsearch-full-latest.tar.bz2 2.tar -xjf xunsearch-full-lat ...

  5. css之opacity

    设置div元素的不透明级别 语法: value :从0.0(完全透明)到1.0(完全不透明) inherit:应该从父元素继承opacity属性 z-index 属性设置元素的堆叠顺序,仅能在定位元素 ...

  6. jsp常用指令

    Jsp包含三个编译指令和七个动作指令. 三个编译指令为:page.include.taglib. 七个动作指令为:jsp:forward.jsp:param.jsp:include.jsp:plugi ...

  7. DB2 组内分组排序,游标使用

    CREATE PROCEDURE Sys_Init_tblaccountsuser_sortid () P1: BEGIN '; ; ; ; DECLARE CUR1 CURSOR WITH RETU ...

  8. LintCode "Continuous Subarray Sum"

    A variation to a classical DP: LCS. class Solution { public: /** * @param A an integer array * @retu ...

  9. jQuery实现登录提示

    实现效果:将鼠标聚焦到邮箱地址文本框时,文本框 内的"请输入邮箱地址"文字将被清除:   若没有输入任何内容,鼠标移除后邮箱地址文本框被还原. <!DOCTYPE html& ...

  10. CSS设置DIV背景色渐变显示

    本文转载自:http://blog.csdn.net/gingerredjade/article/details/12191741 <style type="text/css" ...