code: @Override
      public void write(final byte[] b, final int offset, final int len) throws IOException {
          if (b == null) {
              throw new NullPointerException();
          } else if (offset < 0 || len < 0) {
              throw new IndexOutOfBoundsException();
          } else if (offset > b.length || offset + len > b.length) {
              throw new IndexOutOfBoundsException();
          } else if (len > 0) {
              if (doEncode) {
                  baseNCodec.encode(b, offset, len, context);
              } else {
                  baseNCodec.decode(b, offset, len, context);
              }
              flush(false);
          }
      }
docs: Writes <code>len</code> bytes from the specified <code>b</code> array starting at <code>offset</code> to this
  output stream.
  
  @param b
  source byte array
  @param offset
  where to start reading the bytes
  @param len
  maximum number of bytes to write
  
  @throws IOException
  if an I/O error occurs.
  @throws NullPointerException
  if the byte array parameter is null
  @throws IndexOutOfBoundsException
  if offset, len or buffer size are invalid