Return an instance of the class that is saved in the file with the
            given filename in the specified format.
352899
def load(cls, filename, format=None):
        
        if format is None:
            # try to derive protocol from file extension
            format = format_from_extension(filename)
        with file(filename, 'rbU') as fp:
            obj = cls.load_from_file_object(fp, format)
            obj.filename = filename
            return obj
436535
def from_file(filename_or_file_object):
    
    if isinstance(filename_or_file_object, basestring):
        file_ = open(filename_or_file_object, 'r')
        we_opened = True
    else:
        we_opened = False
        file_ = filename_or_file_object

    try:
        data = load(file_.read())
    finally:
        if we_opened:
            file_.close()

    return data
480227
protected byte[] loadClassDataFromFile(String fileName) {
        byte[] classBytes = null;
        try {
            InputStream in = getResourceAsStream(fileName);
            if (in == null) {
                return null;
            }
            ByteArrayOutputStream baos = new ByteArrayOutputStream();
            byte buf[] = new byte[1024];
            for (int i = 0;(i = in.read(buf)) != -1;)
                baos.write(buf, 0, i);
            in.close();
            baos.close();
            classBytes = baos.toByteArray();
        }
        catch (Exception ex) {
            return null;
        }
        return classBytes;
    }
1125117
public static Class<? extends FileSystem> getFileSystemByName(final String className) throws ClassNotFoundException {
		return Class.forName(className, true, getClassLoader()).asSubclass(FileSystem.class);
	}
195610
def load(filename, **kwargs):
    
    with open(filename, 'rb') as f:
        reader = T7Reader(f, **kwargs)
        return reader.read_obj()
1122047
def get_file_view_cls(self, filename):
        
        if filename is None:
            return self.default_view_class
        for pattern, cls in self.view_class_files_map:
            if pattern.match(filename):
                return cls
        return self.default_view_class
693032
private static byte[] getData(String fileName, Object location) throws IOException {

		byte[] data;
		if (location instanceof String) {
			data = FileSupport.getBinaryFromJar(fileName, (String) location);
		} else if (location instanceof File) {
			InputStream in = new FileInputStream((File) location);
			data = StreamSupport.absorbInputStream(in);
			in.close();
		} else {
			throw new NoClassDefFoundError("file '" + fileName + "' could not be loaded from '" + location + '\'');
		}
		return data;
	}
134637
public static String fileAsString(String filename) {
    File classpathFile = getClasspathFile(filename);
    return fileAsString(classpathFile);
  }
894890
public static File getClassFileFromDirectoryInClassPath(String className) {
		String fileName = StringSupport.replaceAll(className, ".", "/");
		fileName += ".class";
		return getFileFromDirectoryInClassPath(fileName, System.getProperty("java.class.path"));
	}
838318
protected final ClassFile getClassFile(String className)
	{
		ClassFile cf=null;
		String filePath=null;
		if(className!=null && !className.isEmpty())
		{
			String rootPath=getClassRootDir();
			if(rootPath.endsWith("/")||rootPath.endsWith("\\"))
			{
			}else
			{
				rootPath=rootPath+File.separator;
			}
			filePath=rootPath+className.replace('.', File.separatorChar)+".class";
		}
		File file=new File(filePath);
		if(file.exists() && file.isFile())
		{
			cf=new ClassFile(className, file.getPath());
			cf.setLastModifyTime(file.lastModified());
		}
		return cf;
	}
32013
public static JavaClass getBcelClass(final String filename) throws IOException {
    final ClassParser parser = new ClassParser(filename);
    return parser.parse();
  }
333038
def is_class_file(filename):
    

    with open(filename, "rb") as fd:
        c = fd.read(len(JAVA_CLASS_MAGIC))
        if isinstance(c, str):      # Python 2
            c = map(ord, c)
        return tuple(c) == JAVA_CLASS_MAGIC
75306
public static String loadFile(String filename) {
        ClassLoader classLoader = Thread.currentThread().getContextClassLoader();
        InputStream is = classLoader.getResourceAsStream(filename);
        if (is == null) {
            throw new IllegalArgumentException("Unable to locate: " + filename);
        }
        return streamToString(is, filename);
    }
579350
def _readfile(cls, filename):
        
        f = codecs.open(filename, encoding='utf-8')
        filedata = f.read()
        f.close()
        tokenz = LM.tokenize(filedata, mode='c')
        #print tokenz
        return tokenz
1175779
def as_existing_file(self, filepath):
        """"""
        if os.path.isfile(filepath) and hasattr(self, '__file_class__'):
            return self.__file_class__(filepath)  # pylint: disable=no-member
        return self.__class__(filepath)
1261513
public static InputStream fileAsStream(String filename) {
    File classpathFile = getClasspathFile(filename);
    return fileAsStream(classpathFile);
  }
763031
def from_file(cls, path):

        

        with open(path, 'r', errors='replace') as f:
            return cls(f.read())