-
Notifications
You must be signed in to change notification settings - Fork 220
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Extract common parts to AbstractWindowsConsoleWriter
- Loading branch information
1 parent
96c5e0f
commit 4344091
Showing
3 changed files
with
45 additions
and
34 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
terminal/src/main/java/org/jline/terminal/impl/AbstractWindowsConsoleWriter.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
/* | ||
* Copyright (c) 2002-2017, the original author or authors. | ||
* | ||
* This software is distributable under the BSD license. See the terms of the | ||
* BSD license in the documentation provided with this software. | ||
* | ||
* http://www.opensource.org/licenses/bsd-license.php | ||
*/ | ||
package org.jline.terminal.impl; | ||
|
||
import java.io.IOException; | ||
import java.io.Writer; | ||
|
||
public abstract class AbstractWindowsConsoleWriter extends Writer { | ||
|
||
protected abstract void writeConsole(char[] text, int len) throws IOException; | ||
|
||
@Override | ||
public void write(char[] cbuf, int off, int len) throws IOException { | ||
char[] text = cbuf; | ||
if (off != 0) { | ||
text = new char[len]; | ||
System.arraycopy(cbuf, off, text, 0, len); | ||
} | ||
|
||
synchronized (this.lock) { | ||
writeConsole(text, len); | ||
} | ||
} | ||
|
||
@Override | ||
public void flush() { | ||
} | ||
|
||
@Override | ||
public void close() { | ||
} | ||
|
||
} |