commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From bugzi...@apache.org
Subject DO NOT REPLY [Bug 37614] - [jci] MemoryResourceStore should using standard class file names for keys
Date Wed, 23 Nov 2005 18:18:11 GMT
DO NOT REPLY TO THIS EMAIL, BUT PLEASE POST YOUR BUG·
RELATED COMMENTS THROUGH THE WEB INTERFACE AVAILABLE AT
<http://issues.apache.org/bugzilla/show_bug.cgi?id=37614>.
ANY REPLY MADE TO THIS MESSAGE WILL NOT BE COLLECTED AND·
INSERTED IN THE BUG DATABASE.

http://issues.apache.org/bugzilla/show_bug.cgi?id=37614





------- Additional Comments From mproctor@codehaus.org  2005-11-23 19:18 -------
public final class MemoryResourceStore implements ResourceStore {

    private final static Log log = LogFactory.getLog(MemoryResourceStore.class);

	private final Map store = new HashMap();
	
	public byte[] read( final String resourceName ) {
		return (byte[]) store.get(resourceName.replace('.', '/') + ".class");
	}

	public void write( final String resourceName, final byte[] clazzData ) {
		log.debug("storing resource " + resourceName + "(" + clazzData.length + ")");
		store.put(resourceName.replace('.', '/') + ".class", clazzData);
	}
	
    public void remove( final String resourceName ) {
        log.debug("removing resource " + resourceName);
        store.remove(resourceName.replace('.', '/') + ".class");
    }

    public String toString() {
        return this.getClass().getName() + store.toString();
    }
            
    public String[] list() {
        if ( store == null ) {
            return new String[0];
        }
        return ( String[] ) this.store.keySet().toArray( new String[
this.store.size() ] );
    }
}

-- 
Configure bugmail: http://issues.apache.org/bugzilla/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are the assignee for the bug, or are watching the assignee.

---------------------------------------------------------------------
To unsubscribe, e-mail: commons-dev-unsubscribe@jakarta.apache.org
For additional commands, e-mail: commons-dev-help@jakarta.apache.org


Mime
View raw message