本文整理了Java中java.io.Console.writer()
方法的一些代码示例,展示了Console.writer()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Console.writer()
方法的具体详情如下:
包路径:java.io.Console
类名称:Console
方法名:writer
[英]Returns the Writer associated with this console.
[中]返回与此控制台关联的写入程序。
代码示例来源:origin: apache/ignite
/** {@inheritDoc} */
@Override public PrintWriter writer() {
return delegate.writer();
}
代码示例来源:origin: apache/nifi
@Override
public PrintWriter writer() throws ConsoleException {
return console.writer();
}
}
代码示例来源:origin: btraceio/btrace
@SuppressWarnings("DefaultCharset")
private static PrintWriter getOutWriter(Console con) {
return (con != null)? con.writer() : new PrintWriter(System.out);
}
代码示例来源:origin: stackoverflow.com
public class ConsoleDemo {
public static void main(String[] args) {
String[] data = { "\u250C\u2500\u2500\u2500\u2500\u2500\u2510",
"\u2502Hello\u2502",
"\u2514\u2500\u2500\u2500\u2500\u2500\u2518" };
for (String s : data) {
System.out.println(s);
}
for (String s : data) {
System.console().writer().println(s);
}
}
}
代码示例来源:origin: stackoverflow.com
BufferedReader in = new BufferedReader(System.console().reader());
BufferedWriter out = new PrintWriter(System.console().writer(), true);
out.println(in.readLine().toUpperCase());
代码示例来源:origin: facebook/jcommon
public IO(PrintStream out, PrintStream err, Input in, SubprocessBuilder subprocess) {
Console console = System.console();
if (console == null) {
this.out = new NoninteractiveStatusPrintStream(out);
this.err = new NoninteractiveStatusPrintStream(err);
} else {
ConsoleStatus status = new ConsoleStatus(console.writer());
this.out = new InteractiveStatusPrintStream(out, status, DEFAULT_COLORS);
this.err = new InteractiveStatusPrintStream(err, status, WHITE_ON_RED);
Runtime.getRuntime().addShutdownHook(
new Thread(
new Runnable() {
@Override
public void run() {
// reset console color and erase final status line
IO.this.out.print("");
}
}
)
);
}
this.in = in;
this.subprocess = subprocess;
}
代码示例来源:origin: org.smartdeveloperhub.harvesters.ci.util/ci-util-console
/**
* {@inheritDoc}
*/
@Override
public PrintWriter writer() {
return this.console.writer();
}
代码示例来源:origin: harbby/presto-connectors
@Override
public void printStackTrace(Throwable t) {
t.printStackTrace(console.writer());
}
}
代码示例来源:origin: net.bpelunit/util
public PrintWriter getScreen() {
if (System.console() != null && System.console().writer() != null) {
return System.console().writer();
} else {
return new PrintWriter(System.out, true);
}
}
代码示例来源:origin: stackoverflow.com
public class Test2 {
public static final String EURO = "\u20ac";
public static void main(String args[]){
System.console().writer().println(EURO);
}
}
代码示例来源:origin: stackoverflow.com
import java.io.Console;
public class TestConsole {
public static void main(String[] args) {
Console console = System.console();
System.out.println("console=" + console);
console.writer().println("hello from console");
}
}
代码示例来源:origin: stackoverflow.com
public class Test2 {
public static void main(String args[]){
String s = "caractères français : à é \u00e9"; // Unicode for "é"
System.out.println(s);
System.console().writer().println(s);
}
}
代码示例来源:origin: com.aspectran/aspectran-shell
@Override
public Writer getWriter() {
if (System.console() != null) {
return System.console().writer();
} else {
return new PrintWriter(System.out);
}
}
代码示例来源:origin: stackoverflow.com
String pattern = "AABBABA"; //or whatever
String firstChar = pattern.toString().substring(1, 2);
String[] split = pattern.split("(?!" + firstChar + ")");
for (String strng : split)
{
System.console().writer().println(strng);
}
代码示例来源:origin: stackoverflow.com
// String to be scanned to find the pattern.
String line = "AABBABA";
String pattern1 = "(A+|B+)";
Pattern r = Pattern.compile(pattern1);
Matcher m = r.matcher(line);
int count = 0;
while(m.find())
{
count++;
System.console().writer().println(m.group(0));
}
代码示例来源:origin: io.snappydata/gemfire-hydra-tests
private static void writeToConsole(String s) {
System.console().writer().write(s);
System.console().writer().flush();
System.console().flush();
}
代码示例来源:origin: anba/es6draft
@Override
public String readLine(String prompt) {
if (!prompt.isEmpty()) {
console.writer().append(prompt).flush();
}
return readLine();
}
代码示例来源:origin: stackoverflow.com
public static void main(String[] args){
promptUserForInput();
}
public static int promptUserForInput(){
Scanner in = new Scanner(System.console().reader());
PrintWriter out = System.console().writer();
out.print("Enter an integer:");
// [...]
}
代码示例来源:origin: stackoverflow.com
public static void main(String args[]) {
Console console = System.console();
BufferedReader reader = new BufferedReader(console.reader());
main2(reader, console.writer(), args);
}
static void main2(BufferedReader reader, Writer writer, String args[] {
String str = reader.readline();
System.out.println("halo"+str);
}
代码示例来源:origin: stackoverflow.com
public static void main(String[] args){
promptUserForInput(System.console());
}
public static int promptUserForInput(Console io){
Scanner in = new Scanner(io.reader());
PrintWriter out = io.writer();
out.print("Enter an integer:");
// [...]
}
内容来源于网络,如有侵权,请联系作者删除!