class BeamSqlLine {

  @SuppressWarnings("argument.type.incompatible")
  static Status runSqlLine(
      String[] args,
      @Nullable InputStream inputStream,
      @Nullable OutputStream outputStream,
      @Nullable OutputStream errorStream)
      throws IOException {
    String[] modifiedArgs = checkConnectionArgs(args);
    SqlLine sqlLine = new SqlLine();

    if (outputStream != null) {
      sqlLine.setOutputStream(new PrintStream(outputStream, false, Charsets.UTF_8.name()));
    }

    if (errorStream != null) {
      sqlLine.setErrorStream(new PrintStream(errorStream, false, Charsets.UTF_8.name()));
    }

    return sqlLine.begin(modifiedArgs, inputStream, true);
  }

}