|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectuk.ac.vamsas.client.simpleclient.Lock
transient object representing a file lock This lock should hold for all processes interacting in a session.
Field Summary | |
protected org.apache.commons.logging.Log |
log
|
protected java.io.RandomAccessFile |
rafile
|
Constructor Summary | |
protected |
Lock(java.io.File lockfile)
creates a valid Lock (test with |
Method Summary | |
protected void |
finalize()
|
java.io.BufferedInputStream |
getBufferedInputStream(boolean atStart)
return buffered input stream for locked file. |
abstract java.io.BufferedOutputStream |
getBufferedOutputStream(boolean clear)
return buffered output stream to locked file. |
abstract java.io.FileInputStream |
getFileInputStream(boolean atStart)
gets Locked Stream for reading from |
abstract java.io.FileOutputStream |
getFileOutputStream(boolean clear)
gets Locked stream to write to FileInput always starts at the *end* of the file (after any truncation) |
abstract java.nio.channels.FileChannel |
getRaChannel()
|
abstract java.io.RandomAccessFile |
getRaFile()
|
abstract boolean |
isLocked()
|
abstract boolean |
isTargetLockFile(java.io.File afile)
test whether the given file is a target or related to the lock on the target file. |
abstract long |
length()
safe lock target length() function. |
abstract void |
release()
release lock and close all managed channels to file |
abstract void |
release(boolean closeChannel)
optionally close the open random access channel on the file when releasing lock |
Methods inherited from class java.lang.Object |
clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
protected org.apache.commons.logging.Log log
protected java.io.RandomAccessFile rafile
Constructor Detail |
protected Lock(java.io.File lockfile)
lockfile
- Method Detail |
public abstract boolean isTargetLockFile(java.io.File afile)
afile
- a file
public abstract boolean isLocked()
public abstract void release()
public abstract void release(boolean closeChannel)
closeChannel
- public abstract java.io.FileInputStream getFileInputStream(boolean atStart) throws java.io.IOException
atStart
- true to start reading at beginning of file.
java.io.IOException
public abstract java.io.FileOutputStream getFileOutputStream(boolean clear) throws java.io.IOException
clear
- true means file will be cleared to zero length
java.io.IOException
public abstract java.io.BufferedOutputStream getBufferedOutputStream(boolean clear) throws java.io.IOException
clear
- - true means file is truncated to 0 length before writing
java.io.IOException
protected void finalize() throws java.lang.Throwable
java.lang.Throwable
public java.io.BufferedInputStream getBufferedInputStream(boolean atStart) throws java.io.IOException
atStart
- - true means read from begining of file
java.io.IOException
public abstract long length()
public abstract java.io.RandomAccessFile getRaFile() throws java.io.IOException
java.io.IOException
public abstract java.nio.channels.FileChannel getRaChannel() throws java.io.IOException
java.io.IOException
|
|||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |