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

com.fibanez.jsonschema.content.generator.util.FileUtils Maven / Gradle / Ivy

package com.fibanez.jsonschema.content.generator.util;

import com.fibanez.jsonschema.content.generator.exception.GeneratorException;
import lombok.AccessLevel;
import lombok.NoArgsConstructor;

import java.io.InputStream;

@NoArgsConstructor(access = AccessLevel.PROTECTED)
public final class FileUtils {

    public static byte[] getImageResource(String resourceName) {
        try {
            InputStream inputStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(resourceName);
            return inputStream.readAllBytes();
        } catch (Exception ex) {
            throw new GeneratorException(ex, "Resource not found %s", resourceName);
        }
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy