Package com.biglybt.core.util
Class StringInterner
java.lang.Object
com.biglybt.core.util.StringInterner
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionprivate static class
private static class
private static class
private static class
private static class
private static class
private static class
-
Field Summary
FieldsModifier and TypeFieldDescriptionprivate static final ByteArrayHashMap
private static final String[]
static boolean
Can't be final as set true for a few specific appsprivate static final int
private static final int
private static final LightHashSet
private static final ReferenceQueue
(package private) static final ReadWriteLock
private static final Comparator
private static final int
private static final int
private static final int
private static final int
private static final boolean
private static final boolean
private static final LightHashSet
private static final ReferenceQueue
-
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionstatic String
intern
(byte[] bytes) static char[]
intern
(char[] toIntern) static String
static byte[]
internBytes
(byte[] toIntern) static File
internFile
(File toIntern) This is based on File.hashCode() and File.equals(), which can return different values for different representations of the same paths.static Object
internObject
(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 URL
private static void
sanitize
(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)
-