// 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:   RootRandomAccessFile.java

package hep.rootio.implementation;

import hep.rootio.*;

import java.io.*;
import java.util.Hashtable;

// Referenced classes of package hep.rootio.implementation:
//            RootInputStream, AbstractRootObject

public class RootRandomAccessFile extends RandomAccessFile
    implements RootInput
{

    public RootRandomAccessFile(File file, RootFileReader reader)
        throws IOException
    {
        super(file, "r");
        map = new Hashtable();
        this.reader = reader;
        if(readByte() != 114 || readByte() != 111 || readByte() != 111 || readByte() != 116)
            throw new IOException("Not a root file: " + file);
        else
            return;
    }

    public String readString()
        throws IOException
    {
        return RootInputStream.readString(this);
    }

    public String readNullTerminatedString(int maxLength)
        throws IOException
    {
        return RootInputStream.readNullTerminatedString(this, maxLength);
    }

    public int readVersion()
        throws IOException
    {
        return RootInputStream.readVersion(this, null);
    }

    public int readVersion(AbstractRootObject obj)
        throws IOException
    {
        return RootInputStream.readVersion(this, obj);
    }

    public int readArray(int data[])
        throws IOException
    {
        return RootInputStream.readArray(this, data);
    }

    public int readArray(byte data[])
        throws IOException
    {
        return RootInputStream.readArray(this, data);
    }

    public int readArray(float data[])
        throws IOException
    {
        return RootInputStream.readArray(this, data);
    }

    public int readArray(double data[])
        throws IOException
    {
        return RootInputStream.readArray(this, data);
    }

    public void checkLength(AbstractRootObject obj)
        throws IOException
    {
        RootInputStream.checkLength(this, obj);
    }

    public long getPosition()
        throws IOException
    {
        return getFilePointer() - offset;
    }

    public RootObjectRepresentation readObject(String type)
        throws IOException
    {
        return RootInputStream.readObject(this, type);
    }

    public RootObjectRepresentation readObjectRef()
        throws IOException
    {
        return RootInputStream.readObjectRef(this, map);
    }

    public RootClassFactory getFactory()
    {
        return reader.getFactory();
    }

    public RootRandomAccessFile getRAF()
    {
        return this;
    }

    public void clearMap()
    {
        map.clear();
        offset = 0L;
    }

    public void setMap(int keylen)
        throws IOException
    {
        offset = getFilePointer() - (long)keylen;
    }

    private long offset;
    private RootFileReader reader;
    private Hashtable map;
}

 

Ads help maintain this website.