public static BufferedWriter openBufferedWriter()

in src/main/java/org/apache/datasketches/Files.java [946:959]


  public static BufferedWriter openBufferedWriter(final File file, final int bufSize,
      final boolean append, final Charset charset) {
    final int bufSz = bufSize < DEFAULT_BUFSIZE ? DEFAULT_BUFSIZE : bufSize;
    BufferedWriter out = null; // default bufsize is 8192.
    try {
      final FileOutputStream fos = new FileOutputStream(file, append);
      final OutputStreamWriter osw = new OutputStreamWriter(fos, charset);
      out = new BufferedWriter(osw, bufSz);
    } catch (final IOException e) {
      // never opened, so don't close it.
      throw new RuntimeException(LS + "Could not create: " + file.getPath() + LS + e);
    }
    return out;
  }