All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.databricks.sdk.core.utils.CustomCloseInputStream Maven / Gradle / Ivy

There is a newer version: 0.38.0
Show newest version
package com.databricks.sdk.core.utils;

import java.io.IOException;
import java.io.InputStream;

public class CustomCloseInputStream extends InputStream {
  private final InputStream inputStream;
  private final Runnable cleanup;

  public CustomCloseInputStream(InputStream inputStream, Runnable cleanup) {
    this.inputStream = inputStream;
    this.cleanup = cleanup;
  }

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

  @Override
  public void close() throws IOException {
    inputStream.close();
    cleanup.run();
  }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy