package me.footlights.core.data.store;

import java.nio.ByteBuffer;
import java.util.*;



/** A block store in memory. */
public class MemoryStore extends LocalStore
{
	public MemoryStore()
	{
		super(null);
		blocks = new HashMap<String,ByteBuffer>();
	}

	
	@Override
	public AbstractCollection<String> list()
	{
		return (AbstractSet<String>) blocks.keySet();
	}

	@Override
	public void put(String name, ByteBuffer bytes) 
	{
		blocks.put(name, bytes);
	}

	@Override
	public ByteBuffer get(String name)
	{
		return blocks.get(name).asReadOnlyBuffer();
	}

	@Override
	public void flush() { /* do nothing; this class always blocks */ }


	/** That actual block store */
	private Map<String,ByteBuffer> blocks;
}

@@ -82,16 +82,70 @@
 til.*;%0A%0A
+import me.footlights.core.data.NoSuchBlockException;%0A%0A
 %0A%0A/** A 
@@ -478,16 +478,70 @@
 es) %0A%09%7B%0A
+%09%09if (name == null) throw new NullPointerException();%0A
 %09%09blocks
@@ -569,26 +569,25 @@
 %0A%0A%09@Override
-%0A%09
+ 
 public ByteB
@@ -612,37 +612,167 @@
 ame)
-%0A%09%7B%0A%09%09return blocks.get(name)
+ throws NoSuchBlockException%0A%09%7B%0A%09%09ByteBuffer buffer = blocks.get(name);%0A%0A%09%09if (buffer == null) throw new NoSuchBlockException(this, name);%0A%09%09else return buffer
 .asR

Throw exception rather than return null.