流轉成字節

private static byte[] streamToBytes(InputStream is){
        	ByteArrayOutputStream os = new ByteArrayOutputStream(1024);
        	byte[] buffer = new byte[1024];
        	int len;
        	try {
				while((len = is.read(buffer)) >=0){
					os.write(buffer,0,len);
				}
			} catch (IOException e) {
				e.printStackTrace();
			}
        	return os.toByteArray();
        }
相關文章
相關標籤/搜索