Class CodeReaderCache

  • All Implemented Interfaces:
    ICodeReaderCache

    @Deprecated
    public class CodeReaderCache
    extends java.lang.Object
    implements ICodeReaderCache
    Deprecated.
    This is the CodeReaderBuffer used to cache CodeReaders for the ICodeReaderFactory when working with saved copies (primarily SavedCodeReaderFactory).
    Restriction:
    This class is not intended to be subclassed by clients.
    Restriction:
    This class is not intended to be instantiated by clients.
    • Constructor Summary

      Constructors 
      Constructor Description
      CodeReaderCache​(int size)
      Deprecated.
      Creates a CodeReaderCache and sets the size of the CodeReaderCache in MB.
    • Method Summary

      All Methods Instance Methods Concrete Methods Deprecated Methods 
      Modifier and Type Method Description
      protected void finalize()
      Deprecated.
       
      void flush()
      Deprecated.
       
      CodeReader get​(java.lang.String key)
      Deprecated.
      Get a CodeReader from the cache.
      CodeReader get​(java.lang.String key, IIndexFileLocation ifl)
      Deprecated.
      Retrieves the CodeReader corresponding to the key specified that represents the path for that CodeReader.
      int getCurrentSpace()
      Deprecated.
      Returns the current size of the cache.
      CodeReader remove​(java.lang.String key)
      Deprecated.
      Removes the CodeReader from the cache corresponding to the path specified by the key and returns the CodeReader that was removed.
      void setCacheSize​(int size)
      Deprecated.
      Sets the max cache size of this cache in terms of MB.
      • Methods inherited from class java.lang.Object

        clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Field Detail

      • CODE_READER_BUFFER

        public static final java.lang.String CODE_READER_BUFFER
        Deprecated.
        The string used to identify this CodeReaderCache. Mainly used for preferences.
        See Also:
        Constant Field Values
      • DEFAULT_CACHE_SIZE_IN_MB

        public static final int DEFAULT_CACHE_SIZE_IN_MB
        Deprecated.
        The default size of the cache in MB.
        See Also:
        Constant Field Values
      • DEFAULT_CACHE_SIZE_IN_MB_STRING

        public static final java.lang.String DEFAULT_CACHE_SIZE_IN_MB_STRING
        Deprecated.
        A String value of the default size of the cache.
    • Constructor Detail

      • CodeReaderCache

        public CodeReaderCache​(int size)
        Deprecated.
        Creates a CodeReaderCache and sets the size of the CodeReaderCache in MB. Creating a new CodeReaderCache also adds an UpdateCodeReaderCacheListener to the workspace so that when a resource is changed then the CodeReader for that resource is removed from this cache.
        Parameters:
        size - initial size of the CodeReaderCache in terms of MB
    • Method Detail

      • finalize

        protected void finalize()
                         throws java.lang.Throwable
        Deprecated.
        Overrides:
        finalize in class java.lang.Object
        Throws:
        java.lang.Throwable
      • get

        public CodeReader get​(java.lang.String key)
        Deprecated.
        Get a CodeReader from the cache. The key is the char[] filename of the CodeReader to retrieve.
        Specified by:
        get in interface ICodeReaderCache
        Parameters:
        key - the path of the CodeReader to retrieve
        Returns:
        the CodeReader corresponding to the path specified by the key
      • get

        public CodeReader get​(java.lang.String key,
                              IIndexFileLocation ifl)
                       throws org.eclipse.core.runtime.CoreException,
                              java.io.IOException
        Deprecated.
        Description copied from interface: ICodeReaderCache
        Retrieves the CodeReader corresponding to the key specified that represents the path for that CodeReader. If no CodeReader is found in the cache then a new CodeReader is created for the ifl and then returned.
        Specified by:
        get in interface ICodeReaderCache
        Parameters:
        key - the path corresponding to the CodeReader, generally: fileToParse.getLocation().toOSString()
        Returns:
        the CodeReader corresponding to the path specified by the key
        Throws:
        java.io.IOException
        org.eclipse.core.runtime.CoreException
        Since:
        5.1
      • setCacheSize

        public void setCacheSize​(int size)
        Deprecated.
        Sets the max cache size of this cache in terms of MB.
        Parameters:
        size -
      • remove

        public CodeReader remove​(java.lang.String key)
        Deprecated.
        Removes the CodeReader from the cache corresponding to the path specified by the key and returns the CodeReader that was removed. If no CodeReader is removed then null is returned.
        Specified by:
        remove in interface ICodeReaderCache
        Parameters:
        key -
        Returns:
        the removed CodeReader or null if not found
      • getCurrentSpace

        public int getCurrentSpace()
        Deprecated.
        Returns the current size of the cache. For the CodeReaderCache this is in MB.
        Specified by:
        getCurrentSpace in interface ICodeReaderCache