code: public byte[] write(Bean bean, boolean rootType) {
          ByteArrayOutputStream baos = new ByteArrayOutputStream(1024);
          try {
              write(bean, rootType, baos);
          } catch (IOException ex) {
              throw new IllegalStateException(ex);
          }
          return baos.toByteArray();
      }
docs: Writes the bean to an array of bytes.
  
  @param bean  the bean to output, not null
  @param rootType  true to output the root type
  @return the binary data, not null