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

com.commercetools.sunrise.ctp.graphql.GraphQLUtils Maven / Gradle / Ivy

The newest version!
package com.commercetools.sunrise.ctp.graphql;

import org.apache.commons.io.IOUtils;

import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.StandardCharsets;

public final class GraphQLUtils {

    private GraphQLUtils() {
    }

    public static String readFromResource(final String resourcePath) {
        final InputStream resourceAsStream = Thread.currentThread().getContextClassLoader().getResourceAsStream(resourcePath);
        try {
            return IOUtils.toString(resourceAsStream, StandardCharsets.UTF_8);
        } catch (IOException e) {
            throw new GraphQLException("Could not read GraphQL file", e);
        }
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy