Package com.emc.mongoose.base.data
Class CachedDataInput
- java.lang.Object
-
- com.emc.mongoose.base.data.DataInputBase
-
- com.emc.mongoose.base.data.CachedDataInput
-
- All Implemented Interfaces:
DataInput,java.io.Closeable,java.lang.AutoCloseable
- Direct Known Subclasses:
ExternalDataInput,SeedDataInput
public class CachedDataInput extends DataInputBase
Created by andrey on 24.07.17. The data input able to produce the layer of different data using the given layer index. Also caches the layers using the layers count limit to not to exhaust the available memory. The allocated off-heap memory is calculated as layersCacheCountLimit * layerSize (worst case)
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface com.emc.mongoose.base.data.DataInput
DataInput.Type
-
-
Field Summary
-
Fields inherited from class com.emc.mongoose.base.data.DataInputBase
inputBuff
-
-
Constructor Summary
Constructors Constructor Description CachedDataInput()CachedDataInput(CachedDataInput other)CachedDataInput(java.nio.ByteBuffer initialLayer, int layersCacheCountLimit, boolean isInHeapMem)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidclose()java.nio.ByteBuffergetLayer(int layerIndex)java.lang.StringtoString()-
Methods inherited from class com.emc.mongoose.base.data.DataInputBase
getSize
-
-
-
-
Constructor Detail
-
CachedDataInput
public CachedDataInput()
-
CachedDataInput
public CachedDataInput(java.nio.ByteBuffer initialLayer, int layersCacheCountLimit, boolean isInHeapMem)
-
CachedDataInput
public CachedDataInput(CachedDataInput other)
-
-
Method Detail
-
getLayer
public final java.nio.ByteBuffer getLayer(int layerIndex) throws java.lang.OutOfMemoryError- Specified by:
getLayerin interfaceDataInput- Specified by:
getLayerin classDataInputBase- Throws:
java.lang.OutOfMemoryError
-
close
public void close() throws java.io.IOException- Specified by:
closein interfacejava.lang.AutoCloseable- Specified by:
closein interfacejava.io.Closeable- Overrides:
closein classDataInputBase- Throws:
java.io.IOException
-
toString
public final java.lang.String toString()
- Overrides:
toStringin classjava.lang.Object
-
-