public void read() throws IOException {
    if (!isDataRead) {
      int expectedLen = 9;
      int offset = 0;

      if (data.length >= expectedLen) {
        majorVersion = data[offset++] & 0xff;
        minorVersion = data[offset++] & 0xff;
        densityUnit = data[offset++] & 0xff;
        xDensity = IOUtils.readUnsignedShortMM(data, offset);
        offset += 2;
        yDensity = IOUtils.readUnsignedShortMM(data, offset);
        offset += 2;
        thumbnailWidth = data[offset++] & 0xff;
        thumbnailHeight = data[offset] & 0xff;
        if (thumbnailWidth != 0 && thumbnailHeight != 0) {
          containsThumbnail = true;
          // Extract the thumbnail
          // Create a Bitmap
          int size = 3 * thumbnailWidth * thumbnailHeight;
          int[] colors = MetadataUtils.toARGB(ArrayUtils.subArray(data, expectedLen, size));
          thumbnail =
              new JFIFThumbnail(
                  Bitmap.createBitmap(
                      colors, thumbnailWidth, thumbnailHeight, Bitmap.Config.ARGB_8888));
        }
      }

      isDataRead = true;
    }
  }