Read InputStream with BufferedReader : Buffer « File « Android

Read InputStream with BufferedReader

 *     This file is part of QueueMan.
 *    QueueMan is free software: you can redistribute it and/or modify
 *    it under the terms of the GNU General Public License as published by
 *    the Free Software Foundation, either version 3 of the License, or
 *    any later version.
 *    QueueMan is distributed in the hope that it will be useful,
 *    but WITHOUT ANY WARRANTY; without even the implied warranty of
 *    GNU General Public License for more details.
 *    You should have received a copy of the GNU General Public License
 *    along with QueueMan.  If not, see <>.
//package edwardawebb.queueman.classes;


 * @author Eddie
class Utils {

      public static String convertStreamToString(InputStream is) throws IOException {
           * To convert the InputStream to String we use the BufferedReader.readLine()
           * method. We iterate until the BufferedReader return null which means
           * there's no more data to read. Each line will appended to a StringBuilder
           * and returned as String.
          if (is != null) {
              StringBuilder sb = new StringBuilder();
              String line;

              try {
                  BufferedReader reader = new BufferedReader(new InputStreamReader(is, "UTF-8"));
                  while ((line = reader.readLine()) != null) {
              } finally {
              return sb.toString();
          } else {        
              return "";



Related examples in the same category

1.Fast Float Buffer
2.Demonstrate the Frame Buffer Object OpenGL ES extension.
3.Loads a file to a ByteBuffer.
4.Make a direct NIO FloatBuffer from an array of floats
5.Make a direct NIO ByteBuffer from an array of bytes
6.Make Float Buffer From Array
7.Creates a floatbuffer of the given size.
8.Make Float Buffer with ByteBuffer.allocateDirect
9.allocate Float Buffer Short Buffer Float Buffer Position Zero
12.allocate Short Buffer
13.allocate Int Buffer
14.To convert the InputStream to String we use the BufferedReader.readLine() method.
15.make Float Buffer
16.get Buffer From Array
17.Your own float buffer
18.Direct Buffer
19.create Buffer
20.Write String to File with BufferWriter
21.Byte Buffer Stack
22.Compute the SHA-1 hash of the bytes in the given buffer
23.An utility class for java.nio.Buffers