public int flush(Buffer buffer) throws IOException { if (_closed) throw new IOException("CLOSED"); if (_growOutput && buffer.length()>_out.space()) { _out.compact(); if (buffer.length()>_out.space()) { ByteArrayBuffer n = new ByteArrayBuffer(_out.putIndex()+buffer.length()); n.put(_out.peek(0,_out.putIndex())); if (_out.getIndex()>0) { n.mark(); n.setGetIndex(_out.getIndex()); } _out=n; } } int len = _out.put(buffer); if (!buffer.isImmutable()) buffer.skip(len); return len; }
public int flush(Buffer buffer) throws IOException { if (_closed) throw new IOException("CLOSED"); if (_growOutput && buffer.length()>_out.space()) { _out.compact(); if (buffer.length()>_out.space()) { ByteArrayBuffer n = new ByteArrayBuffer(_out.putIndex()+buffer.length()); n.put(_out.peek(0,_out.putIndex())); if (_out.getIndex()>0) { n.mark(); n.setGetIndex(_out.getIndex()); } _out=n; } } int len = _out.put(buffer); if (!buffer.isImmutable()) buffer.skip(len); return len; }
public int flush(Buffer buffer) throws IOException { if (_closed) throw new IOException("CLOSED"); if (_growOutput && buffer.length()>_out.space()) { _out.compact(); if (buffer.length()>_out.space()) { ByteArrayBuffer n = new ByteArrayBuffer(_out.putIndex()+buffer.length()); n.put(_out.peek(0,_out.putIndex())); if (_out.getIndex()>0) { n.mark(); n.setGetIndex(_out.getIndex()); } _out=n; } } int len = _out.put(buffer); if (!buffer.isImmutable()) buffer.skip(len); return len; }
public int flush(Buffer buffer) throws IOException { if (_closed) throw new IOException("CLOSED"); if (_growOutput && buffer.length()>_out.space()) { _out.compact(); if (buffer.length()>_out.space()) { ByteArrayBuffer n = new ByteArrayBuffer(_out.putIndex()+buffer.length()); n.put(_out.peek(0,_out.putIndex())); if (_out.getIndex()>0) { n.mark(); n.setGetIndex(_out.getIndex()); } _out=n; } } int len = _out.put(buffer); if (!buffer.isImmutable()) buffer.skip(len); return len; }