package roart.common.util;

import java.io.InputStream;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

import roart.common.constants.Constants;

public class IOUtil {
    private static Logger log = LoggerFactory.getLogger(IOUtil.class);

    public static byte[] toByteArrayMax(InputStream is) {
        try {
            return is.readNBytes(Integer.MAX_VALUE - 8);
        } catch (Exception e) {
            log.error(Constants.EXCEPTION, e);
            return new byte[0];
        }
    }

    public static byte[] toByteArray1G(InputStream is) {
        try {
            return is.readNBytes(1024 * 1024 * 1024);
        } catch (Exception e) {
            log.error(Constants.EXCEPTION, e);
            return new byte[0];
        }
    }
}

@@ -752,11 +752,260 @@
  %7D%0A    %7D
+%0A%0A    public static byte%5B%5D toByteArray(InputStream is, int bytes) %7B%0A        try %7B%0A            return is.readNBytes(bytes);%0A        %7D catch (Exception e) %7B%0A            log.error(Constants.EXCEPTION, e);%0A            return new byte%5B0%5D;%0A        %7D%0A    %7D
 %0A%7D%0A

Index size check, for Elastic 8 upgrade (I10).