home *** CD-ROM | disk | FTP | other *** search
- package java.io;
-
- public class PipedWriter extends Writer {
- PipedOutputStream byteSource;
- private byte[] buf;
-
- public PipedWriter() {
- this.byteSource = new PipedOutputStream();
- }
-
- public PipedWriter(PipedReader var1) throws IOException {
- this();
- this.connect(var1);
- }
-
- private void ensureOpen() throws IOException {
- if (this.byteSource == null) {
- throw new IOException("Stream closed");
- }
- }
-
- public void connect(PipedReader var1) throws IOException {
- Object var2 = super.lock;
- synchronized(var2){}
-
- try {
- this.ensureOpen();
- this.byteSource.connect(var1.byteSink);
- } catch (Throwable var4) {
- throw var4;
- }
-
- }
-
- public void write(char[] var1, int var2, int var3) throws IOException {
- Object var4 = super.lock;
- synchronized(var4){}
-
- try {
- this.ensureOpen();
- int var6 = var3 * 2;
- if (this.buf == null || this.buf.length < var6) {
- this.buf = new byte[var6];
- }
-
- for(int var7 = 0; var7 < var6; var7 += 2) {
- char var8 = var1[var2 + (var7 >> 1)];
- this.buf[var7] = (byte)(var8 >> 8);
- this.buf[var7 + 1] = (byte)var8;
- }
-
- this.byteSource.write(this.buf, 0, var6);
- } catch (Throwable var10) {
- throw var10;
- }
-
- }
-
- public void flush() throws IOException {
- Object var1 = super.lock;
- synchronized(var1){}
-
- try {
- this.ensureOpen();
- this.byteSource.flush();
- } catch (Throwable var3) {
- throw var3;
- }
-
- }
-
- public void close() throws IOException {
- Object var1 = super.lock;
- synchronized(var1){}
-
- try {
- if (this.byteSource != null) {
- this.byteSource.close();
- this.byteSource = null;
- return;
- }
- } catch (Throwable var4) {
- throw var4;
- }
-
- }
- }
-