Java util library processing

Package java.util

Contains the collections framework, some internationalization support classes, a service loader, properties, random number generation, string parsing and scanning classes, base64 encoding and decoding, a bit array, and several miscellaneous utility classes. This package also contains legacy collection classes and legacy date and time classes.

Java Collections Framework

The Formattable interface must be implemented by any class that needs to perform custom formatting using the ‘s’ conversion specifier of Formatter .

An iterator for lists that allows the programmer to traverse the list in either direction, modify the list during iteration, and obtain the iterator’s current position in the list.

Marker interface used by List implementations to indicate that they support fast (generally constant time) random access.

This class provides a skeletal implementation of the Collection interface, to minimize the effort required to implement this interface.

This class provides a skeletal implementation of the List interface to minimize the effort required to implement this interface backed by a «random access» data store (such as an array).

This class provides a skeletal implementation of the Map interface, to minimize the effort required to implement this interface.

This class provides a skeletal implementation of the List interface to minimize the effort required to implement this interface backed by a «sequential access» data store (such as a linked list).

Читайте также:  Can integer be null java

This class provides a skeletal implementation of the Set interface to minimize the effort required to implement this interface.

This class consists exclusively of static methods for obtaining encoders and decoders for the Base64 encoding scheme.

This class implements a decoder for decoding byte data using the Base64 encoding scheme as specified in RFC 4648 and RFC 2045.

This class implements an encoder for encoding byte data using the Base64 encoding scheme as specified in RFC 4648 and RFC 2045.

The Calendar class is an abstract class that provides methods for converting between a specific instant in time and a set of calendar fields such as YEAR , MONTH , DAY_OF_MONTH , HOUR , and so on, and for manipulating the calendar fields, such as getting the date of the next week.

The Dictionary class is the abstract parent of any class, such as Hashtable , which maps keys to values.

An abstract wrapper class for an EventListener class which associates a set of additional parameters with the listener.

FormattableFlags are passed to the Formattable.formatTo() method and modify the output format for Formattables.

GregorianCalendar is a concrete subclass of Calendar and provides the standard calendar system used by most of the world.

This class implements the Map interface with a hash table, using reference-equality in place of object-equality when comparing keys (and values).

ListResourceBundle is an abstract subclass of ResourceBundle that manages resources for a locale in a convenient and easy to use list.

This class consists of static utility methods for operating on objects, or checking certain conditions before operation.

PropertyResourceBundle is a concrete subclass of ResourceBundle that manages resources for a locale using a set of static strings from a property file.

ResourceBundle.Control defines a set of callback methods that are invoked by the ResourceBundle.getBundle factory methods during the bundle loading process.

SimpleTimeZone is a concrete subclass of TimeZone that represents a time zone for use with a Gregorian calendar.

Static classes and methods for operating on or creating instances of Spliterator and its primitive specializations Spliterator.OfInt , Spliterator.OfLong , and Spliterator.OfDouble .

A generator of uniform pseudorandom values applicable for use in (among other contexts) isolated parallel computations that may generate subtasks.

StringJoiner is used to construct a sequence of characters separated by a delimiter and optionally starting with a supplied prefix and ending with a supplied suffix.

This exception may be thrown by methods that have detected concurrent modification of an object when such modification is not permissible.

Unchecked exception thrown when a character with an invalid Unicode code point as defined by Character.isValidCodePoint(int) is passed to the Formatter .

Unchecked exception thrown when the argument corresponding to the format specifier is of an incompatible type.

Unchecked exception thrown when a format string contains an illegal syntax or a format specifier that is incompatible with the given arguments.

Unchecked exception thrown when the precision is a negative value other than -1 , the conversion does not support a precision, or the value is otherwise unsupported.

Unchecked exception thrown when the format width is a negative value other than -1 or is otherwise unsupported.

Thrown by methods in Locale and Locale.Builder to indicate that an argument is not a well-formed BCP 47 tag.

Thrown by a Scanner to indicate that the token retrieved does not match the pattern for the expected type, or that the token is out of range for the expected type.

Thrown to indicate that an operation could not complete because the input did not conform to the appropriate XML document type for a collection of properties, as per the Properties specification.

Unchecked exception thrown when there is a format specifier which does not have a corresponding argument or if an argument index refers to an argument that does not exist.

The TooManyListenersException Exception is used as part of the Java Event model to annotate and implement a unicast special case of a multicast Event Source.

Report a bug or suggest an enhancement
For further API reference and developer documentation see the Java SE Documentation, which contains more detailed, developer-targeted descriptions with conceptual overviews, definitions of terms, workarounds, and working code examples.
Java is a trademark or registered trademark of Oracle and/or its affiliates in the US and other countries.
Copyright © 1993, 2023, Oracle and/or its affiliates, 500 Oracle Parkway, Redwood Shores, CA 94065 USA.
All rights reserved. Use is subject to license terms and the documentation redistribution policy.

