Reads the output of the reader and delivers it at string.
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();
    }
770869
public function doRead()
    {
        $data = fread($this->stream, static::READ_CHUNK_SIZE);

        if ($data === '') {
            fclose($this->stream);
            $this->stream = null; //fclose() will only leave stream resource in unknown state

        } elseif ($this->isDegenerated === false) {
            $this->readBuffer .= $data;

            //For explanation read "important note" for processInputBuffer()
            //@formatter:off
            while ($this->processInputBuffer() === false);
            //@formatter:on
        }
    }
1321046
def read(self, timeout=READ_TIMEOUT, raw=False):
        '''  '''
        time.sleep(READ_SLEEP_TIME)
        raw_out = self.ser.read(self.ser.in_waiting)
        out = raw_out.decode(OUTPUT_ENCODING)

        time_waiting = 0
        while len(out) == 0 or ending_in(out.strip(OUTPUT_STRIP_CHARS), RESPONSE_END_WORDS) is None:
            time.sleep(READ_SLEEP_TIME)
            time_waiting += READ_SLEEP_TIME

            raw_out += self.ser.read(self.ser.in_waiting)
            out = raw_out.decode(OUTPUT_ENCODING)

            # TODO how to handle timeouts, if they're now unexpected?
            if time_waiting >= timeout:
                break

        if raw:
            return raw_out
        return out
885540
private static String readAll(@Nonnull final Reader reader) throws IOException {
		final StringBuilder buffer = new StringBuilder();
		int cp;
		while ((cp = reader.read()) != -1) {
			buffer.append((char) cp);
		}
		return buffer.toString();
	}
306634
public static String readerToString(Reader reader) {
		try {
			StringBuilder sb = new StringBuilder();
			char[] buf = new char[1024];
			int numRead = 0;
			while ((numRead = reader.read(buf)) != -1) {
				sb.append(buf, 0, numRead);
			}
			return sb.toString();
		} catch (Exception e) {
			throw new RuntimeException(e);
		}

	}
993511
@Override
    public int read()
        throws IOException
    {
        synchronized ( lock )
        {
            ensureOpen();
            if ( next >= length )
                return -1;
            return seq.charAt( next++ );
        }
    }
1236257
def read(self, *args, **kwargs):
        
        buf = io.BufferedReader.read(self, *args, **kwargs)
        self.increment(len(buf))
        return buf
884534
public static String getText(Reader reader) throws IOException {
    try {
      StringBuilder source = new StringBuilder();
      BufferedReader buffered = new BufferedReader(reader);
      String line = buffered.readLine();

      while (line != null) {
        source.append(line);
        source.append('\n');
        line = buffered.readLine();
      }

      return source.toString();
    } finally {
      closeQuietly(reader);
    }
  }
837086
@Override
    public int read() throws IOException {
        final StringBuilder s = read(1);
        given(s, 1, 1);
        return s.length() > 0 ? s.charAt(0) : -1;
    }
30634
public static long copy(Reader input, StringBuilder output)
            throws IOException {
        return copy(input, output, new char[DEFAULT_BUFFER_SIZE]);
    }
1057477
def output_capturing():
    """"""
    out = sys.stdout

    sys.stdout = StringIO()

    try:
        yield

    finally:
        sys.stdout = out
653421
def ReadString(self):
        
        length = self.ReadUInt8()
        return self.unpack(str(length) + 's', length)
724895
public static String readString(DataInput in) throws IOException {
    int bytes = in.readUnsignedShort();
    return readChars(in, bytes);
  }
245754
public static String readString(DataInput in) throws IOException {
    int length = readVInt(in);
    if (length == -1) return null;
    byte[] buffer = new byte[length];
    in.readFully(buffer);
    return Text.decode(buffer);
  }
118535
public static void writeToOutputStream(String s, OutputStream output, String encoding) throws IOException {
		BufferedReader reader = new BufferedReader(new StringReader(s));
		PrintStream writer;
		if (encoding != null) {
			writer = new PrintStream(output, true, encoding);
		}
		else {
			writer = new PrintStream(output, true);
		}
		String line;
		while ((line = reader.readLine()) != null) {
			writer.println(line);
		}
	}
392614
public static String readerAsString(Reader reader) {
    StringBuilder buffer = new StringBuilder();
    char[] chars = new char[16 * 1024];
    int numCharsRead;
    try {
      while ((numCharsRead = reader.read(chars, 0, chars.length)) != -1) {
        buffer.append(chars, 0, numCharsRead);
      }
      return buffer.toString();
    } catch (IOException e) {
      throw LOG.unableToReadFromReader(e);
    }
    finally {
      closeSilently(reader);
    }
  }
998224
public static String readString(DataInput in) throws IOException {
		// the length we read is offset by one, because a length of zero indicates a null value
		int len = in.readUnsignedByte();
		
		if (len == 0) {
			return null;
		}

		if (len >= HIGH_BIT) {
			int shift = 7;
			int curr;
			len = len & 0x7f;
			while ((curr = in.readUnsignedByte()) >= HIGH_BIT) {
				len |= (curr & 0x7f) << shift;
				shift += 7;
			}
			len |= curr << shift;
		}
		
		// subtract one for the null length
		len -= 1;
		
		final char[] data = new char[len];

		for (int i = 0; i < len; i++) {
			int c = in.readUnsignedByte();
			if (c < HIGH_BIT) {
				data[i] = (char) c;
			} else {
				int shift = 7;
				int curr;
				c = c & 0x7f;
				while ((curr = in.readUnsignedByte()) >= HIGH_BIT) {
					c |= (curr & 0x7f) << shift;
					shift += 7;
				}
				c |= curr << shift;
				data[i] = (char) c;
			}
		}
		
		return new String(data, 0, len);
	}