This is the mail archive of the frysk@sourceware.org mailing list for the frysk project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

minor frysk cleanup


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) {
 	    


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]