git-svn-id: svn+ssh://src.earth.threerings.net/narya/trunk@3430 542714f4-19e9-0310-aa3c-eee0fc999fb1
This commit is contained in:
Ray Greenwell
2005-03-28 19:23:26 +00:00
parent 5290ab7c1d
commit f6e427a26d
@@ -96,13 +96,17 @@ public class FramingOutputStream extends OutputStream
{ {
int ocapacity = _buffer.capacity(); int ocapacity = _buffer.capacity();
int ncapacity = _buffer.position() + needed; int ncapacity = _buffer.position() + needed;
if (ncapacity > ocapacity) { if (ncapacity <= ocapacity) {
System.err.println("Why would I not expand? " +
"[ocapacity=" + ocapacity + ", ncapacity=" + ncapacity + "].");
}
//if (ncapacity > ocapacity) {
// increase the buffer size in large increments // increase the buffer size in large increments
ncapacity = Math.max(ocapacity << 1, ncapacity); ncapacity = Math.max(ocapacity << 1, ncapacity);
ByteBuffer newbuf = ByteBuffer.allocate(ncapacity); ByteBuffer newbuf = ByteBuffer.allocate(ncapacity);
newbuf.put((ByteBuffer)_buffer.flip()); newbuf.put((ByteBuffer)_buffer.flip());
_buffer = newbuf; _buffer = newbuf;
} // }
} }
/** /**