Back to project page bt-android-utils.
The source code is released under:
Copyright (c) 2011 Brian J. Tarricone <brian@tarricone.org> All rights reserved. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the follo...
If you think the Android project bt-android-utils listed in this page is inappropriate, such as containing malicious code/tools or violating the copyright, please email info at java2s dot com, thanks.
package org.spurint.android.helpers; /* w w w . j a v a2 s . c om*/ import java.io.InputStream; import java.io.InputStreamReader; import java.io.Reader; public abstract class StringHelper { public static String stringFromInputStream(InputStream is) { final char[] buffer = new char[1024]; StringBuilder out = new StringBuilder(); try { Reader in = new InputStreamReader(is, "UTF-8"); int bin; do { bin = in.read(buffer); if (bin > 0) { out.append(buffer, 0, bin); } } while (bin >= 0); } catch (Exception e) { return null; } return out.toString(); } }