List of utility methods to do InputStream Read
String | dealResponseResult(InputStream in) deal Response Result try { BufferedReader reader = new BufferedReader( new InputStreamReader(in, CHARSET)); StringBuilder sb = new StringBuilder(); String msg = null; while ((msg = reader.readLine()) != null) { sb.append(msg); return sb.toString(); } catch (Exception e) { throw new RuntimeException(e); } finally { try { if (in != null) { in.close(); } catch (IOException e) { throw new RuntimeException(e); |
InputStream | getInputStreamFromUrl_V9( Context paramContext, String paramString) get Input Stream From UrV if (confirmDownload(paramContext, paramString)) { try { URL localURL = new URL(paramString); HttpURLConnection localHttpURLConnection2 = (HttpURLConnection) localURL .openConnection(); localHttpURLConnection2.setRequestProperty( "Accept-Charset", "UTF-8"); localHttpURLConnection2.setReadTimeout(30000); ... |
String | getResponseBody(InputStream inputStream) static utility class to get response String from InputStream String responseString = ""; try { BufferedReader in = new BufferedReader(new InputStreamReader( inputStream)); String myString = ""; while ((myString = in.readLine()) != null) responseString += myString; in.close(); ... |
ParcelFileDescriptor | makeInputStream(Uri uri, ContentResolver cr) make Input Stream try { return cr.openFileDescriptor(uri, "r"); } catch (IOException ex) { return null; |
boolean | outputFile(InputStream is, String targetPath, String filename) out put a file from a InputStream to path and the out file is named as filename. if (is == null || targetPath.equals("") || targetPath == null || filename.equals("") || filename == null) { return false; try { checkDirectory(targetPath); doOutputFile(is, targetPath + filename); is.close(); ... |