public static Bytes readFile(@org.jetbrains.annotations.NotNull String name) throws IOException { File file = new File(name); URL url = null; if (!file.exists()) { url = urlFor(name); file = new File(url.getFile()); } return // name.endsWith(".gz") || !file.exists() || OS.isWindows() ? Bytes.wrapForRead(readAsBytes(url == null ? new FileInputStream(file) : open(url))); //: MappedFile.readOnly(file).acquireBytesForRead(0); }
public static byte[] readFile(Class clazz, @NotNull String name) throws IOException { URL url = urlFor(clazz, name); InputStream is = open(url); return readAsBytes(is); }
public static byte[] readFile(Class clazz, @NotNull String name) throws IOException { URL url = urlFor(clazz, name); InputStream is = open(url); return readAsBytes(is); }
/** * This method first looks for the file in the classpath. If this is not found it * appends the suffix .gz and looks again in the classpath to see if it is present. * If it is still not found it looks for the file on the file system. If it not found * it appends the suffix .gz and looks again on the file system. * If it still not found a FileNotFoundException is thrown. * * @param name Name of the file * @return A byte[] containing the contents of the file * @throws IOException FileNotFoundException thrown if file is not found */ public static byte[] readFile(@NotNull String name) throws IOException { URL url = urlFor(name); InputStream is = open(url); return readAsBytes(is); }
/** * This method first looks for the file in the classpath. If this is not found it * appends the suffix .gz and looks again in the classpath to see if it is present. * If it is still not found it looks for the file on the file system. If it not found * it appends the suffix .gz and looks again on the file system. * If it still not found a FileNotFoundException is thrown. * * @param name Name of the file * @return A byte[] containing the contents of the file * @throws IOException FileNotFoundException thrown if file is not found */ public static byte[] readFile(@NotNull String name) throws IOException { URL url = urlFor(name); InputStream is = open(url); return readAsBytes(is); }