public class TempFileBucket extends BaseFileBucket implements Bucket, java.io.Serializable
Modifier and Type | Field and Description |
---|---|
protected FilenameGenerator |
generator |
fileRestartCounter, MAGIC, tempDir
Modifier | Constructor and Description |
---|---|
protected |
TempFileBucket() |
protected |
TempFileBucket(java.io.DataInputStream dis) |
|
TempFileBucket(long id,
FilenameGenerator generator) |
protected |
TempFileBucket(long id,
FilenameGenerator generator,
boolean deleteOnFree)
Constructor for the TempFileBucket object
Subclasses can call this constructor.
|
Modifier and Type | Method and Description |
---|---|
protected boolean |
createFileOnly()
If true, we will fail if the file already exist.
|
RandomAccessBucket |
createShadow()
Create a shallow read-only copy of this bucket, using different
objects but using the same external storage.
|
protected boolean |
deleteOnExit() |
protected boolean |
deleteOnFree() |
boolean |
equals(java.lang.Object obj) |
java.io.File |
getFile()
Returns the file object this buckets data is kept in.
|
int |
hashCode() |
protected void |
innerResume(ClientContext context) |
boolean |
isReadOnly()
Is the bucket read-only?
|
protected int |
magic() |
void |
onResume(ClientContext context)
Called after restarting.
|
protected boolean |
persistent() |
void |
setReadOnly()
Make the bucket read-only.
|
void |
storeTo(java.io.DataOutputStream dos)
Write enough data to reconstruct the Bucket, or throw UnsupportedOperationException.
|
protected boolean |
tempFileAlreadyExists()
If true, then the file is temporary and must already exist, so we will just open it.
|
deleteFile, free, free, getInputStream, getInputStreamUnbuffered, getName, getOutputStream, getOutputStreamUnbuffered, getPersistentTempID, getTempDir, getTempfile, setDeleteOnExit, setTempDir, size, split, toRandomAccessBuffer, toString
clone, finalize, getClass, notify, notifyAll, wait, wait, wait
free, getInputStream, getInputStreamUnbuffered, getName, getOutputStream, getOutputStreamUnbuffered, size
protected transient FilenameGenerator generator
public TempFileBucket(long id, FilenameGenerator generator)
protected TempFileBucket(long id, FilenameGenerator generator, boolean deleteOnFree)
deleteOnExit
- Set if you want the bucket deleted on shutdown. Passed to
the parent BaseFileBucket. You must also override deleteOnExit() and
implement your own createShadow()!deleteOnFree
- True for a normal temp bucket, false for a shadow.protected TempFileBucket()
protected TempFileBucket(java.io.DataInputStream dis) throws java.io.IOException, StorageFormatException
java.io.IOException
StorageFormatException
protected boolean createFileOnly()
BaseFileBucket
createFileOnly
in class BaseFileBucket
protected boolean deleteOnFree()
deleteOnFree
in class BaseFileBucket
public java.io.File getFile()
BaseFileBucket
getFile
in class BaseFileBucket
public boolean isReadOnly()
Bucket
isReadOnly
in interface Bucket
public void setReadOnly()
Bucket
setReadOnly
in interface Bucket
protected boolean deleteOnExit()
deleteOnExit
in class BaseFileBucket
public RandomAccessBucket createShadow()
Bucket
createShadow
in interface Bucket
createShadow
in interface RandomAccessBucket
protected void innerResume(ClientContext context) throws ResumeFailedException
ResumeFailedException
public final void onResume(ClientContext context) throws ResumeFailedException
Bucket
onResume
in interface Bucket
onResume
in class BaseFileBucket
context
- All the necessary runtime support will be on this object.ResumeFailedException
protected boolean persistent()
protected boolean tempFileAlreadyExists()
BaseFileBucket
tempFileAlreadyExists
in class BaseFileBucket
public void storeTo(java.io.DataOutputStream dos) throws java.io.IOException
Bucket
storeTo
in interface Bucket
storeTo
in class BaseFileBucket
java.io.IOException
protected int magic()
public int hashCode()
hashCode
in class java.lang.Object
public boolean equals(java.lang.Object obj)
equals
in class java.lang.Object