StreamStook.javamy(zhou)
来源:互联网 发布:怎么使用办公软件 编辑:程序博客网 时间:2024/06/04 01:38
package com.example.my;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.AsyncTask;
import android.widget.ImageView;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
/**
* Created by dell on 2017/7/18.
*/
public class StreamStook {
public static String read(InputStream is) throws Exception {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
byte[] bytes = new byte[1024];
int len = 0;
while ((len = is.read(bytes)) != -1) {
byteArrayOutputStream.write(bytes, 0, len);
}
byteArrayOutputStream.close();
return byteArrayOutputStream.toString();
}
}
//
//
//
//
//
//
//
//
//
//
// private void Loadimages(String path, final ImageView imageitem2) {
// new AsyncTask<String, Void, Bitmap>() {
// @Override
// protected void onPostExecute(Bitmap bitmap) {
// super.onPostExecute(bitmap);
// if (bitmap != null) {
// imageitem2.setImageBitmap(bitmap);
//
// }
//
//
// }
//
// @Override
// protected Bitmap doInBackground(String... params) {
// try {
// String path = params[0];
// URL url = new URL(path);
// HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
// urlConnection.setRequestMethod("GET");
// urlConnection.setConnectTimeout(2000);
// urlConnection.setReadTimeout(2000);
// int code = urlConnection.getResponseCode();
// if (code == 200) {
// InputStream inputStream = urlConnection.getInputStream();
// Bitmap bitmap = BitmapFactory.decodeStream(inputStream);
// return bitmap;
//
// }
//
// } catch (Exception e) {
// e.printStackTrace();
// }
//
//
// return null;
// }
// }.execute(path);
//
//
// }
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.os.AsyncTask;
import android.widget.ImageView;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
import java.net.HttpURLConnection;
import java.net.URL;
/**
* Created by dell on 2017/7/18.
*/
public class StreamStook {
public static String read(InputStream is) throws Exception {
ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
byte[] bytes = new byte[1024];
int len = 0;
while ((len = is.read(bytes)) != -1) {
byteArrayOutputStream.write(bytes, 0, len);
}
byteArrayOutputStream.close();
return byteArrayOutputStream.toString();
}
}
//
//
//
//
//
//
//
//
//
//
// private void Loadimages(String path, final ImageView imageitem2) {
// new AsyncTask<String, Void, Bitmap>() {
// @Override
// protected void onPostExecute(Bitmap bitmap) {
// super.onPostExecute(bitmap);
// if (bitmap != null) {
// imageitem2.setImageBitmap(bitmap);
//
// }
//
//
// }
//
// @Override
// protected Bitmap doInBackground(String... params) {
// try {
// String path = params[0];
// URL url = new URL(path);
// HttpURLConnection urlConnection = (HttpURLConnection) url.openConnection();
// urlConnection.setRequestMethod("GET");
// urlConnection.setConnectTimeout(2000);
// urlConnection.setReadTimeout(2000);
// int code = urlConnection.getResponseCode();
// if (code == 200) {
// InputStream inputStream = urlConnection.getInputStream();
// Bitmap bitmap = BitmapFactory.decodeStream(inputStream);
// return bitmap;
//
// }
//
// } catch (Exception e) {
// e.printStackTrace();
// }
//
//
// return null;
// }
// }.execute(path);
//
//
// }
阅读全文
0 0
- StreamStook.javamy(zhou)
- bu shang zhou de
- HOJ 2989 Zhou Yi & HOJ 3015 Zhou Yi II
- ML书单推荐_ZY.Zhou
- hdu 4740 The Donkey of Gui Zhou
- hdu 4740 The Donkey of Gui Zhou
- Hdu 4740 The Donkey of Gui Zhou
- hdu 4740 The Donkey of Gui Zhou
- Chinese State Media Praise Zhou Corruption Probe
- HDU 4740 The Donkey of Gui Zhou
- hdu4740The Donkey of Gui Zhou dfs水题
- Zhi-Hua Zhou点评AI领域会议
- HDU 4740 The Donkey of Gui Zhou
- 高兴,高兴-再遇最佩服的同龄人,zHoU LeI
- HDU 4740 The Donkey of Gui Zhou (模拟)
- hdu 4740—€—The Donkey of Gui Zhou
- HDOJ 4740 - The Donkey of Gui Zhou 模拟
- HDU 4740 The Donkey of Gui Zhou(模拟)
- C 语言的运算符优先级表
- .NET安装失败解决方案(0x800F0906错误)
- java 解析复杂的json字符串
- 【洛谷3047】[USACO12FEB]附近的牛Nearby Cows
- Linux 网卡驱动学习(五)(收发包具体过程)
- StreamStook.javamy(zhou)
- 百练OJ:2767:简单密码
- 微信小程序开发相关记录(2017.07.23)
- Python3中的input函数
- NYU-Depth数据集
- noip模拟赛 bzoj2236体检
- 基于PCA实现人脸识别
- imx6q gpio中断
- spark源码编译