Package-level declarations
Types
port of java.util.concurrent.AbstractExecutorService
A synchronizer that may be exclusively owned by a thread. This class provides a basis for creating locks and related synchronizers that may entail a notion of ownership. The AbstractOwnableSynchronizer class itself does not manage or use this information. However, subclasses and tools may use appropriately maintained values to help control and monitor access and provide diagnostics.
This class provides skeletal implementations of some Queue operations. The implementations in this class are appropriate when the base implementation does not allow null elements. Methods .add, .remove, and .element are based on .offer, .poll, and .peek, respectively, but throw exceptions instead of indicating failure via false or null returns.
Provides a framework for implementing blocking locks and related synchronizers (semaphores, events, etc) that rely on first-in-first-out (FIFO) wait queues. This class is designed to be a useful basis for most kinds of synchronizers that rely on a single atomic int value to represent state. Subclasses must define the protected methods that change this state, and which define what that state means in terms of this object being acquired or released. Given these, the other methods in this class carry out all queuing and blocking mechanics. Subclasses can maintain other state fields, but only the atomically updated int value manipulated using methods .getState, .setState and .compareAndSetState is tracked with respect to synchronization.
Port of java.nio.file.AccessDeniedException.
Checked exception received by a thread when another thread closes the channel or the part of the channel upon which it is blocked in an I/O operation.
port of java.nio.file.AtomicMoveNotSupportedException
This class implements a vector of bits that grows as needed. Each component of the bit set has a boolean value. The bits of a BitSet are indexed by nonnegative integers. Individual indexed bits can be examined, set, or cleared. One BitSet may be used to modify the contents of another BitSet through logical AND, logical inclusive OR, and logical exclusive OR operations.
port of java.util.concurrent.BlockingQueue
The BreakIterator class implements methods for finding the location of boundaries in text. Instances of BreakIterator maintain a current position and scan over text returning the index of characters where boundaries occur. Internally, BreakIterator scans text using a CharacterIterator, and is thus able to scan text held by any object implementing that protocol. A StringCharacterIterator is used to scan String objects passed to setText.
An abstract class for service providers that provide concrete implementations of the java.text.BreakIterator class.
Concrete implementation of the java.text.spi.BreakIteratorProvider class for the JRE LocaleProviderAdapter.
Port of java.util.concurrent.BrokenBarrierException.
A BufferedInputStream adds functionality to another input stream-namely, the ability to buffer the input and to support the mark and reset methods. When the BufferedInputStream is created, an internal buffer array is created. As bytes from the stream are read or skipped, the internal buffer is refilled as necessary from the contained input stream, many bytes at a time. The mark operation remembers a point in the input stream and the reset operation causes all the bytes read since the most recent mark operation to be reread before new bytes are taken from the contained input stream.
port of java.io.BufferedOutputStream
Reads text from a character-input stream, buffering characters so as to provide for the efficient reading of characters, arrays, and lines.
port of java.io.BufferedWriter
A ByteArrayInputStream contains an internal buffer that contains bytes that may be read from the stream. An internal counter keeps track of the next byte to be supplied by the read method.
This class implements an output stream in which the data is written into a byte array. The buffer automatically grows as data is written to it. The data can be retrieved using toByteArray() and toString().
A channel that can read and write bytes. This interface simply unifies ReadableByteChannel and WritableByteChannel; it does not specify any new operations.
port of java.lang.Character
This interface defines a protocol for bidirectional iteration over text. The iterator iterates over a bounded sequence of characters. Characters are indexed with values beginning with the value returned by getBeginIndex() and continuing through the value returned by getEndIndex()-1.
port of java.nio.CharBuffer
A minimal multiplatform dummy port of java.nio.charset.Charset. This implementation supports only UTF-8.
An engine that can transform a sequence of bytes in a specific charset into a sequence of sixteen-bit Unicode characters.
An engine that can transform a sequence of sixteen-bit Unicode characters into a sequence of bytes in a specific charset.
An output stream that also maintains a checksum of the data being written. The checksum can then be used to verify the integrity of the output data.
No-op classloader for Kotlin Multiplatform. Mimics java.lang.ClassLoader
Checked exception received by a thread when another thread interrupts it while it is blocked in an I/O operation upon a channel. Before this exception is thrown the channel will have been closed and the interrupt status of the previously-blocked thread will have been set.
Checked exception thrown when an attempt is made to invoke or complete an I/O operation upon channel that is closed, or at least closed to that operation. That this exception is thrown does not necessarily imply that the channel is completely closed. A socket channel whose write half has been shut down, for example, may still be open for reading.
Error thrown when the decodeLoop method of a CharsetDecoder, or the encodeLoop method of a CharsetEncoder, throws an unexpected exception.
A description of the result state of a coder.
A typesafe enumeration for coding-error actions.
A service that decouples the production of new asynchronous tasks from the consumption of the results of completed tasks. Producers submit tasks for execution. Consumers take completed tasks and process their results in the order they complete. A CompletionService can for example be used to manage asynchronous I/O, in which tasks that perform reads are submitted in one part of a program or system, and then acted upon in a different part of the program when the reads complete, possibly in a different order than they were requested.
Condition factors out the Object monitor methods (Object.wait, Object.notify and Object.notifyAll) into distinct objects to give the effect of having multiple wait-sets per object, by combining them with the use of arbitrary Lock implementations. Where a Lock replaces the use of synchronized methods and statements, a Condition replaces the use of the Object monitor methods.
port of java.nio.file.CopyOption
Optional extension for Runnables that can run cooperatively in a coroutine. If a Runnable also implements this, ThreadFactory implementations may invoke runSuspending inside a coroutine rather than calling Runnable.run, avoiding nested runBlocking and enabling proper cancellation/wakeups.
Port of java.util.concurrent.CyclicBarrier.
ported from java.util.zip.DataFormatException
placeholder for java.text.DecimalFormat which is used in org.gnit.lucenekmp.util.RamUsageEstimator org.gnit.lucenekmp.util.RamUsageEstimator does not use this but it is kept here for porting progress script to mark the class ported
A subclass of RuleBasedBreakIterator that adds the ability to use a dictionary to further subdivide ranges of text beyond what is possible using just the state-table-based algorithm. This is necessary, for example, to handle word and line breaking in Thai, which doesn't use spaces between words. The state-table-based algorithm used by RuleBasedBreakIterator is used to divide up text as far as possible, and then contiguous ranges of letters are repeatedly compared against a list of known words (i.e., the dictionary) to divide them up into words.
ported from jdk.internal.math.DoubleConsts
A specialized Set implementation for use with enum types. All of the elements in an enum set must come from a single enum type that is specified, explicitly or implicitly, when the set is created. Enum sets are represented internally as bit vectors. This representation is extremely compact and efficient. The space and time performance of this class should be good enough to allow its use as a high-quality, typesafe alternative to traditional int-based "bit flags." Even bulk operations (such as containsAll and retainAll) should run very quickly if their argument is also an enum set.
Exception to replace java.util.concurrent.ExecutionException
A CompletionService that uses a supplied Executor to execute tasks. This class arranges that submitted tasks are, upon completion, placed on a queue accessible using take. The class is lightweight enough to be suitable for transient use when processing groups of tasks.
port of java.util.concurrent.ExecutorService
port of java.nio.file.FileAlreadyExistsException
Thrown when a file system operation fails on one or two files. This class is the general class for file system exceptions.
port of java.io.FilterInputStream
This class is the superclass of all classes that filter output streams. These streams sit on top of an already existing output stream (the underlying output stream) which it uses as its basic sink of data, but possibly transforming the data along the way or providing additional functionality.
ported from java.nio.FloatBuffer
A cancellable asynchronous computation. This class provides a base implementation of Future, with methods to start and cancel a computation, query to see if the computation is complete, and retrieve the result of the computation. The result can only be retrieved when the computation has completed; the get methods will block if the computation has not yet completed. Once the computation has completed, the computation cannot be restarted or cancelled (unless the computation is invoked using runAndReset).
port of java.net.Inet4Address
port of java.net.Inet6Address
minimum implementation to support usage in lucene
A single input source for an XML entity.
This abstract class is the superclass of all classes representing an input stream of bytes.
port of InputStreamReader
Thrown when a thread is waiting, sleeping, or otherwise occupied, and the thread is interrupted, either before or during the activity. Occasionally a method may wish to test whether the current thread has been interrupted, and if so, to immediately throw this exception. The following code can be used to achieve this effect: {@snippet lang=java :
A channel that can be asynchronously closed and interrupted.
port of sun.net.util.IPAddressUtil
port of java.lang.ClassValue
Multiplatform buffered character reader that mirrors the API of Java's BufferedReader:contentReferenceoaicite:0{index=0}. It reads text from a Source (byte stream) and buffers characters to provide efficient reading of single characters, arrays, and lines:contentReferenceoaicite:1{index=1}. The buffer size may be specified, or a default size (8192) is used, which is large enough for most purposes:contentReferenceoaicite:2{index=2}.
A buffered character-input stream that keeps track of line numbers. This class defines methods .setLineNumber and .getLineNumber for setting and getting the current line number respectively.
ported to keep API surface compatible with Java lucene However, as I ever know, only QueryParserBase and some class are using Locale for the purpose of generating RangeQuery and Locale is used to feed DateFormat to get date instance. This operation can be ignored as we can implement equivalent without using Locale.
The LocaleProviderAdapter abstract class.
This is the super class of all the locale sensitive service provider interfaces (SPIs).
Basic thread blocking primitives for creating locks and other synchronization classes.
A platform-agnostic LongBuffer built on top of a kotlin‑io Buffer.
ported from java.nio.charset.MalformedInputException
A SortedMap extended with navigation methods returning the closest matches for given search targets. Methods .lowerEntry, .floorEntry, .ceilingEntry, and .higherEntry return Map.Entry objects associated with keys respectively less than, less than or equal, greater than or equal, and greater than a given key, returning null if there is no such key. Similarly, methods .lowerKey, .floorKey, .ceilingKey, and .higherKey return only the associated keys. All of these methods are designed for locating, not traversing entries.
A SortedSet extended with navigation methods reporting closest matches for given search targets. Methods .lower, .floor, .ceiling, and .higher return elements respectively less than, less than or equal, greater than or equal, and greater than a given element, returning null if there is no such element.
port of java.nio.file.NoSuchFileException
An immutable container for a key and a value, both of which are nullable.
A OutputStream implementation which uses either okio.Sink or okio.Buffer
A InputStream implementation which use okio.Source
port of java.nio.file.OpenOption
port of java.io.OutputStream
port of java.io.OutputStreamWriter
ported from java.text.ParseException
caution: only minimum functionality which is called by lucene is implemented
minimum port of java.io.PrintWriter just to make it work in lucene-kmp
Placeholder for java.security.PrivilegedAction.
Port of java.nio.file.ProviderMismatchException.
port of java.util.Queue
A channel that can read bytes.
A minimal multiplatform abstraction for reading characters. This class mimics many of the core methods of java.io.Reader, but only those that you really need.
Port of java.util.concurrent.locks.ReentrantLock.
A simple mimic of Java's java.lang.ref.ReferenceQueue.
port of java.util.concurrent.RejectedExecutionException
A handler for tasks that cannot be executed by a ThreadPoolExecutor.
A subclass of BreakIterator whose behavior is specified using a list of rules.
Interface to replace java.util.concurrent.RunnableFuture
A byte channel that maintains a current position and allows the position to be changed.
A collection that has a well-defined encounter order, that supports operations at both ends, and that is reversible. The elements of a sequenced collection have an encounter order, where conceptually the elements have a linear arrangement from the first element to the last element. Given any two elements, one element is either before (closer to the first element) or after (closer to the last element) the other element.
A Map that has a well-defined encounter order, that supports operations at both ends, and that is reversible. The SequencedCollection.html#encounter of a SequencedMap is similar to that of the elements of a SequencedCollection, but the ordering applies to mappings instead of individual elements.
A collection that is both a SequencedCollection and a Set. As such, it can be thought of either as a Set that also has a well-defined SequencedCollection.html#encounter, or as a SequencedCollection that also has unique elements.
No-op ServiceLoader for Kotlin Multiplatform. Mimics java.util.ServiceLoader
A "shared" thread container. A shared thread container doesn't have an owner and is intended for unstructured uses, e.g. thread pools.
A Map that further provides a total ordering on its keys. The map is ordered according to the natural of its keys, or by a Comparator typically provided at sorted map creation time. This order is reflected when iterating over the sorted map's collection views (returned by the entrySet, keySet and values methods). Several additional operations are provided to take advantage of the ordering. (This interface is the map analogue of SortedSet.)
A Set that further provides a total ordering on its elements. The elements are ordered using their natural, or by a Comparator typically provided at sorted set creation time. The set's iterator will traverse the set in ascending element order. Several additional operations are provided to take advantage of the ordering. (This interface is the set analogue of SortedMap.)
An object for traversing and partitioning elements of a source. The source could be an array, a Collection, an IO channel, or a generator function.
A stackable scope to support structured constructs. The push method is used to push a StackableScope to the current thread's scope stack. The tryPop and popForcefully methods are used to pop the StackableScope from the current thread's scope stack.
ported from java.nio.charset.StandardCharsets
port of java.nio.file.StandardCopyOption
port of java.nio.file.StandardOpenOption
The StreamTokenizer class takes an input stream and parses it into "tokens", allowing the tokens to be read one at a time. The parsing process is controlled by a table and a number of flags that can be set to various states. The stream tokenizer can recognize identifiers, numbers, quoted strings, and various comment styles.
A simplified, mutable sequence of characters similar in spirit to Java’s StringBuffer.
StringCharacterIterator implements the CharacterIterator protocol for a String. The StringCharacterIterator class iterates over the entire String. All constructors throw NullPointerException if text is null.
A container of threads.
This class consists exclusively of static methods to support groupings of threads.
An object that creates new threads on demand. Using thread factories removes hardwiring of calls to Thread.Thread, enabling applications to use special thread subclasses, priorities, etc.
port of java.lang.ThreadLocal
An ExecutorService that executes each submitted task using one of possibly several pooled threads, normally configured using Executors factory methods.
Exception thrown when a blocking operation times out. Blocking operations for which a timeout is specified need a means to indicate that the timeout has occurred. For many such operations it is possible to return a value that indicates timeout; when that is not possible or desirable then TimeoutException should be declared and thrown.
A TimeUnit represents time durations at a given unit of granularity and provides utility methods to convert across units, and to perform timing and delay operations in these units. A TimeUnit does not maintain time information, but only helps organize and use time representations that may be maintained separately across various contexts. A nanosecond is defined as one thousandth of a microsecond, a microsecond as one thousandth of a millisecond, a millisecond as one thousandth of a second, a minute as sixty seconds, an hour as sixty minutes, and a day as twenty four hours.
A Red-Black tree based implementation of the MutableMap interface, striving for compatibility with the subset of TreeMap functionality potentially used by Lucene.
A NavigableSet implementation based on a TreeMap. The elements are ordered using their natural, or by a Comparator provided at set creation time, depending on which constructor is used.
Wraps an IOException with an unchecked exception.
Base class for different flavors of UTF-16 encoders
Thrown to indicate that the IP address of a host could not be determined.
Checked exception thrown when an input character (or byte) sequence is valid but cannot be mapped to an output byte (or character) sequence.
A minimal dummy exception indicating that the requested charset is not supported.
The Character Encoding is not supported.
A channel that can write bytes.
Abstract class for writing to character streams. The only methods that a subclass must implement are write(char[], int, int), flush(), and close(). Most subclasses, however, will override some of the methods defined here in order to provide higher efficiency, additional functionality, or both.
Properties
Maximum exponent a finite double variable may have. It is equal to the value returned by Math.getExponent(Double.MAX_VALUE).
Minimum unbiased exponent of a normalised binary-64 value (-1022).
A constant holding the smallest positive normal value of type float, 2-126. It is equal to the hexadecimal floating-point literal 0x1.0p-126f and also equal to Float.intBitsToFloat(0x00800000).
Number of explicit significand bits in a binary-64 value (53).
The number of bits used to represent a float value.
Functions
Atomically updates (with memory effects as specified by VarHandle.compareAndSet) the current value with the results of applying the given function to the current and given values, returning the updated value. The function should be side-effect-free, since it may be re-applied when attempted updates fail due to contention among threads. The function is applied with the current value as its first argument, and the given update as the second argument.
Appends the Unicode code point represented by codePoint to this StringBuilder.
This function had to be created because as of Kotlin 2.1.21 or around, as of May 2025 assert() function does not exist in kotlin common standard library. It exists in JVM and Native, so we will delegate to them for now. When std lib get assert in common, we will remove this function and use the std lib assert() instead.
Returns the number of one-bits in the two's complement binary representation of the specified Int value. This function is sometimes referred to as the population count.
Returns the number of one-bits in the two's complement binary representation of the specified Long value. This function is sometimes referred to as the population count.
Checks if the given index is within bounds (0 until length).
Returns the Unicode code point at the specified index of this CharSequence.
Returns a stream of code point values from this sequence. Any surrogate pairs encountered in the sequence are combined as if by {@linkplain Character#toCodePoint Character.toCodePoint} and the result is passed to the stream. Any other code units, including ordinary BMP characters, unpaired surrogates, and undefined code units, are zero-extended to {@code int} values which are then passed to the stream.
Compares the two specified double values. The sign of the integer value returned is the same as that of the integer that would be returned by the call:
Compares the two specified float values. The sign of the integer value returned is the same as that of the integer that would be returned by the call:
Compares two Int values numerically.
Compares two long values numerically. The value returned is identical to what would be returned by:
Compares two short values numerically. The value returned is identical to what would be returned by:
Compares two byte values numerically treating the values as unsigned.
Compares two long values numerically treating the values as unsigned.
ported from java.util.Map.computeIfAbsent()
Java‑style tail‑to‑head iterator for ArrayDeque.
Returns a representation of the specified double value according to the IEEE 754 "double format" bit layout.
Returns a representation of the specified double value according to the IEEE 754 "double format" bit layout, preserving the exact NaN bit-pattern.
Returns an integer representing the bits of the given value according to the IEEE 754 floating-point "single format" bit layout.
Returns an integer representing the raw bits of the given value according to the IEEE 754 floating-point "single format" bit layout.
mimics ``String(byte[] bytes, Charset charset)`` of jdk
mimics public String(byte[] bytes, int offset, int length, Charset charset)
trys to mimic following jdk code: however, in lucene context, COMPACT_STRINGS is always true, so gnore the check
Returns a hash code for a long value; compatible with Long.hashCode().
Returns an int value with at most a single one-bit, in the position of the highest-order ("leftmost") one-bit in the specified int value. Returns zero if the specified value has no one-bits in its two's complement binary representation, that is, if it is equal to zero.
Returns true if the argument is a finite floating-point value; returns false otherwise (for NaN and infinity arguments).
Returns true if the argument is a finite floating-point value; returns false otherwise (for NaN and infinity arguments).
Extension functions for surrogate detection.
Returns true if the specified number is infinitely large in magnitude, false otherwise.
Returns true if the specified number is a Not-a-Number (NaN) value, false otherwise.
Returns the number of zero bits preceding the highest-order ("leftmost") one-bit in the two's complement binary representation of the specified Int value. Returns 32 if the value is zero.
Returns the number of zero bits preceding the highest-order ("leftmost") one-bit in the two's complement binary representation of the specified long value. Returns 64 if the specified value has no one-bits in its two's complement representation, in other words if it is equal to zero.
Returns the number of zero bits following the lowest-order ("rightmost") one-bit in the two's complement binary representation of the specified int value. Returns 32 if the specified value has no one-bits in its two's complement representation, in other words if it is equal to zero.
Returns the number of zero bits following the lowest-order ("rightmost") one-bit in the two's complement binary representation of the specified long value. Returns 64 if the specified value has no one-bits in its two's complement representation, in other words if it is equal to zero.
ported from java.util.Map.putIfAbsent()
Port of Java BigInteger(int numBits, Random rnd): returns a non-negative random BigInteger in 0, 2^numBits - 1.
Returns the value obtained by reversing the order of the bytes in the two's complement representation of the specified int value.
Returns the value obtained by reversing the order of the bytes in the two's complement representation of the specified long value.
Returns the value obtained by reversing the order of the bytes in the two's complement representation of the specified short value.
Returns a comparator that imposes the reverse of the natural ordering.
Returns the value obtained by rotating the two's complement binary representation of the specified int value left by the specified number of bits. (Bits shifted out of the left hand, or high-order, side reenter on the right, or low-order.)
Returns the value obtained by rotating the two's complement binary representation of the specified long value left by the specified number of bits. (Bits shifted out of the left hand, or high-order, side reenter on the right, or low-order.)
Returns the value obtained by rotating the two's complement binary representation of the specified long value right by the specified number of bits. (Bits shifted out of the right hand, or low-order, side reenter on the left, or high-order.)
Returns the signum function of the specified int value. (The return value is -1 if the specified value is negative; 0 if the specified value is zero; and 1 if the specified value is positive.)
Returns a string representation of the unsigned integer value of i in binary (base 2).
Returns a string representation of the long argument as an unsigned integer in base 2.
mimics ``byte[] String.getBytes(Charset charset)`` of jdk
Converts a surrogate pair into the corresponding Unicode code point.
Returns a string representation of the long argument as an unsigned integer in base 16.
Converts the argument to an int by an unsigned conversion. In an unsigned conversion to an int, the high-order 24 bits of the int are zero and the low-order 8 bits are equal to the bits of the byte argument.
Converts the argument to an int by an unsigned conversion. In an unsigned conversion to an int, the high-order 16 bits of the int are zero and the low-order 16 bits are equal to the bits of the short argument.
Converts the argument to a long by an unsigned conversion. In an unsigned conversion to a long, the high-order 56 bits of the long are zero and the low-order 8 bits are equal to the bits of the byte argument.
Converts the argument to a long by an unsigned conversion. In an unsigned conversion to a long, the high-order 32 bits of the long are zero and the low-order 32 bits are equal to the bits of the integer argument.
Converts the argument to a long by an unsigned conversion. In an unsigned conversion to a long, the high-order 48 bits of the long are zero and the low-order 16 bits are equal to the bits of the short argument.
Returns a string representation of the long argument as an unsigned integer in base 10.
Format a long (treated as unsigned) into a String.
Atomically updates (with memory effects as specified by {@link VarHandle#compareAndSet}) the current value with the results of applying the given function, returning the updated value. The function should be side-effect-free, since it may be re-applied when attempted updates fail due to contention among threads.
Possibly atomically sets the value to newValue if the current value == expectedValue.