<commit_before>package no.finntech.capturandro;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;
import android.media.ExifInterface;
import android.util.Log;

import org.apache.commons.io.IOUtils;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;

class BitmapUtil {

    private BitmapUtil() {
    }

    static Bitmap getProcessedBitmap(File inFile, int longestSide) {
        return getProcessedBitmap(inFile, longestSide, 0);
    }

    static Bitmap getProcessedBitmap(File inFile, int longestSide, int orientation) {
        // Decode -scaled- bitmap before rotating it. Makes things more memory friendly.
        Bitmap bitmap = decodeBitmapFile(inFile, longestSide);
        return resizeAndRotateBitmap(bitmap, longestSide, orientation);
    }

    static Bitmap getProcessedBitmap(InputStream inputStream, int longestSide, int orientation) {
        // We can't decode from a stream twice, meaning we can't decode just the metadata
        // then do the downsampling, so we might as well just decode directly, then resize.<commit_msg>fix bug which caused camera pictures to get wrong orientation<commit_after>package no.finntech.capturandro;

import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.graphics.Matrix;
import android.media.ExifInterface;
import android.util.Log;

import org.apache.commons.io.IOUtils;

import java.io.File;
import java.io.FileInputStream;
import java.io.FileNotFoundException;
import java.io.IOException;
import java.io.InputStream;

class BitmapUtil {

    private BitmapUtil() {
    }

    static Bitmap getProcessedBitmap(File inFile, int longestSide) {
        return getProcessedBitmap(inFile, longestSide, getOrientation(inFile));
    }

    static Bitmap getProcessedBitmap(File inFile, int longestSide, int orientation) {
        // Decode -scaled- bitmap before rotating it. Makes things more memory friendly.
        Bitmap bitmap = decodeBitmapFile(inFile, longestSide);
        return resizeAndRotateBitmap(bitmap, longestSide, orientation);
    }

    static Bitmap getProcessedBitmap(InputStream inputStream, int longestSide, int orientation) {
        // We can't decode from a stream twice, meaning we can't decode just the metadata
        // then do the downsampling, so we might as well just decode directly, then resize.
{'fraction_non_alphanumeric': 0.07626774847870182, 'fraction_numerical': 0.00040567951318458417, 'mean_word_length': 4.180672268907563, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '5830211', 'n_tokens_mistral': 673, 'n_tokens_neox': 640, 'n_words': 210}