ClassLoaderFileSystem extends FileSystem<ClassLoaderFileSystem.ClassLoaderResourceId> { @Override protected ReadableByteChannel open(ClassLoaderResourceId resourceId) throws IOException { ClassLoader classLoader = getClass().getClassLoader(); InputStream inputStream = classLoader.getResourceAsStream(resourceId.path.substring(PREFIX.length())); if (inputStream == null) { throw new IOException( "Unable to load " + resourceId.path + " with " + classLoader + " URL " + classLoader.getResource(resourceId.path.substring(PREFIX.length()))); } return Channels.newChannel(inputStream); } ClassLoaderFileSystem();  static final String SCHEMA; }
@Test public void testOpen() throws IOException { ClassLoaderFileSystem filesystem = new ClassLoaderFileSystem(); ReadableByteChannel channel = filesystem.open(filesystem.matchNewResource(SOME_CLASS, false)); checkIsClass(channel); }