class BitmapDecoder {

  @Nullable
  public static BufferedImage getBitmap(@NotNull BitmapDataProvider dataProvider) {
    PixelFormat config = dataProvider.getBitmapConfigName();
    if (config == null) {
      return null;
    }

    BitmapExtractor bitmapExtractor = SUPPORTED_FORMATS.get(config);
    if (bitmapExtractor == null) {
      return null;
    }

    Dimension size = dataProvider.getDimension();
    if (size == null) {
      return null;
    }

    return bitmapExtractor.getImage(size.width, size.height, dataProvider.getPixelBytes(size));
  }

}