Package opennlp.tools.util.jvm

# Class JvmStringInterner

java.lang.Object
opennlp.tools.util.jvm.JvmStringInterner

All Implemented Interfaces:
  `StringInterner`

@Internal @ThreadSafe public class JvmStringInterner extends Object implements StringInterner
A `StringInterner` implementation based on `String.intern()`. Strings interned via this implementation are put into PermGen space. If needed, the PermGen memory can be increased by the JVM argument `-XX:MaxPermSize`.

Using this `StringInterner` brings back the default behaviour of OpenNLP before version `2.3.2`. You can use it by setting the system property `opennlp.interner.class` to the fully qualified classname of a `StringInterner` implementation.

- ## Constructor Summary

  Constructors
  Constructor
  Description
  `JvmStringInterner()`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `String`
  `intern(String sample)`
  Interns and returns a reference to the representative instance for any collection of string instances that are equal to each other.

  ### Methods inherited from class java.lang.Object

  `equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- ## Constructor Details

  - ### JvmStringInterner

    public JvmStringInterner()

- ## Method Details

  - ### intern

    public String intern(String sample)
    Interns and returns a reference to the representative instance for any collection of string instances that are equal to each other.
    Specified by:
      `intern` in interface `StringInterner`
    Parameters:
      `sample` - string instance to be interned
    Returns:
      reference to the interned string instance