All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.github.tonivade.purefun.instances.SystemConsole Maven / Gradle / Ivy

/*
 * Copyright (c) 2018-2020, Antonio Gabriel Muñoz Conejo 
 * Distributed under the terms of the MIT License
 */
package com.github.tonivade.purefun.instances;

import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.io.PrintStream;
import java.io.PrintWriter;
import java.io.UncheckedIOException;

final class SystemConsole {
  
  protected void println(String message) {
    writer(System.out).println(message);
  }

  protected String readln() {
    try {
      return reader(System.in).readLine();
    } catch (IOException e) {
      throw new UncheckedIOException(e);
    }
  }

  private static BufferedReader reader(InputStream stream) {
    return new BufferedReader(new InputStreamReader(stream));
  }

  private static PrintWriter writer(PrintStream stream) {
    return new PrintWriter(stream, true);
  }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy