Skip to content
Browse files

Fix WriterOutputStream.print bug

  • Loading branch information...
1 parent 757a05e commit 859ec6d6eab90e73a8abe8603848ea507e9d0f86 @stuartwdouglas stuartwdouglas committed with
Showing with 5 additions and 1 deletion.
  1. +5 −1 src/main/java/org/jboss/stdio/WriterOutputStream.java
View
6 src/main/java/org/jboss/stdio/WriterOutputStream.java
@@ -91,16 +91,20 @@ public WriterOutputStream(final Writer writer, final CharsetDecoder decoder) {
public void write(final int b) throws IOException {
synchronized (decoder) {
final ByteBuffer inputBuffer = this.inputBuffer;
- inputBuffer.put((byte) b);
+
if (! inputBuffer.hasRemaining()) {
finish();
}
+ inputBuffer.put((byte) b);
}
}
/** {@inheritDoc} */
public void write(final byte[] b, int off, int len) throws IOException {
synchronized (decoder) {
+ if (! inputBuffer.hasRemaining()) {
+ finish();
+ }
for (;;) {
final ByteBuffer inputBuffer = this.inputBuffer;
final int rem = inputBuffer.remaining();

0 comments on commit 859ec6d

Please sign in to comment.
Something went wrong with that request. Please try again.