// Path: app/src/main/java/com/google/android/diskusage/datasource/DataSource.java
// public abstract class DataSource {
//   private static DataSource currentDataSource = new DefaultDataSource();
// 
//   public static DataSource get() {
//     return currentDataSource;
//   }
// 
//   public static void override(DataSource dataSource) {
//     LoadableActivity.resetStoredStates();
//     currentDataSource = dataSource;
//   }
// 
//   public abstract int getAndroidVersion();
// 
//   public abstract List<PkgInfo> getInstalledPackages(PackageManager pm);
// 
//   public abstract StatFsSource statFs(String mountPoint);
// 
//   @TargetApi(Build.VERSION_CODES.FROYO)
//   public abstract PortableFile getExternalFilesDir(Context context);
//   @TargetApi(Build.VERSION_CODES.KITKAT)
//   public abstract PortableFile[] getExternalFilesDirs(Context context);
// 
//   public abstract PortableFile getExternalStorageDirectory();
// 
//   public abstract InputStream createNativeScanner(
//       Context context, String path,
//       boolean rootRequired) throws IOException, InterruptedException;
// 
//   public abstract boolean isDeviceRooted();
// 
//   public abstract LegacyFile createLegacyScanFile(String root);
// 
//   public final BufferedReader getProcReader() throws IOException {
//     return new BufferedReader(new InputStreamReader(getProc()));
//   }
// 
//   public abstract InputStream getProc() throws IOException;
// 
//   public abstract void getPackageSizeInfo(
//       PkgInfo pkgInfo,
//       Method getPackageSizeInfo,
//       PackageManager pm,
//       AppStatsCallback callback) throws Exception;
// 
//   public abstract PortableFile getParentFile(PortableFile file);
// }


import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import android.annotation.TargetApi;
import android.content.Context;
import android.os.Build;
import android.os.Build.VERSION_CODES;
import com.google.android.diskusage.datasource.DataSource;
package com.google.android.diskusage.datasource.fast;




public class NativeScannerStream extends InputStream {

  private final InputStream is;
  private final Process process;

  public NativeScannerStream(InputStream is, Process process) {
    this.is = is;
    this.process = process;
  }

  @Override
  public int read() throws IOException {
    return is.read();
  }

  @Override
  public int read(byte[] buffer) throws IOException {
    return is.read(buffer);
  }

  @Override
  public int read(byte[] buffer, int byteOffset, int byteCount)
      throws IOException {
    return is.read(buffer, byteOffset, byteCount);
  }

  @Override
  public void close() throws IOException {
    is.close();
    try {
      process.waitFor();
// Path: app/src/main/java/com/google/android/diskusage/datasource/DataSource.java
// public abstract class DataSource {
//   private static DataSource currentDataSource = new DefaultDataSource();
// 
//   public static DataSource get() {
//     return currentDataSource;
//   }
// 
//   public static void override(DataSource dataSource) {
//     LoadableActivity.resetStoredStates();
//     currentDataSource = dataSource;
//   }
// 
//   public abstract int getAndroidVersion();
// 
//   public abstract List<PkgInfo> getInstalledPackages(PackageManager pm);
// 
//   public abstract StatFsSource statFs(String mountPoint);
// 
//   @TargetApi(Build.VERSION_CODES.FROYO)
//   public abstract PortableFile getExternalFilesDir(Context context);
//   @TargetApi(Build.VERSION_CODES.KITKAT)
//   public abstract PortableFile[] getExternalFilesDirs(Context context);
// 
//   public abstract PortableFile getExternalStorageDirectory();
// 
//   public abstract InputStream createNativeScanner(
//       Context context, String path,
//       boolean rootRequired) throws IOException, InterruptedException;
// 
//   public abstract boolean isDeviceRooted();
// 
//   public abstract LegacyFile createLegacyScanFile(String root);
// 
//   public final BufferedReader getProcReader() throws IOException {
//     return new BufferedReader(new InputStreamReader(getProc()));
//   }
// 
//   public abstract InputStream getProc() throws IOException;
// 
//   public abstract void getPackageSizeInfo(
//       PkgInfo pkgInfo,
//       Method getPackageSizeInfo,
//       PackageManager pm,
//       AppStatsCallback callback) throws Exception;
// 
//   public abstract PortableFile getParentFile(PortableFile file);
// }


// Path: app/src/main/java/com/google/android/diskusage/datasource/fast/NativeScannerStream.java
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.io.OutputStream;
import android.annotation.TargetApi;
import android.content.Context;
import android.os.Build;
import android.os.Build.VERSION_CODES;
import com.google.android.diskusage.datasource.DataSource;

package com.google.android.diskusage.datasource.fast;




public class NativeScannerStream extends InputStream {

  private final InputStream is;
  private final Process process;

  public NativeScannerStream(InputStream is, Process process) {
    this.is = is;
    this.process = process;
  }

  @Override
  public int read() throws IOException {
    return is.read();
  }

  @Override
  public int read(byte[] buffer) throws IOException {
    return is.read(buffer);
  }

  @Override
  public int read(byte[] buffer, int byteOffset, int byteCount)
      throws IOException {
    return is.read(buffer, byteOffset, byteCount);
  }

  @Override
  public void close() throws IOException {
    is.close();
    try {
      process.waitFor();
    } catch (InterruptedException e) {