Class 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)
    • Constructor Detail

      • CachedDataInput

        public CachedDataInput()
      • CachedDataInput

        public CachedDataInput​(java.nio.ByteBuffer initialLayer,
                               int layersCacheCountLimit,
                               boolean isInHeapMem)
    • Method Detail

      • getLayer

        public final java.nio.ByteBuffer getLayer​(int layerIndex)
                                           throws java.lang.OutOfMemoryError
        Specified by:
        getLayer in interface DataInput
        Specified by:
        getLayer in class DataInputBase
        Throws:
        java.lang.OutOfMemoryError
      • close

        public void close()
                   throws java.io.IOException
        Specified by:
        close in interface java.lang.AutoCloseable
        Specified by:
        close in interface java.io.Closeable
        Overrides:
        close in class DataInputBase
        Throws:
        java.io.IOException
      • toString

        public final java.lang.String toString()
        Overrides:
        toString in class java.lang.Object