|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.ObjectaQute.libg.cafs.CAFS
public class CAFS
CAFS implements a SHA-1 based file store. The basic idea is that every file in the universe has a unique SHA-1. Hard to believe but people smarter than me have come to that conclusion. This class maintains a compressed store of SHA-1 identified files. So if you have the SHA-1, you can get the contents. This makes it easy to store a SHA-1 instead of the whole file or maintain a naming scheme. An added advantage is that it is always easy to verify you get the right stuff. The SHA-1 Content Addressable File Store is the core underlying idea in Git.
| Constructor Summary | |
|---|---|
CAFS(File home,
boolean create)
Constructor for a Content Addressable File Store |
|
| Method Summary | |
|---|---|
void |
close()
|
boolean |
exists(byte[] sha1)
|
boolean |
isEmpty()
|
Iterator<SHA1> |
iterator()
|
InputStream |
read(SHA1 sha1)
Read the contents of a sha 1 key. |
void |
reindex()
|
SHA1 |
write(InputStream in)
Store an input stream in the CAFS while calculating and returning the SHA-1 code. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public CAFS(File home,
boolean create)
throws Exception
home - create -
Exception| Method Detail |
|---|
public SHA1 write(InputStream in)
throws Exception
in - The input stream to store.
Exception - if anything goes wrong
public InputStream read(SHA1 sha1)
throws Exception
sha1 - The key
Exception
public boolean exists(byte[] sha1)
throws Exception
Exception
public void reindex()
throws Exception
Exception
public void close()
throws IOException
close in interface CloseableIOExceptionpublic Iterator<SHA1> iterator()
iterator in interface Iterable<SHA1>
public boolean isEmpty()
throws IOException
IOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||