Class ThresholdStorageProvider
java.lang.Object
org.apache.james.mime4j.storage.AbstractStorageProvider
org.apache.james.mime4j.storage.ThresholdStorageProvider
- All Implemented Interfaces:
StorageProvider
A
StorageProvider that keeps small amounts of data in memory and
writes the remainder to another StorageProvider (the back-end)
if a certain threshold size gets exceeded.
Example usage:
StorageProvider tempStore = new TempFileStorageProvider(); StorageProvider provider = new ThresholdStorageProvider(tempStore, 4096); DefaultStorageProvider.setInstance(provider);
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static final classprivate final class -
Field Summary
Fields -
Constructor Summary
ConstructorsConstructorDescriptionThresholdStorageProvider(StorageProvider backend) Creates a newThresholdStorageProviderfor the given back-end using a threshold size of 2048 bytes.ThresholdStorageProvider(StorageProvider backend, int thresholdSize) Creates a newThresholdStorageProviderfor the given back-end and threshold size. -
Method Summary
Modifier and TypeMethodDescriptionCreates aStorageOutputStreamwhere data to be stored can be written to.Methods inherited from class AbstractStorageProvider
store
-
Field Details
-
backend
-
thresholdSize
private final int thresholdSize
-
-
Constructor Details
-
ThresholdStorageProvider
Creates a newThresholdStorageProviderfor the given back-end using a threshold size of 2048 bytes. -
ThresholdStorageProvider
Creates a newThresholdStorageProviderfor the given back-end and threshold size.- Parameters:
backend- used to store the remainder of the data if the threshold size gets exceeded.thresholdSize- determines how much bytes are kept in memory before that back-end storage provider is used to store the remainder of the data.
-
-
Method Details
-
createStorageOutputStream
Description copied from interface:StorageProviderCreates aStorageOutputStreamwhere data to be stored can be written to. Subsequently the user can calltoStorage()on that object to get aStorageinstance that holds the data that has been written.- Returns:
- a
StorageOutputStreamwhere data can be written to.
-