public synchronized void write(byte b[], int off, int len) {
    int storable = Math.min(maxBytes - nBytes, len);
    if (storable > 0) {
      nBytes += storable;
      super.write(b, off, storable);
    }
  }
Writes <code>len</code> bytes from the specified byte array
starting at offset <code>off</code> to this byte array output stream.
Any bytes after the first maxBytes will be ignored.

@param   b     the data.
@param   off   the start offset in the data.
@param   len   the number of bytes to write.
hcatalog/webhcat/svr/src/main/java/org/apache/hive/hcatalog/templeton/MaxByteArrayOutputStream.java