2021-06-26 01:13:46 +00:00
|
|
|
package the.bytecode.club.bytecodeviewer.gui.components;
|
2021-06-22 00:46:57 +00:00
|
|
|
|
|
|
|
import javax.swing.*;
|
|
|
|
import java.io.IOException;
|
|
|
|
import java.io.OutputStream;
|
|
|
|
|
|
|
|
/**
|
|
|
|
* @author Konloch
|
|
|
|
* @since 6/21/2021
|
|
|
|
*/
|
|
|
|
public class JTextAreaOutputStream extends OutputStream
|
|
|
|
{
|
|
|
|
private final StringBuilder sb = new StringBuilder();
|
|
|
|
private final JTextArea textArea;
|
|
|
|
|
|
|
|
public JTextAreaOutputStream(JTextArea textArea)
|
|
|
|
{
|
|
|
|
this.textArea = textArea;
|
|
|
|
}
|
|
|
|
|
|
|
|
public void update()
|
|
|
|
{
|
|
|
|
textArea.append(sb.toString());
|
|
|
|
}
|
|
|
|
|
|
|
|
@Override
|
|
|
|
public void write(int b) throws IOException
|
|
|
|
{
|
|
|
|
sb.append((char) b);
|
|
|
|
}
|
|
|
|
}
|