获得一个带缓存的写入对象

@param isAppend 是否追加
@return BufferedReader对象
@throws IORuntimeException IO异常
519563
public BufferedWriter getWriter(boolean isAppend) throws IORuntimeException {
		try {
			return new BufferedWriter(new OutputStreamWriter(new FileOutputStream(FileUtil.touch(file), isAppend), charset));
		} catch (Exception e) {
			throw new IORuntimeException(e);
		}
	}
610776
public static BufferedReader getReader(String path, Charset charset) throws IORuntimeException {
		return getReader(file(path), charset);
	}
552499
public static String read(InputStream in, String charsetName) throws IORuntimeException {
		FastByteArrayOutputStream out = read(in);
		return StrUtil.isBlank(charsetName) ? out.toString() : out.toString(charsetName);
	}
405859
@Override
	public String readStr(Charset charset) throws IORuntimeException{
		BufferedReader reader = null;
		try {
			reader = getReader(charset);
			return IoUtil.read(reader);
		} finally {
			IoUtil.close(reader);
		}
	}
627143
public void initFromBackup(InputStream is) throws IOException {
    int count = 0;
    try (GzipCompressorInputStream gzIn = new GzipCompressorInputStream(is);
         JournalEntryStreamReader reader = new JournalEntryStreamReader(gzIn)) {
      List<Master> masters = mRegistry.getServers();
      JournalEntry entry;
      Map<String, Master> mastersByName = Maps.uniqueIndex(masters, Master::getName);
      while ((entry = reader.readEntry()) != null) {
        String masterName = JournalEntryAssociation.getMasterForEntry(entry);
        Master master = mastersByName.get(masterName);
        try {
          master.processJournalEntry(entry);
        } catch (Throwable t) {
          JournalUtils.handleJournalReplayFailure(
              LOG, t, "Failed to process journal entry %s when init from backup", entry);
        }
        try (JournalContext jc = master.createJournalContext()) {
          jc.append(entry);
          count++;
        }
      }
    }
    LOG.info("Restored {} entries from backup", count);
  }
697122
private void getConnInput() throws IOException
  {
    if (_didGet)
      return;

    try {
      getConnInputImpl();
    } catch (IOException e) {
      _isKeepalive = false;
      throw e;
    } catch (RuntimeException e) {
      _isKeepalive = false;
      throw e;
    }
  }
642295
public static PrintWriter getPrintWriter(String path, String charset, boolean isAppend) throws IORuntimeException {
		return new PrintWriter(getWriter(path, charset, isAppend));
	}
1164480
@Override
  public <T extends BinaryReadHandle> T read(String uri, T contentHandle, long start, long length) {
    return read(uri, null, contentHandle, null, start, length, null);
  }
1335058
public static <T> File writeLines(Collection<T> list, File file, String charset, boolean isAppend) throws IORuntimeException {
		return FileWriter.create(file, CharsetUtil.charset(charset)).writeLines(list, isAppend);
	}
794666
public static BufferedWriter getWriter(File file, Charset charset, boolean isAppend) throws IORuntimeException {
		return FileWriter.create(file, charset).getWriter(isAppend);
	}
953647
@Override
  public final boolean readUntilStart(final Reader pReader,
    final String pElement) throws Exception {
    StringBuffer sb = new StringBuffer();
    int chi;
    boolean isLtOccured = false;
    while ((chi = pReader.read()) != -1) {
      char ch = (char) chi;
      if (isLtOccured) {
        if (ch ==  '>' || ch == '\n' || ch == '\\' || ch == '"' || ch == '\r'
          || ch == '\t') {
          isLtOccured = false;
          sb.delete(0, sb.length());
          continue;
        }
        sb.append(ch);
        String readedStr = sb.toString();
        if (readedStr.length() > pElement.length()) {
          isLtOccured = false;
          sb.delete(0, sb.length());
          continue;
        }
        if (pElement.equals(readedStr)) {
          return true;
        }
      } else if (ch == '<') {
        isLtOccured = true;
      }
    }
    return false;
  }
967575
public static RuntimeException getRuntimeException(final Throwable exc) {
        Throwable e = exc;
        while (e.getCause() instanceof RuntimeException) {
            e = e.getCause();
        }
        if (e instanceof RuntimeException) {
            return (RuntimeException) e;
        } else {
            return new RuntimeException(exc);
        }
    }
1371032
@Override
    public E peek() {
        E el;

        while (((el = super.peek()) == null) && !isDone()) {
            synchronized (this) {
                try {
                    wait();
                } catch (InterruptedException e) {
                    String s = "Reader has been interrupted maybe the connection is closed";
                    throw new RuntimeException(s);
                }
            }
        }

        if ((el == null) && isDone()) {
            String s = "Reader has been interrupted maybe the connection is closed";
            throw new RuntimeException(s);
        }

        return el;
    }
1336843
private final State onPayload(final Buffer buffer) {
        if (contentLength == 0) {
            return State.DONE;
        }

        if (buffer.getReadableBytes() >= contentLength) {
            try {
                payload = buffer.readBytes(contentLength);
            } catch (final IOException e) {
                throw new RuntimeException("Unable to read from stream due to IOException", e);
            }
            return State.DONE;
        }

        return State.GET_PAYLOAD;
    }
5948
public static BufferedWriter getWriter(String path, Charset charset, boolean isAppend) throws IORuntimeException {
		return getWriter(touch(path), charset, isAppend);
	}
1218686
private BufferedReader getBulkBufferedReader(int index) throws AsyncApiException {
    return new BufferedReader(new InputStreamReader(
        this.bulkConnection.getQueryResultStream(this.bulkJob.getId(), this.bulkResultIdList.get(index).getBatchId(),
            this.bulkResultIdList.get(index).getResultId()), ConfigurationKeys.DEFAULT_CHARSET_ENCODING));
  }
959762
private static long asciidump(InputStream is, PrintWriter pw) throws Exception
   {
      byte[] buffer = new byte[BUFFER_SIZE];
      long byteCount = 0;

      char c;
      int loop;
      int count;
      StringBuilder sb = new StringBuilder();

      while (true)
      {
         count = is.read(buffer);
         if (count == -1)
         {
            break;
         }

         byteCount += count;

         sb.setLength(0);
         for (loop = 0; loop < count; loop++)
         {
            c = (char) buffer[loop];
            if (c > 200 || c < 27)
            {
               c = ' ';
            }

            sb.append(c);
         }

         pw.print(sb.toString());
      }

      return (byteCount);
   }