|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
An interface for objects that are modeling the usual OS files. Here we extend the file definition by giving children and content to all of them.
Store can be actual file on hard drives, but can be ZIP files, file stored on a remote FTP server, memory data, a database...
Conformance tests are available to validate the store implementations.
The main reason for this interface is to be able to write tests that need files without having to actually write data on disk (and clean up). The interface is simple so that writing mock objects is very easy.
package
Method Summary | |
Store |
add(java.lang.String name)
Creates a new store and adds it as children |
void |
attach(Store store)
reserved not yet defined |
Store |
child(java.lang.String name)
Returns the child store with the given name |
java.util.Collection |
children()
|
void |
create()
Creates the store regarding to the persistent storage (if applicable) |
boolean |
delete()
Deletes the store and its content |
void |
detach(Store store)
reserved not yet defined |
boolean |
exists()
|
java.lang.String |
getName()
|
Store |
getParent()
|
java.lang.String |
getType()
|
java.io.InputStream |
input()
|
java.io.OutputStream |
output()
|
java.io.PrintWriter |
printWriter()
|
java.io.Reader |
reader()
|
boolean |
remove(java.lang.String name)
Removes the child with the given name from the children list |
void |
setParent(Store store)
|
void |
sync()
Flushes, writes, on persistent storage data that need to be saved (if applicable) |
java.io.Writer |
writer()
|
Method Detail |
public java.lang.String getName()
public java.lang.String getType()
public void sync()
public void create()
public boolean exists()
public boolean delete()
public java.io.InputStream input()
public java.io.OutputStream output()
public java.io.Reader reader()
public java.io.Writer writer()
public java.io.PrintWriter printWriter()
public Store getParent()
public void setParent(Store store)
public void attach(Store store)
public void detach(Store store)
public java.util.Collection children()
public Store child(java.lang.String name)
name
- of the child to retrieve
public Store add(java.lang.String name)
name
- of the new child
public boolean remove(java.lang.String name)
name
- the name of the child to remove
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |