org.gloin.resource
Class FileByteStore

java.lang.Object
  |
  +--org.gloin.resource.FileByteStore
All Implemented Interfaces:
ByteStore

public class FileByteStore
extends java.lang.Object
implements ByteStore

ByteStore that stores and retrieves class files from a local file system. This code is based on the code retrieval capabilities of the http code server that ships with the JSK.


Fields inherited from interface org.gloin.resource.ByteStore
DONT_REPLACE, REPLACE, REPLACE_IF_EMPTY
 
Constructor Summary
FileByteStore()
           
FileByteStore(java.lang.String dir, boolean verbose)
           
 
Method Summary
 byte[] getBytes(java.lang.String pathName)
          Return the bytes of the requested file.
 java.lang.String[] list()
           
 void removeBytes(java.lang.String pathName)
           
 boolean resourceFilled(java.lang.String resourceName)
           
 void saveBytes(java.lang.String pathName, byte[] bytes, int replace)
           
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

FileByteStore

public FileByteStore()
              throws java.io.IOException

FileByteStore

public FileByteStore(java.lang.String dir,
                     boolean verbose)
              throws java.io.IOException
Parameters:
dir - the directory to serve files from
verbose - true if downloads should be logged
Method Detail

resourceFilled

public boolean resourceFilled(java.lang.String resourceName)
                       throws java.io.IOException

list

public java.lang.String[] list()
                        throws java.io.IOException
Specified by:
list in interface ByteStore

saveBytes

public void saveBytes(java.lang.String pathName,
                      byte[] bytes,
                      int replace)
               throws java.io.IOException
Specified by:
saveBytes in interface ByteStore

removeBytes

public void removeBytes(java.lang.String pathName)
                 throws java.io.IOException
Specified by:
removeBytes in interface ByteStore

getBytes

public byte[] getBytes(java.lang.String pathName)
                throws java.io.IOException
Return the bytes of the requested file.
Specified by:
getBytes in interface ByteStore