public virtual long pipe(OutStream output, Long toPipe, bool cls) { try { long bufSize = FanInt.Chunk.longValue(); Buf buf = Buf.make(bufSize); long total = 0; if (toPipe == null) { while (true) { Long n = readBuf(buf.clear(), bufSize); if (n == null) { break; } output.writeBuf(buf.flip(), buf.remaining()); total += n.longValue(); } } else { long toPipeVal = toPipe.longValue(); while (total < toPipeVal) { if (toPipeVal - total < bufSize) { bufSize = toPipeVal - total; } Long n = readBuf(buf.clear(), bufSize); if (n == null) { throw IOErr.make("Unexpected end of stream").val; } output.writeBuf(buf.flip(), buf.remaining()); total += n.longValue(); } } return(total); } finally { if (cls) { close(); } } }
public virtual OutStream writeBuf(Buf buf) { return(writeBuf(buf, buf.remaining())); }
public override OutStream writeBuf(Buf buf) { return writeBuf(buf, buf.remaining()); }
public virtual OutStream writeBuf(Buf buf) { return writeBuf(buf, buf.remaining()); }
public override OutStream writeBuf(Buf buf) { return(writeBuf(buf, buf.remaining())); }