# Package net.i2p.util

Core utility classes and helper functions used throughout the I2P router and applications.

See: Description

- Interface Summary
  Interface | Description
  --- | ---
  BandwidthEstimator | A Westwood bandwidth estimator
  Clock.ClockUpdateListener | Listener for clock offset changes.
  EepGet.StatusListener | Callback interface
  EventDispatcher | Event dispatching interface.
  I2PProperties.I2PPropertyCallback | Callback interface for property change notifications.
  I2PThread.OOMEventListener | Listener for out-of-memory events.
  SimpleTimer.TimedEvent | Simple interface for events to be queued up and notified on expiration
  TryCache.ObjectFactory<T> | Factory interface for creating new objects in TryCache.

- Class Summary
  Class | Description
  --- | ---
  Addresses | Methods to get the local addresses, and other IP utilities.
  ArraySet<E> | A small, fast Set with a maximum size, backed by a fixed-size array.
  ByteArrayStream | OutputStream to InputStream adapter.
  ByteCache | Cache the objects frequently used to reduce memory churn.
  Clock | Alternate location for determining the time which takes into account an offset.
  CommandLine | Simple command line access to various utilities.
  ConcurrentHashSet<E> | Implement on top of a ConcurrentHashMap with a dummy value.
  ConvertToHash | Convert any kind of destination String to a hash Supported: Base64 dest Base64 dest.i2p Base64 Hash Base64 Hash.i2p Base32 Hash Base32 desthash.b32.i2p example.i2p
  DNSOverHTTPS | Simple implemetation of DNS over HTTPS.
  EepGet | EepGet [-p 127.0.0.1:4444] [-n #retries] [-o outputFile] [-m markSize lineLen] url
  EepHead | This is a quick hack to get a working EepHead, primarily for the following usage:
  EepPost | Extends EepGet for POST.
  EventDispatcherImpl | An implementation of the EventDispatcher interface.
  Executor | Deprecated - used only by SimpleTimer
  FileLogWriter | File-based log writer thread that pulls log records from the LogManager, writes them to the current logfile, and rotates the logs as necessary.
  FileSuffixFilter | A FileFilter that accepts regular files with a suffix and optionally a prefix, case-insensitive.
  FileUtil | General helper methods for messing with files These are static methods that do NOT convert arguments to absolute paths for a particular context and directory.
  FortunaRandomSource | Wrapper around GNU-Crypto's Fortuna PRNG.
  HexDump | Hexdump class (well, it's actually a namespace with some functions, but let's stick with java terminology :-).
  I2PAppThread | Like `I2PThread` but with per-thread OOM listeners, rather than a static router-wide listener list, so that an OOM in an app won't call the router listener to shutdown the whole router.
  I2PProperties | This class contains a number of properties ((key,value)-pairs).
  I2PSSLSocketFactory | Loads trusted ASCII certs from ~/.i2p/certificates/ and $I2P/certificates/.
  I2PThread | Preferred over `Thread` for all router uses.
  InternalServerSocket | A simple in-JVM ServerSocket using Piped Streams.
  InternalSocket | A simple in-JVM Socket using Piped Streams.
  KeyRing | Simple key ring for storing session keys by hash.
  LHMCache<K,V> | A LinkedHashMap with a maximum size, for use as an LRU cache.
  Log | Wrapper class for whatever logging system I2P uses.
  LogConsoleBuffer | Offer a glimpse into the last few console messages generated.
  LogLimit | Defines the log limit for a particular set of logs
  LogManager | Manages the logging system, loading (and reloading) the configuration file, coordinating the log limits, and storing the set of log records pending.
  LogRecord | Keep track of a log entry, unformatted.
  LogRecordFormatter | Render a log record according to the log manager's settings
  LogWriter | Log writer thread that pulls log records from the LogManager and writes them to the log.
  LookaheadInputStream | Simple lookahead buffer to keep the last K bytes in reserve, configured to easily be reused.
  NativeBigInteger | BigInteger that takes advantage of the jbigi library for the modPow operation, which accounts for a massive segment of the processing cost of asymmetric crypto.
  ObjectCounter<K> | Thread-safe counter for tracking occurrences of objects.
  ObjectCounterUnsafe<K> | Non-thread-safe counter for tracking occurrences of objects.
  OrderedProperties | Properties map that has its keySet ordered consistently (via the key's lexicographical ordering).
  PartialEepGet | Fetch exactly the first 'size' bytes into a stream Anything less or more will throw an IOException No retries, no min and max size options, no timeout option If the server does not return a Content-Length header of the correct size, the fetch will fail.
  PasswordManager | Manage both plaintext and salted/hashed password storage in router.config.
  PortMapper | Map services to internal or external application ports for this context.
  RandomSource | Singleton for whatever PRNG i2p uses.
  ResettableGZIPInputStream | GZIP implementation per RFC 1952, reusing java's standard CRC32 and Inflater and InflaterInputStream implementations.
  ResettableGZIPOutputStream | GZIP implementation per RFC 1952, reusing java's standard CRC32 and Deflater implementations.
  ReusableGZIPInputStream | Provide a cache of reusable GZIP unzipper streams.
  ReusableGZIPOutputStream | Provide a cache of reusable GZIP streams, each handling up to 40 KB output without expansion.
  RFC822Date | Moved from NewsFetcher
  SecureDirectory | Same as File but sets the file mode after mkdir() so it can be read and written by the owner only (i.e.
  SecureFile | Same as SecureDirectory but sets the file mode after createNewFile() and createTempFile() also.
  SecureFileOutputStream | Same as FileOutputStream but sets the file mode so it can only be read and written by the owner only (i.e.
  ShellCommand | Passes a command to the OS shell for execution and manages the input and output.
  SimpleByteCache | Like ByteCache but works directly with byte arrays, not ByteArrays.
  SimpleStore | Deprecated - used only by SimpleTimer
  SimpleTimer | Simple event scheduler - toss an event on the queue and it gets fired at the appropriate time.
  SimpleTimer2 | Simple event scheduler - toss an event on the queue and it gets fired at the appropriate time.
  SimpleTimer2.TimedEvent | Similar to SimpleTimer.TimedEvent but users must extend instead of implement, and all schedule and cancel methods are through this class rather than SimpleTimer2.
  SipHash | Wrapper around SipHashInline with constant per-JVM keys
  SocketTimeout | Implements one or two timers; one for inactivity, that is reset by resetTimer(), and optionally, a total time since instantiation, that is configured by setTotalTimeoutPeriod().
  SSLEepGet | HTTPS only, no retries, no min and max size options, no timeout option As of 0.9.45, supports redirect to https (redirect to http will still fail).
  SSLEepGet.SSLState | An opaque class for the caller to pass to repeated instantiations of SSLEepGet.
  SyntheticREDQueue | A "synthetic" queue that does not store data but estimates the average queue size assuming a fixed output bandwidth, and applies the Random Early Detection (RED) algorithm to decide probabilistically whether to accept or drop packets.
  SystemVersion | Methods to find out what system we are running on
  TempDirScanner | Prevent systemd from deleting our temp dir or any dirs or files in it.
  TimeoutPipedInputStream | Adds setReadTimeout().
  TimeoutPipedOutputStream | Helper for TimeoutPipedInputStream.
  Translate | Translate strings efficiently.
  TranslateReader | Translate.
  TryCache<T> | A thread-safe, lock-free-ish object cache that reuses objects to reduce allocation overhead.
  UIMessages | A queue of messages, where each has an ID number.
  UIMessages.Message | Represents a single UI message with a unique identifier.
  UnmodifiableSortedSet<E> | Efficient implementation of a SortedSet stored in a fixed-size array.
  VersionComparator | Compares versions.

- Enum Summary
  Enum | Description
  --- | ---
  AddressType | Enumeration of supported address types.
  DNSOverHTTPS.Type | DNS query type for IPv4/IPv6 preference.
  EepGet.AUTH_MODE | Authentication mode enumeration.
  SSLEepGet.ProxyType | Not all may be supported.

- Exception Summary
  Exception | Description
  --- | ---
  ArraySet.SetFullException | Exception thrown when attempting to add an element to a full ArraySet.

## Package net.i2p.util Description

Core utility classes and helper functions used throughout the I2P router and applications.

This package provides essential functionality including:

- String manipulation and formatting utilities
- Collection helpers and data structures
- File I/O and stream utilities
- Mathematical and conversion functions
- Time and date handling
- Network address utilities
- Concurrency and synchronization helpers