From: <pj...@us...> - 2009-04-17 02:22:44
|
Revision: 6233 http://jython.svn.sourceforge.net/jython/?rev=6233&view=rev Author: pjenvey Date: 2009-04-17 01:35:16 +0000 (Fri, 17 Apr 2009) Log Message: ----------- fix LineBufferedWriter.write's result, cleanup Modified Paths: -------------- trunk/jython/src/org/python/core/io/BufferedWriter.java trunk/jython/src/org/python/core/io/LineBufferedWriter.java Modified: trunk/jython/src/org/python/core/io/BufferedWriter.java =================================================================== --- trunk/jython/src/org/python/core/io/BufferedWriter.java 2009-04-16 23:59:40 UTC (rev 6232) +++ trunk/jython/src/org/python/core/io/BufferedWriter.java 2009-04-17 01:35:16 UTC (rev 6233) @@ -53,10 +53,11 @@ int totalToWrite = total - toBuffer; int count = totalToWrite; + ByteBuffer[] bulk = new ByteBuffer[] {buffer, bytes}; // Prepare the buffer for writing buffer.flip(); while (count > 0) { - count -= rawIO.write(new ByteBuffer[] {buffer, bytes}); + count -= rawIO.write(bulk); } // Prepare the buffer for buffering buffer.clear(); Modified: trunk/jython/src/org/python/core/io/LineBufferedWriter.java =================================================================== --- trunk/jython/src/org/python/core/io/LineBufferedWriter.java 2009-04-16 23:59:40 UTC (rev 6232) +++ trunk/jython/src/org/python/core/io/LineBufferedWriter.java 2009-04-17 01:35:16 UTC (rev 6233) @@ -23,7 +23,7 @@ /** {@inheritDoc} */ public int write(ByteBuffer bytes) { - int written = 0; + int size = bytes.remaining(); while (bytes.hasRemaining()) { byte next = bytes.get(); @@ -37,11 +37,10 @@ } if (next == LF_BYTE) { - written += buffer.position(); flush(); } } - return written; + return size; } } This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |