Package com.biglybt.core.util
Class StringInterner
java.lang.Object
com.biglybt.core.util.StringInterner
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static classprivate static classprivate static classprivate static classprivate static classprivate static classprivate static class -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final ByteArrayHashMapprivate static final String[]static booleanCan't be final as set true for a few specific appsprivate static final intprivate static final intprivate static final LightHashSetprivate static final ReferenceQueue(package private) static final ReadWriteLockprivate static final Comparatorprivate static final intprivate static final intprivate static final intprivate static final intprivate static final booleanprivate static final booleanprivate static final LightHashSetprivate static final ReferenceQueue -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic Stringintern(byte[] bytes) static char[]intern(char[] toIntern) static Stringstatic byte[]internBytes(byte[] toIntern) static FileinternFile(File toIntern) This is based on File.hashCode() and File.equals(), which can return different values for different representations of the same paths.static ObjectinternObject(Object toIntern) A generic interning facility for heavyweight or frequently duplicated Objects that have a reasonableequals()implementation.
Important: The objects should have a limited lifespan, the interning set used by this method is unmanaged, i.e.static URLprivate static voidsanitize(boolean scheduled) private static void
-
Field Details
-
DISABLE_INTERNING
public static boolean DISABLE_INTERNINGCan't be final as set true for a few specific apps -
SCHEDULED_CLEANUP_INTERVAL
private static final int SCHEDULED_CLEANUP_INTERVAL- See Also:
-
TRACE_CLEANUP
private static final boolean TRACE_CLEANUP- See Also:
-
TRACE_MULTIHITS
private static final boolean TRACE_MULTIHITS- See Also:
-
IMMEDIATE_CLEANUP_TRIGGER
private static final int IMMEDIATE_CLEANUP_TRIGGER- See Also:
-
IMMEDIATE_CLEANUP_GOAL
private static final int IMMEDIATE_CLEANUP_GOAL- See Also:
-
SCHEDULED_CLEANUP_TRIGGER
private static final int SCHEDULED_CLEANUP_TRIGGER- See Also:
-
SCHEDULED_CLEANUP_GOAL
private static final int SCHEDULED_CLEANUP_GOAL- See Also:
-
SCHEDULED_AGING_THRESHOLD
private static final int SCHEDULED_AGING_THRESHOLD- See Also:
-
managedInterningSet
-
unmanagedInterningSet
-
managedSetLock
-
managedRefQueue
-
unmanagedRefQueue
-
COMMON_KEYS
-
byte_map
-
savingsComp
-
-
Constructor Details
-
StringInterner
public StringInterner()
-
-
Method Details
-
intern
-
internObject
A generic interning facility for heavyweight or frequently duplicated Objects that have a reasonableequals()implementation.
Important: The objects should have a limited lifespan, the interning set used by this method is unmanaged, i.e. does not clean out old entries! Entries without strong references are still removed. -
intern
-
intern
public static char[] intern(char[] toIntern) -
internBytes
public static byte[] internBytes(byte[] toIntern) -
internFile
This is based on File.hashCode() and File.equals(), which can return different values for different representations of the same paths. Thus internFile should be used with canonized Files exclusively -
internURL
-
sanitizeLight
private static void sanitizeLight() -
sanitize
private static void sanitize(boolean scheduled)
-