Источник

Java util library processing

Function to return the length of the file, or entire directory, including the component files and sub-folders if passed.

Given a folder, return a list of absolute paths to all jar or zip files inside that folder, separated by pathSeparatorChar.

Get the number of lines in a file by counting the number of newline characters inside a String (and adding 1).

Create a temporary folder by using the createTempFile() mechanism, deleting the file it creates, and making a folder using the location that was provided.

Recursively creates a list of all files within the specified folder, and returns a list of their relative paths.

A classpath, separated by the path separator, will contain a series of .jar/.zip files or directories containing .class files, or containing subdirectories that have .class files.

Read from a file with a bunch of attribute/value pairs that are separated by = and ignore comments with #.

Methods inherited from class Object

Constructor Detail

Util

Method Detail

countLines

public static int countLines(String what)

Get the number of lines in a file by counting the number of newline characters inside a String (and adding 1).

loadBytesRaw

public static byte[] loadBytesRaw(File file) throws IOException

readSettings

public static StringDict readSettings(File inputFile)

Read from a file with a bunch of attribute/value pairs that are separated by = and ignore comments with #. Changed in 3.x to return null (rather than empty hash) if no file, and changed return type to StringDict instead of Map or HashMap.

readSettings

public static StringDict readSettings(String filename, String[] lines)

Parse a String array that contains attribute/value pairs separated by = (the equals sign). The # (hash) symbol is used to denote comments. Comments can be anywhere on a line. Blank lines are ignored. In 3.0a6, no longer taking a blank HashMap as param; no cases in the main PDE code of adding to a (Hash)Map. Also returning the Map instead of void. Both changes modify the method signature, but this was only used by the contrib classes.

copyFile

public static void copyFile(File sourceFile, File targetFile) throws IOException

loadFile

public static String loadFile(File file) throws IOException

saveFile

public static void saveFile(String text, File file) throws IOException

Spew the contents of a String object out to a file. As of 3.0 beta 2, this will replace and write \r\n for newlines on Windows. https://github.com/processing/processing/issues/3455 As of 3.3.7, this puts a newline at the end of the file, per good practice/POSIX: https://stackoverflow.com/a/729795

createTempFolder

public static File createTempFolder(String prefix, String suffix, File directory) throws IOException

Create a temporary folder by using the createTempFile() mechanism, deleting the file it creates, and making a folder using the location that was provided. Unlike createTempFile(), there is no minimum size for prefix. If prefix is less than 3 characters, the remaining characters will be filled with underscores

copyDir

public static void copyDir(File sourceDir, File targetDir) throws IOException

Copy a folder from one place to another. This ignores all dot files and folders found in the source directory, to avoid copying silly .DS_Store files and potentially troublesome .svn folders.

copyDirNative

public static void copyDirNative(File sourceDir, File targetDir) throws IOException

removeDir

public static boolean removeDir(File dir)

Remove all files in a directory and the directory itself. Prints error messages with failed filenames. Does not follow symlinks.

removeDir

public static boolean removeDir(File dir, boolean printErrorMessages)

Remove all files in a directory and the directory itself. Optinally prints error messages with failed filenames. Does not follow symlinks.

calcSize

public static long calcSize(File file)

Function to return the length of the file, or entire directory, including the component files and sub-folders if passed.

calcFolderSize

public static long calcFolderSize(File folder)

Calculate the size of the contents of a folder. Used to determine whether sketches are empty or not. Note that the function calls itself recursively.

listFiles

public static String[] listFiles(File folder, boolean relative)

Recursively creates a list of all files within the specified folder, and returns a list of their relative paths. Ignores any files/folders prefixed with a dot.

listFiles

public static String[] listFiles(File folder, boolean relative, String extension)

listJarFiles

public static File[] listJarFiles(File folder)

contentsToClassPath

public static String contentsToClassPath(File folder)

Given a folder, return a list of absolute paths to all jar or zip files inside that folder, separated by pathSeparatorChar. This will prepend a colon (or whatever the path separator is) so that it can be directly appended to another path string. As of 0136, this will no longer add the root folder as well. This function doesn’t bother checking to see if there are any .class files in the folder or within a subfolder.

packageListFromClassPath

public static StringList packageListFromClassPath(String path)

A classpath, separated by the path separator, will contain a series of .jar/.zip files or directories containing .class files, or containing subdirectories that have .class files.

unzip

public static void unzip(File zipFile, File dest)

gzipEncode

public static byte[] gzipEncode(byte[] what) throws IOException

containsNonASCII

public static final boolean containsNonASCII(String what)

Источник

Оцените статью