|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object com.octo.captcha.engine.bufferedengine.buffer.DiskCaptchaBuffer
public class DiskCaptchaBuffer
Simple implmentation of a disk captcha buffer
Constructor Summary | |
---|---|
DiskCaptchaBuffer(java.lang.String fileName,
boolean persistant)
Constructor for a disk captcha buffer |
Method Summary | |
---|---|
float |
calculateDataFileSparseness()
The design of the layout on the data file means that there will be small gaps created when DiskElements are reused. |
void |
clear()
Clear the buffer from all locale |
void |
clearFile()
Removes all cached items from the cache. |
void |
dispose()
Shuts down the disk store in preparation for cache shutdown If a VM crash happens, the shutdown hook will not run. |
java.lang.String |
getDataFileName()
|
long |
getDataFileSize()
|
java.lang.String |
getIndexFileName()
|
long |
getIndexFileSize()
|
java.util.Collection |
getLocales()
Get all the locales used |
long |
getTotalFileSize()
|
long |
getUsedDataSize()
When elements are deleted, spaces are left in the file. |
int |
maxSize()
|
void |
putAllCaptcha(java.util.Collection captchas)
Put a collection of captchas with the default locale |
void |
putAllCaptcha(java.util.Collection captchas,
java.util.Locale locale)
Put a collection of captchas with his locale |
void |
putCaptcha(Captcha captcha)
Put a captcha with default laocale |
void |
putCaptcha(Captcha captcha,
java.util.Locale locale)
Put a captcha with a locale |
protected java.util.Collection |
remove(int number,
java.util.Locale locale)
Gets an entry from the Disk Store. |
Captcha |
removeCaptcha()
remove a captcha from the buffer |
java.util.Collection |
removeCaptcha(int number)
Remove a precise number of captcha |
java.util.Collection |
removeCaptcha(int number,
java.util.Locale locale)
Remove a precise number of captcha with a locale |
Captcha |
removeCaptcha(java.util.Locale locale)
remove a captcha from the buffer corresponding to the locale |
int |
size()
Get the size of the buffer for all locales |
int |
size(java.util.Locale locale)
Get the size of the buffer for a locale |
protected void |
store(java.util.Collection collection,
java.util.Locale locale)
Puts items into the store. |
protected void |
store(java.lang.Object element,
java.util.Locale locale)
Puts items into the store. |
java.lang.String |
toString()
Returns a String representation of the DiskCaptchaBuffer |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, wait, wait, wait |
Constructor Detail |
---|
public DiskCaptchaBuffer(java.lang.String fileName, boolean persistant)
fileName
- like c:/temp/namepersistant
- If the disk buffer is persistant, it will try to load from file name .data et .index existing
dataMethod Detail |
---|
protected java.util.Collection remove(int number, java.util.Locale locale) throws java.io.IOException
java.io.IOException
protected void store(java.util.Collection collection, java.util.Locale locale) throws java.io.IOException
java.io.IOException
protected void store(java.lang.Object element, java.util.Locale locale) throws java.io.IOException
java.io.IOException
public void clearFile() throws java.io.IOException
java.io.IOException
public void dispose()
dispose
in interface CaptchaBuffer
public java.lang.String toString()
String
representation of the DiskCaptchaBuffer
toString
in class java.lang.Object
public long getTotalFileSize()
public long getDataFileSize()
public float calculateDataFileSparseness()
public long getUsedDataSize()
getDataFileSize()
as a measure of fragmentation.
public long getIndexFileSize()
public java.lang.String getDataFileName()
public java.lang.String getIndexFileName()
public Captcha removeCaptcha() throws java.util.NoSuchElementException
CaptchaBuffer
removeCaptcha
in interface CaptchaBuffer
java.util.NoSuchElementException
- if there is no captcha throw NoSuchElementExceptionCaptchaBuffer.removeCaptcha()
public java.util.Collection removeCaptcha(int number)
CaptchaBuffer
removeCaptcha
in interface CaptchaBuffer
number
- The number of captchas to remove
CaptchaBuffer.removeCaptcha(int)
public void putCaptcha(Captcha captcha)
CaptchaBuffer
putCaptcha
in interface CaptchaBuffer
CaptchaBuffer.putCaptcha(com.octo.captcha.Captcha)
public void putAllCaptcha(java.util.Collection captchas)
CaptchaBuffer
putAllCaptcha
in interface CaptchaBuffer
captchas
- The captchas to addCaptchaBuffer.putAllCaptcha(java.util.Collection)
public int size()
CaptchaBuffer
size
in interface CaptchaBuffer
CaptchaBuffer.size()
public int maxSize()
com.octo.captcha.engine.bufferedengine.buffer.CaptchaBuffer#maxSize()
public Captcha removeCaptcha(java.util.Locale locale) throws java.util.NoSuchElementException
CaptchaBuffer
removeCaptcha
in interface CaptchaBuffer
locale
- The locale the catcha to remove
java.util.NoSuchElementException
- if there is no captcha throw NoSuchElementExceptionCaptchaBuffer.removeCaptcha(java.util.Locale)
public java.util.Collection removeCaptcha(int number, java.util.Locale locale)
CaptchaBuffer
removeCaptcha
in interface CaptchaBuffer
number
- The number of captchas to removelocale
- The locale of the removed captchas
CaptchaBuffer.removeCaptcha(int, java.util.Locale)
public void putCaptcha(Captcha captcha, java.util.Locale locale)
CaptchaBuffer
putCaptcha
in interface CaptchaBuffer
captcha
- The captcha to addlocale
- the locale of the captchaCaptchaBuffer.putCaptcha(com.octo.captcha.Captcha,
java.util.Locale)
public void putAllCaptcha(java.util.Collection captchas, java.util.Locale locale)
CaptchaBuffer
putAllCaptcha
in interface CaptchaBuffer
captchas
- The captchas to addlocale
- The locale of the captchasCaptchaBuffer.putAllCaptcha(java.util.Collection,
java.util.Locale)
public int size(java.util.Locale locale)
CaptchaBuffer
size
in interface CaptchaBuffer
locale
- the locale to get the size
CaptchaBuffer.size(java.util.Locale)
public void clear()
CaptchaBuffer
clear
in interface CaptchaBuffer
CaptchaBuffer.clear()
public java.util.Collection getLocales()
CaptchaBuffer
getLocales
in interface CaptchaBuffer
CaptchaBuffer.getLocales()
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |