Norconex Commons Lang is a comprehensive, open-source Java utility library designed to complement both the core Java API and widely used libraries like Apache Commons Lang (which it relies upon and extends). Developed by Norconex, it powers much of their enterprise-grade software (such as the Norconex Web Crawler and Importer) and is useful for any general Java project requiring robust data manipulation, text parsing, and stream handling.
It provides highly specialized classes to cut down on boilerplate code and solve common developer challenges. Key features include: 💡 Core Features & Utilities
Advanced I/O Stream Utilities: Provides powerful stream wrappers that can cache InputStream and OutputStream in memory (or temporary files) to allow you to re-read them multiple times. You can also filter streams using regex, reverse streams, or borrow/peek bytes without destroying the mark.
Smart Text Reading: Features a TextReader class that lets you read large texts in smaller chunks, but splits the chunks “wisely” at paragraph, sentence, or word boundaries so you never cut a word in half.
Enhanced XML Processing: Includes an EnhancedXMLStreamWriter to simplify writing XML, along with general-purpose utilities to easily query, wrap, unwrap, or validate XML files against XSDs.
Time & ID Generation: Offers a TimeIdGenerator that yields monotonically increasing long IDs unique within a JVM, capable of generating up to 1 million IDs per millisecond.
URL Normalization & Manipulation: Includes classes to normalize, clean, strip, and parse URLs.
Enhanced Properties: A custom Properties collection that enforces string keys/values, supports multi-value mapping, and can emit or load from JSON.
Time Durations: Includes a DurationParser that converts plain-English strings (e.g., “5m30s” or “5 minutes and 30 seconds”) into milliseconds. 🛠️ How to use it
Norconex Commons Lang is available on Maven Central. You can add it to your Java project’s pom.xml as a dependency:
Use code with caution.
You can read more about its architecture, explore the Javadocs, or check out their open-source GitHub repository by visiting the Norconex Commons Lang Documentation. Norconex Commons Lang
Leave a Reply