public inbox for frysk@sourceware.org
 help / color / mirror / Atom feed
From: Tom Tromey <tromey@redhat.com>
To: Frysk List <frysk@sourceware.org>
Subject: minor frysk cleanup
Date: Fri, 29 Feb 2008 21:10:00 -0000	[thread overview]
Message-ID: <m38x13jz13.fsf@fleche.redhat.com> (raw)

I was looking at frysk a little today and noticed an oddity in
FlowControlWriter.  This class keeps its own copy of the output
writer, but there is no reason to do this.  FilterWriter subclasses
should either use super calls or the inherited "out" field.

Tom

frysk-core/frysk/util/ChangeLog:
2008-02-29  Tom Tromey  <tromey@redhat.com>

	* FlowControlWriter.java (outStream): Remove.
	(FlowControlWriter): Update.
	(flush): Update.
	(close): Update.
	(write(char[],int,int)): Update.
	(write(int)): Update.
	(write(String,int,int)): Update.

diff --git a/frysk-core/frysk/util/FlowControlWriter.java b/frysk-core/frysk/util/FlowControlWriter.java
index b0b76fd..0ab8dfb 100644
--- a/frysk-core/frysk/util/FlowControlWriter.java
+++ b/frysk-core/frysk/util/FlowControlWriter.java
@@ -47,7 +47,6 @@ import java.io.Writer;
  * Extension of Writer that allows output to be paused.
  */
 public class FlowControlWriter extends FilterWriter {
-    private Writer outStream;
     private boolean paused = false;
 
     /**
@@ -55,7 +54,6 @@ public class FlowControlWriter extends FilterWriter {
      */
     public FlowControlWriter(Writer outStream) {
 	super(outStream);
-	this.outStream = outStream;
     }
 
     public synchronized boolean isPaused() {
@@ -81,7 +79,7 @@ public class FlowControlWriter extends FilterWriter {
 	    }
 	}
 	try {
-	    outStream.flush();
+	    super.flush();
 	}
 	catch (IOException e) {
 	}
@@ -96,7 +94,6 @@ public class FlowControlWriter extends FilterWriter {
 		
 	    }
 	}
-	outStream.close();
 	super.close();
     }
 
@@ -109,9 +106,9 @@ public class FlowControlWriter extends FilterWriter {
 		
 	    }
 	}
-	outStream.write(buf, offset, len);
+	super.write(buf, offset, len);
 	try {
-	    outStream.flush();
+	    super.flush();
 	}
 	catch (IOException e) {
 	}
@@ -126,9 +123,9 @@ public class FlowControlWriter extends FilterWriter {
 		
 	    }
 	}
-	outStream.write(b);
+	super.write(b);
 	try {
-	    outStream.flush();
+	    super.flush();
 	}
 	catch (IOException e) {
 	}
@@ -143,9 +140,9 @@ public class FlowControlWriter extends FilterWriter {
 		
 	    }
 	}
-	outStream.write(str, offset, len);
+	super.write(str, offset, len);
 	try {
-	    outStream.flush();
+	    super.flush();
 	}
 	catch (IOException e) {
 	    

             reply	other threads:[~2008-02-29 21:10 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-02-29 21:10 Tom Tromey [this message]
2008-03-01 18:16 ` Mark Wielaard
2008-03-01 18:27   ` Tom Tromey
2008-03-01 19:22     ` Mark Wielaard
2008-03-01 19:27       ` Tom Tromey

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=m38x13jz13.fsf@fleche.redhat.com \
    --to=tromey@redhat.com \
    --cc=frysk@sourceware.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).