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

org.purplejrank.mods.ScanningJrankInput Maven / Gradle / Ivy

There is a newer version: 1.1.2
Show newest version
package org.purplejrank.mods;

import java.io.EOFException;
import java.io.IOException;
import java.io.InputStream;
import java.nio.channels.ReadableByteChannel;
import java.util.ArrayList;
import java.util.List;

import org.purplejrank.JrankClass;

public class ScanningJrankInput extends NullsJrankInput {
	
	protected List streamClasses;
	protected List resolvedClasses;
	protected List unresolvedClasses;

	public ScanningJrankInput(InputStream in, ClassLoader cl)
			throws IOException {
		super(in, cl);
	}

	public ScanningJrankInput(InputStream in) throws IOException {
		super(in);
	}

	public ScanningJrankInput(ReadableByteChannel in, ClassLoader cl)
			throws IOException {
		super(in, cl);
	}

	public ScanningJrankInput(ReadableByteChannel in) throws IOException {
		super(in);
	}

	public List scan() throws IOException, ClassNotFoundException {
		try {
			skipOptionalData();
		} catch(EOFException e) {
		}
		streamClasses = new ArrayList();
		resolvedClasses = new ArrayList();
		unresolvedClasses = new ArrayList();
		for(Object w : wired) {
			if(w instanceof JrankClass) {
				JrankClass d = (JrankClass) w;
				streamClasses.add(d);
				if(d.getType() != null)
					resolvedClasses.add(d);
				else
					unresolvedClasses.add(d);
			}
		}
		return streamClasses;
	}

	public List getStreamClasses() {
		if(streamClasses == null)
			throw new IllegalStateException("scan() not called");
		return streamClasses;
	}

	public List getResolvedClasses() {
		if(resolvedClasses == null)
			throw new IllegalStateException("scan() not called");
		return resolvedClasses;
	}
	
	public List getUnresolvedClasses() {
		if(unresolvedClasses == null)
			throw new IllegalStateException("scan() not called");
		return unresolvedClasses;
	}
	
	@Override
	protected Object newOrdinaryObject(JrankClass desc) throws IOException,
			ClassNotFoundException {
		return null;
	}
	
	@Override
	protected Object newArray(JrankClass desc, int size) {
		return null;
	}
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy