Utils
Leave feedback
On this page
Inheritance: java.lang.Object
public class Utils
Utility class that provides common helper methods which can be useful when using Comparison API.
| Constructor | Description |
|---|---|
| Utils() |
| Method | Description |
|---|---|
| getMethodByTag(Class> clazz, String methodTag, boolean isGetter) | |
| closeStreams(Closeable[] closeables) | Quietly closes all provided objects catching and logging all IOException. |
| closeStreams(BiConsumer<Closeable,IOException> consumer, Closeable[] closeables) | Closes the specified streams, suppressing any exceptions that occur logging or processing IOException |
| isText(String data) | Checks that input string has only chars allowed in usual string of any language |
| containsOnlyLatinCharsAndPunctuation(String data) | |
| toString(TextStyle textStyle) |
public Utils()
public static Optional<Method> getMethodByTag(Class<?> clazz, String methodTag, boolean isGetter)
Parameters:
| Parameter | Type | Description |
|---|---|---|
| clazz | java.lang.Class> | |
| methodTag | java.lang.String | |
| isGetter | boolean |
Returns: java.util.Optional<java.lang.reflect.Method>
public static boolean closeStreams(Closeable[] closeables)
Quietly closes all provided objects catching and logging all IOException.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| closeables | java.io.Closeable[] | Any object that implements Closeable interface, may be null |
Returns: boolean - true if all closeable objects were closed without exception, otherwise false
public static boolean closeStreams(BiConsumer<Closeable,IOException> consumer, Closeable[] closeables)
Closes the specified streams, suppressing any exceptions that occur logging or processing IOException If any of the streams is null or encounters an exception while closing, it is ignored.
Parameters:
| Parameter | Type | Description |
|---|---|---|
| consumer | java.util.function.BiConsumer<java.io.Closeable,java.io.IOException> | Will be called for each pair of closeable and IOException when closing throws the exception, may be null |
| closeables | java.io.Closeable[] | Any object that implements Closeable interface, may be null |
Returns: boolean - true if all closeable objects were closed without exception, otherwise false
public static boolean isText(String data)
Checks that input string has only chars allowed in usual string of any language
Parameters:
| Parameter | Type | Description |
|---|---|---|
| data | java.lang.String |
Returns: boolean
public static boolean containsOnlyLatinCharsAndPunctuation(String data)
Parameters:
| Parameter | Type | Description |
|---|---|---|
| data | java.lang.String |
Returns: boolean
public static void toString(TextStyle textStyle)
Parameters:
| Parameter | Type | Description |
|---|---|---|
| textStyle | com.aspose.note.TextStyle |
Was this page helpful?
Any additional feedback you'd like to share with us?
Please tell us how we can improve this page.
Thank you for your feedback!
We value your opinion. Your feedback will help us improve our documentation.