Skip to content

AUtil(ACANX-Util) ACANX开源的工具库,封装了字符串、文件、IO、集合、日期、时间、HTTP/2、JSON、properties、IP地址、URL、线程、操作系统、图像、消息摘要、编码、解码相关的通用工具方法

License

Notifications You must be signed in to change notification settings

LeppardSoftware/AUtil

Repository files navigation

AUtil: A Comprehensive Utility Library for ACANX

AUtil Logo

Welcome to AUtil, a powerful utility library designed to simplify your development tasks. AUtil provides a collection of common utility methods for various programming needs, including string manipulation, file handling, IO operations, and much more. This library is an essential tool for developers looking to enhance their productivity.

Table of Contents

Features

AUtil offers a wide range of features that cover various aspects of programming:

  • String Utilities: Simplify string operations like trimming, splitting, and formatting.
  • File Management: Easy methods for reading, writing, and manipulating files.
  • IO Operations: Streamlined input and output handling.
  • Collection Handling: Efficient methods for working with lists, sets, and maps.
  • Date and Time: Simple functions to handle date and time formatting and parsing.
  • HTTP/2 Support: Built-in methods for making HTTP/2 requests.
  • JSON Handling: Easy serialization and deserialization of JSON data.
  • Properties Management: Simple handling of properties files.
  • Networking: Tools for working with IP addresses and URLs.
  • Thread Management: Basic utilities for thread handling.
  • Operating System Interaction: Methods to interact with the underlying OS.
  • Image Processing: Basic utilities for image manipulation.
  • Message Digest: Functions for generating hash values.
  • Encoding and Decoding: Support for various encoding schemes.

Installation

To install AUtil, you can clone the repository or download the latest release. Use the following command to clone:

git clone https://github.com/LeppardSoftware/AUtil.git

For the latest release, visit the Releases section to download the appropriate file. Make sure to execute the downloaded file to set up AUtil in your project.

Usage

Using AUtil is straightforward. Here’s a simple example to get you started:

import com.leppardsoftware.autil.StringUtil;

public class Main {
    public static void main(String[] args) {
        String input = " Hello, AUtil! ";
        String trimmed = StringUtil.trim(input);
        System.out.println(trimmed); // Output: "Hello, AUtil!"
    }
}

This example demonstrates how to use the StringUtil class to trim whitespace from a string. You can explore other utilities in the library in a similar manner.

Available Methods

String Utilities

  • trim(String input): Removes leading and trailing whitespace.
  • split(String input, String delimiter): Splits a string based on a delimiter.
  • format(String template, Object... args): Formats a string using a template.

File Management

  • readFile(String path): Reads the content of a file.
  • writeFile(String path, String content): Writes content to a file.

IO Operations

  • copy(InputStream source, OutputStream destination): Copies data from one stream to another.
  • flush(OutputStream output): Flushes the output stream.

Collection Handling

  • addToList(List<T> list, T item): Adds an item to a list.
  • removeFromList(List<T> list, T item): Removes an item from a list.

Date and Time

  • formatDate(Date date, String pattern): Formats a date according to a pattern.
  • parseDate(String dateStr, String pattern): Parses a date from a string.

HTTP/2 Support

  • sendHttp2Request(String url): Sends an HTTP/2 request to a specified URL.

JSON Handling

  • toJson(Object obj): Converts an object to a JSON string.
  • fromJson(String json, Class<T> clazz): Parses a JSON string into an object.

Properties Management

  • loadProperties(String path): Loads properties from a file.
  • getProperty(String key): Retrieves a property value by key.

Networking

  • getIpAddress(String hostname): Gets the IP address of a hostname.
  • isValidUrl(String url): Validates a URL format.

Thread Management

  • runInThread(Runnable task): Executes a task in a new thread.

Operating System Interaction

  • getOsName(): Retrieves the name of the operating system.
  • executeCommand(String command): Executes a shell command.

Image Processing

  • resizeImage(String path, int width, int height): Resizes an image.
  • convertToGrayscale(String path): Converts an image to grayscale.

Message Digest

  • generateHash(String input): Generates a hash value for a string.

Encoding and Decoding

  • encodeBase64(String input): Encodes a string to Base64.
  • decodeBase64(String encoded): Decodes a Base64 string.

Contributing

We welcome contributions to AUtil. If you have ideas for new features or improvements, please follow these steps:

  1. Fork the repository.
  2. Create a new branch for your feature or fix.
  3. Make your changes.
  4. Commit your changes with a clear message.
  5. Push your branch and create a pull request.

Please ensure that your code follows the existing style and includes appropriate tests.

License

AUtil is licensed under the MIT License. See the LICENSE file for details.

Contact

For questions or feedback, please reach out to the maintainers via the repository issues section or contact us directly.

Releases

For the latest updates and releases, visit the Releases section. Here you can download the latest version of AUtil and find detailed release notes.


Thank you for checking out AUtil! We hope this library enhances your development experience.

About

AUtil(ACANX-Util) ACANX开源的工具库,封装了字符串、文件、IO、集合、日期、时间、HTTP/2、JSON、properties、IP地址、URL、线程、操作系统、图像、消息摘要、编码、解码相关的通用工具方法

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Contributors 2

  •  
  •  

Languages