public static byte[] writeToByteArray(Blob blob) throws IOException {
    ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();
    blob.writeTo(byteArrayOutputStream);
    return byteArrayOutputStream.toByteArray();
  }
Writes the BLOB to a byte array.

@param blob the BLOB to write
@return the BLOB contents as a byte array
@throws IOException if writing out the BLOB contents fails
jib-core/src/main/java/com/google/cloud/tools/jib/blob/Blobs.java