Android开发中常用到方法总结 第5页

return appList;

}

16.将流转成字节数组

public byte[] stream2Bytes(InputStream is) throws IOException {

byte[] mByte;

ByteArrayOutputStream baos = new ByteArrayOutputStream();

byte[] buffer = new byte[1024];

int length = 0;

while ((length = is.read(buffer, 0, 1024)) != -1) {

baos.write(buffer, 0, length);

}

baos.flush();

mByte = baos.toByteArray();

baos.close();

return mByte;

}

上一页  [1] [2] [3] [4] [5] 

Copyright © 2007-2012 www.chuibin.com 六维论文网 版权所有