public void write(byte[] b, int off, int len) throws IOException {if ((off < 0) || (off > b.length) || (len < 0) ||((off + len) > b.length) || ((off + len) < 0)) {throw new IndexOutOfBoundsException();} else if (len == 0) {return;}do {createBlockIfNeeded();int writeBytes = Math.min(buffer.remaining(), len);buffer.put(b, off, writeBytes);off += writeBytes;len -= writeBytes;} while (len > 0);}

public override void Write(byte[] b, int off, int len){if ((off < 0) || (off > b.Length) || (len < 0) ||((off + len) > b.Length) || ((off + len) < 0)){throw new IndexOutOfRangeException();}else if (len == 0){return;}do{CreateBlockIfNeeded();int writeBytes = Math.Min(buffer.Remaining(), len);buffer.Write(b, off, writeBytes);off += writeBytes;len -= writeBytes;} while (len > 0);}
