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

org.snapscript.common.store.ClassPathStore Maven / Gradle / Ivy

There is a newer version: 1.4.6
Show newest version
package org.snapscript.common.store;

import java.io.InputStream;
import java.io.OutputStream;

public class ClassPathStore implements Store {

   public ClassPathStore() {
      super();
   }
   
   @Override
   public InputStream getInputStream(String path) {
      Thread thread = Thread.currentThread();
      ClassLoader loader = thread.getContextClassLoader();
      InputStream source = loader.getResourceAsStream(path);
      
      if(source == null) {
         throw new NotFoundException("Could not find '" + path + "'");
      }  
      return source;
   }
   
   @Override
   public OutputStream getOutputStream(String path) {
      return null;
   }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy