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

org.fugerit.java.doc.playground.val.ValUtils Maven / Gradle / Ivy

There is a newer version: 8.8.9
Show newest version
package org.fugerit.java.doc.playground.val;

import jakarta.ws.rs.core.Response;
import lombok.extern.slf4j.Slf4j;
import org.fugerit.java.core.function.UnsafeSupplier;
import org.fugerit.java.core.io.FileIO;
import org.fugerit.java.core.io.helper.HelperIOException;

import java.io.File;
import java.io.IOException;

@Slf4j
public class ValUtils {

    private ValUtils() {}
    public static Response doIfInTmpFolder(File tempFile,  UnsafeSupplier fun ) throws IOException {
        Response res = null;
        if ( FileIO.isInTmpFolder( tempFile ) ) {
            res = HelperIOException.get( fun::get );
        } else {
            res = Response.status( Response.Status.UNAUTHORIZED ).build();
        }
        return res;
    }

}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy