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

com.sap.hana.datalake.files.utils.IOUtils Maven / Gradle / Ivy

Go to download

An implementation of org.apache.hadoop.fs.FileSystem targeting SAP HANA Data Lake Files.

There is a newer version: 3.0.27
Show newest version
// © 2024 SAP SE or an SAP affiliate company. All rights reserved.
package com.sap.hana.datalake.files.utils;

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

public class IOUtils {

  private IOUtils() {
    // no-op
  }

  public static long copyBytesTo(final InputStream is, final OutputStream os, final int limit) throws IOException {
    if (is.markSupported()) {
      is.mark(/* ignored */ 0);
    }

    try {
      return org.apache.commons.io.IOUtils.copyLarge(is, os, /* inputOffset */ 0L, limit);
    } finally {
      if (is.markSupported()) {
        is.reset();
      }
    }
  }

}

// © 2024 SAP SE or an SAP affiliate company. All rights reserved.




© 2015 - 2025 Weber Informatics LLC | Privacy Policy