Constructs a String by reading the characters from the Reader
@param reader Reader to read from
@return String containing the message
@throws IOException in case of read failure
198777
private String convertToString(Reader reader) throws IOException {
        StringBuilder stringBuilder = new StringBuilder();
        int numChars;
        char[] chars = new char[50];
        do {
            numChars = reader.read(chars, 0, chars.length);
            if (numChars > 0) {
                stringBuilder.append(chars, 0, numChars);
            }
        } while (numChars != -1);

        return stringBuilder.toString();
    }
674615
public static List<String> readLines(Reader reader) throws IOException {
        IteratorClosureAdapter<String> closure = new IteratorClosureAdapter<String>(reader);
        eachLine(reader, closure);
        return closure.asList();
    }
499696
public static String copyToString(Reader in) throws IOException {
        StringWriter out = new StringWriter();
        copy(in, out);
        return out.toString();
    }
113100
def decode_string(reader) -> bytes:
    
    length_bytes = yield from read_or_raise(reader, 2)
    str_length = unpack("!H", length_bytes)
    if str_length[0]:
        byte_str = yield from read_or_raise(reader, str_length[0])
        try:
            return byte_str.decode(encoding='utf-8')
        except:
            return str(byte_str)
    else:
        return ''
478516
public static String readTextStream(Reader reader) throws IOException
    {
        char[] buffer=new char[5000];
        Writer stringWriter=new StringWriter();
        int read=-1;
        try
        {
            do
            {
                //read next buffer
                read=reader.read(buffer);
                
                if(read!=-1)
                {
                    //write to string writer
                    stringWriter.write(buffer,0,read);
                }
            }while(read!=-1);
        }
        finally
        {
            //close streams
            IOHelper.closeResource(reader);
        }
        
        //get text
        String text=stringWriter.toString();
        
        return text;
    }
1184585
public final boolean fill(CharacterBuffer buffer, Reader reader) throws IOException {
    return fill(buffer, reader, buffer.buffer.length);
  }
514417
public static String readOutput(BufferedReader in) throws IOException {
        StringBuffer output = new StringBuffer();
        String line = "";
        while ((line = in.readLine()) != null) {
            output.append(line);
            output.append("\n");
        }
        return output.toString();
    }
1137276
public String readString() throws IOException {
		StringBuilder result = new StringBuilder();
		while (true) {
			int c = r.read();
			if (c < 0) {
				throw new IllegalStateException("Premature end of stream");
			} else if (c == '"') {
				break;
			} else if (c == '\\') {
				int c2 = r.read();
				if (c2 == '"' || c2 == '\\' || c2 == '/') {
					result.append((char)c2);
				} else if (c2 == 'b') {
					result.append("\b");
				} else if (c2 == 'f') {
					result.append("\f");
				} else if (c2 == 'n') {
					result.append("\n");
				} else if (c2 == 'r') {
					result.append("\r");
				} else if (c2 == 't') {
					result.append("\t");
				} else if (c2 == 'u') {
					int d1 = r.read();
					int d2 = r.read();
					int d3 = r.read();
					int d4 = r.read();
					checkHexDigit(d1);
					checkHexDigit(d2);
					checkHexDigit(d3);
					checkHexDigit(d4);
					int e = Character.digit(d1, 16);
					e = (e << 4) + Character.digit(d2, 16);
					e = (e << 4) + Character.digit(d3, 16);
					e = (e << 4) + Character.digit(d4, 16);
					result.append((char)e);
				}
			} else {
				result.append((char)c);
			}
		}
		return result.toString();
	}
538365
public <V> V convertFrom(final JsonReader reader) {
        if (reader == null) return null;
        return (V) new AnyDecoder(factory).convertFrom(reader);
    }
1135194
private static String convertStreamToString(InputStream inputStream)
        throws IOException {
        if (inputStream == null) {
            return "";
        } else {
            StringBuilder stringBuilder = new StringBuilder();
            String line;
            try {
                BufferedReader reader =
                    new BufferedReader(new InputStreamReader(inputStream,
                                                             StringUtils.UTF8));
                while ((line = reader.readLine()) != null) {
                    stringBuilder.append(line);
                }
            } finally {
                inputStream.close();
            }
            return stringBuilder.toString();
        }
    }
227410
private static String readStreamIntoString(Reader reader) throws IOException
   {
      StringBuilder s = new StringBuilder();
      char a[] = new char[0x10000];
      while (true)
      {
         int l = reader.read(a);
         if (l == -1)
            break;
         if (l <= 0)
            throw new IOException();
         s.append(a, 0, l);
      }
      return s.toString();
   }
647408
public static String getContent(Reader in) throws IOException {
    try {
      StringWriter sw = new StringWriter();
      copy(in, sw);
      return sw.toString();
    }
    finally {
      in.close();
    }
  }
521952
public static Set<String> readStopwords(BufferedReader reader) throws IOException {
    HashSet<String> words = new HashSet<String>();
    String nextLine;
    while (((nextLine = reader.readLine()) != null)) {
      words.add(nextLine.trim().toLowerCase());
    }
    return words;
  }
165338
@JSFunction
    public String readChar() throws IOException {
        int i = getReader().read();
        if (i == -1)
            return null;
        char[] charArray = { (char) i };
        return new String(charArray);
    }
191898
private static String readLineFromReaderWithMark(final Reader input)
            throws IOException {
        char[] cbuf = new char[charBufferSize];
        try {
            input.mark(charBufferSize);
        } catch (IOException e) {
            // this should never happen
            LOG.warning("Caught exception setting mark on supporting reader: " + e);
            // fallback
            return readLineFromReaderWithoutMark(input);
        }

        // could be changed into do..while, but then
        // we might create an additional StringBuilder
        // instance at the end of the stream
        int count = input.read(cbuf);
        if (count == EOF) // we are at the end of the input data
            return null;

        StringBuilder line = new StringBuilder(expectedLineLength);
        // now work on the buffer(s)
        int ls = lineSeparatorIndex(cbuf, count);
        while (ls == -1) {
            line.append(cbuf, 0, count);
            count = input.read(cbuf);
            if (count == EOF) {
                // we are at the end of the input data
                return line.toString();
            }
            ls = lineSeparatorIndex(cbuf, count);
        }
        line.append(cbuf, 0, ls);

        // correct ls if we have \r\n
        int skipLS = 1;
        if (ls + 1 < count) {
            // we are not at the end of the buffer
            if (cbuf[ls] == '\r' && cbuf[ls + 1] == '\n') {
                skipLS++;
            }
        } else {
            if (cbuf[ls] == '\r' && input.read() == '\n') {
                skipLS++;
            }
        }

        //reset() and skip over last linesep
        input.reset();
        input.skip(line.length() + skipLS);
        return line.toString();
    }
343722
public static void copyReader(OutputStream outs, Reader reader) throws IOException
   {
      try
      {
         OutputStreamWriter writer = new OutputStreamWriter(outs, StandardCharsets.UTF_8);
         char[] bytes = new char[1024];
         int r = reader.read(bytes);
         while (r > 0)
         {
            writer.write(bytes, 0, r);
            r = reader.read(bytes);
         }
      }
      catch (IOException e)
      {
         throw e;
      }
      finally{
         reader.close();
      }
   }
613373
public JsonReader createReader(Reader reader) {
        return new JsonReader(reader, jsonObjectFactory, jsonArrayFactory, objectMapper, typeAdapters);
    }