Revision: 4825
http://jython.svn.sourceforge.net/jython/?rev=4825&view=rev
Author: zyasoft
Date: 2008-06-30 09:14:30 -0700 (Mon, 30 Jun 2008)
Log Message:
-----------
Change cStringIO to use StringBuilder semantics. Use via thread confinement, or with external locking. Keep it simple, keep it lightweight.
Modified Paths:
--------------
branches/asm/src/org/python/modules/cStringIO.java
Modified: branches/asm/src/org/python/modules/cStringIO.java
===================================================================
--- branches/asm/src/org/python/modules/cStringIO.java 2008-06-30 08:59:43 UTC (rev 4824)
+++ branches/asm/src/org/python/modules/cStringIO.java 2008-06-30 16:14:30 UTC (rev 4825)
@@ -6,8 +6,8 @@
* The Netherlands.
*/
-// we probably should use StringBuffer instead of StringBuilder, since StringIO
-// most likely means not thread-confined, so we want those locking semantics.
+// cStringIO with StringBuilder semantics - don't use without using external
+// synchronization. Java does provide other alternatives.
package org.python.modules;
@@ -62,15 +62,15 @@
public boolean closed = false;
public int pos = 0;
- private final StringBuffer buf;
+ private final StringBuilder buf;
StringIO() {
- buf = new StringBuffer();
+ buf = new StringBuilder();
}
StringIO(String buffer) {
- buf = new StringBuffer(buffer);
+ buf = new StringBuilder(buffer);
}
private void _complain_ifclosed() {
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|