class JarContentsManager {

    public byte[] getFileContents(File jar, String filePath) {
        requireFileExistence(jar);
        Objects.requireNonNull(filePath);

        try (JarFile jarFile = new JarFile(jar, false)) {
            return getJarEntryContents(jarFile, jarFile.getJarEntry(filePath));
        } catch (IOException e) {
            throw new UncheckedIOException(
                    String.format("Failed to retrieve file '%s' from jar '%s'",
                            filePath, jar),
                    e);
        }
    }

}