// Decompiled by Jad v1.5.8e. Copyright 2001 Pavel Kouznetsov.
// Jad home page: http://www.geocities.com/kpdus/jad.html
// Decompiler options: packimports(3) 
// Source File Name:   RootFileReader.java

package hep.rootio;

import hep.rootio.implementation.DefaultClassFactory;
import hep.rootio.implementation.FileClassFactory;
import hep.rootio.implementation.RootRandomAccessFile;
import hep.rootio.interfaces.RootObject;
import hep.rootio.interfaces.TDirectory;
import hep.rootio.interfaces.TFile;
import hep.rootio.interfaces.TKey;
import hep.rootio.reps.TString;

import java.io.*;
import java.util.List;

// Referenced classes of package hep.rootio:
//            RootClassNotFound, RootObjectRepresentation, RootClassFactory, RootClass

public class RootFileReader
    implements TFile
{

    private static void welcome()
    {
        System.out.println("Root IO for Java, part of the FreeHEP library: http://java.freehep.org");
        System.out.println("Please report all bugs/problems to tonyj@slac.stanford.edu");
        System.out.println("Version $Id: RootFileReader.java,v 1.10 2001/06/05 22:21:47 tonyj Exp $");
        welcome = true;
    }

    public RootFileReader(String file)
        throws IOException
    {
        this(new File(file), null);
    }

    public RootFileReader(File file)
        throws IOException
    {
        this(file, null);
    }

    public RootFileReader(File file, RootClassFactory factory)
        throws IOException
    {
        if(!welcome)
            welcome();
        if(factory == null)
            factory = new DefaultClassFactory(this);
        this.factory = factory;
        raf = new RootRandomAccessFile(file, this);
        int fVersion = raf.readInt();
        if(fVersion < 30006)
            throw new IOException("hep.rootio package cannot read files created by Root before release 3.00/6 (" + fVersion + ")");
        int fBEGIN = raf.readInt();
        int fEND = raf.readInt();
        int fSeekFree = raf.readInt();
        int fNbytesFree = raf.readInt();
        int nfree = raf.readInt();
        int fNbytesName = raf.readInt();
        int fUnits = raf.readByte();
        int fCompress = raf.readInt();
        int fSeekInfo = raf.readInt();
        int fNBytesInfo = raf.readInt();
        raf.seek(fBEGIN);
        int Nbytes = raf.readInt();
        int Version = raf.readShort();
        int ObjLen = raf.readInt();
        Object Datime = raf.readObject("TDatime");
        int KeyLen = raf.readShort();
        int Cycle = raf.readShort();
        int SeekKey = raf.readInt();
        int SeekPdir = raf.readInt();
        TString className = (TString)raf.readObject("TString");
        name = (TString)raf.readObject("TString");
        title = (TString)raf.readObject("TString");
        raf.seek(fBEGIN + fNbytesName);
        dir = (TDirectory)raf.readObject("TDirectory").getProxy();
        if(fSeekInfo != 0)
        {
            raf.seek(fSeekInfo);
            streamerInfo = (TKey)raf.readObject("TKey").getProxy();
            this.factory = new FileClassFactory(streamerInfo, factory, this);
        }
    }

    public void close()
        throws IOException
    {
        raf.close();
    }

    public RootClassFactory getFactory()
    {
        return factory;
    }

    public String getName()
    {
        return name.toString();
    }

    public String getTitle()
    {
        return title.toString();
    }

    public int nKeys()
    {
        return dir.nKeys();
    }

    public TKey getKey(int index)
    {
        return dir.getKey(index);
    }

    public TKey getKeyForTitle(String name)
    {
        return dir.getKeyForTitle(name);
    }

    public TKey getKey(String name)
    {
        return dir.getKey(name);
    }

    public TKey streamerInfoKey()
    {
        return streamerInfo;
    }

    public RootClass rootClass()
    {
        try
        {
            return factory.create("TFile");
        }
        catch(RootClassNotFound rootclassnotfound)
        {
            return null;
        }
    }

    public Object getValue(String member)
    {
        return dir.getValue(member);
    }

    public List streamerInfo()
        throws IOException
    {
        return (List)streamerInfo.getObject();
    }

    public Object get(String name)
        throws IOException
    {
        TKey key = getKey(name);
        return key.getObject();
    }

    public void setClassLoader(ClassLoader loader)
    {
        classLoader = loader;
    }

    public ClassLoader getClassLoader()
    {
        return classLoader;
    }

    private RootClassFactory factory;
    private RootRandomAccessFile raf;
    private TString name;
    private TString title;
    private TDirectory dir;
    private TKey streamerInfo;
    private ClassLoader classLoader;
    private static boolean welcome = false;

}

 

Ads help maintain this website.