# com.android.internal.util

added in[API level 1](https://developer.android.com/guide/topics/manifest/uses-sdk-element#ApiLevels)  

# com.android.internal.util

## Interfaces

|-----------------------------------------------------------------------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| DumpUtils.Dump                                                                                |                                                                                                                                                                                                                                                         |
| FileRotator.Reader                                                                            | External class that reads data from a given[InputStream](https://developer.android.com/reference/java/io/InputStream).                                                                                                                                  |
| FileRotator.Rewriter                                                                          | External class that reads existing data from given[InputStream](https://developer.android.com/reference/java/io/InputStream), then writes any modified data to[OutputStream](https://developer.android.com/reference/java/io/OutputStream).             |
| FileRotator.Writer                                                                            | External class that writes data to a given[OutputStream](https://developer.android.com/reference/java/io/OutputStream).                                                                                                                                 |
| FunctionalUtils.RemoteExceptionIgnoringConsumer\<T\>                                          | A[Consumer](https://developer.android.com/reference/java/util/function/Consumer)that automatically ignores any[RemoteException](https://developer.android.com/reference/android/os/RemoteException)s.                                                   |
| FunctionalUtils.ThrowingConsumer\<T\>                                                         | A[Consumer](https://developer.android.com/reference/java/util/function/Consumer)that allows throwing checked exceptions from its single abstract method.                                                                                                |
| FunctionalUtils.ThrowingRunnable                                                              | An equivalent of[Runnable](https://developer.android.com/reference/java/lang/Runnable)that allows throwing checked exceptions This can be used to specify a lambda argument without forcing all the checked exceptions to be handled within it          |
| FunctionalUtils.ThrowingSupplier\<T\>                                                         | An equivalent of[Supplier](https://developer.android.com/reference/java/util/function/Supplier)that allows throwing checked exceptions This can be used to specify a lambda argument without forcing all the checked exceptions to be handled within it |
| [Predicate](https://developer.android.com/reference/com/android/internal/util/Predicate)\<T\> | *This interface was deprecated in API level 26. Use`java.util.function.Predicate`instead. This must not be used outside frameworks/base/test-runner.*                                                                                                   |

## Classes

|--------------------------------|---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| ArrayUtils                     | ArrayUtils contains some methods that you can call to find out the most efficient increments by which to grow arrays.                                                                                                                                                                                                                                                                                                                       |
| AsyncChannel                   | An asynchronous channel between two handlers.                                                                                                                                                                                                                                                                                                                                                                                               |
| AsyncService                   | A service that receives Intents and IBinder transactions as messages via an AsyncChannel.                                                                                                                                                                                                                                                                                                                                                   |
| AsyncService.AsyncServiceInfo  |                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| BitwiseInputStream             | An object that provides bitwise incremental read access to a byte array.                                                                                                                                                                                                                                                                                                                                                                    |
| BitwiseOutputStream            | An object that provides bitwise incremental write access to a byte array.                                                                                                                                                                                                                                                                                                                                                                   |
| CallbackRegistry\<C, T, A\>    | Tracks callbacks for the event.                                                                                                                                                                                                                                                                                                                                                                                                             |
| CharSequences                  | [CharSequence](https://developer.android.com/reference/java/lang/CharSequence)utility methods.                                                                                                                                                                                                                                                                                                                                              |
| CollectionUtils                | Utility methods for dealing with (typically`Nullable`)[Collection](https://developer.android.com/reference/java/util/Collection)s Unless a method specifies otherwise, a null value for a collection is treated as an empty collection of that type.                                                                                                                                                                                        |
| DumpUtils                      | Helper functions for dumping the state of system services.                                                                                                                                                                                                                                                                                                                                                                                  |
| ExponentiallyBucketedHistogram | A histogram for positive integers where each bucket is twice the size of the previous one.                                                                                                                                                                                                                                                                                                                                                  |
| FastMath                       | Fast and loose math routines.                                                                                                                                                                                                                                                                                                                                                                                                               |
| FastPrintWriter                |                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| FastXmlSerializer              | This is a quick and dirty implementation of XmlSerializer that isn't horribly painfully slow like the normal one.                                                                                                                                                                                                                                                                                                                           |
| FileRotator                    | Utility that rotates files over time, similar to`logrotate`.                                                                                                                                                                                                                                                                                                                                                                                |
| FunctionalUtils                | Utilities specific to functional programming                                                                                                                                                                                                                                                                                                                                                                                                |
| HexDump                        |                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| IndentingPrintWriter           | Lightweight wrapper around[PrintWriter](https://developer.android.com/reference/java/io/PrintWriter)that automatically indents newlines based on internal state.                                                                                                                                                                                                                                                                            |
| JournaledFile                  | *This class is deprecated. Use`AtomicFile`instead. It would be nice to update all existing uses of this to switch to AtomicFile, but since their on-file semantics are slightly different that would run the risk of losing data if at the point of the platform upgrade to the new code it would need to roll back to the backup file. This can be solved... but is it worth it and all of the testing needed to make sure it is correct?* |
| LatencyTracker                 | Class to track various latencies in SystemUI.                                                                                                                                                                                                                                                                                                                                                                                               |
| LineBreakBufferedWriter        | A writer that breaks up its output into chunks before writing to its out writer, and which is linebreak aware, i.e., chunks will created along line breaks, if possible.                                                                                                                                                                                                                                                                    |
| MessageUtils                   | Static utility class for dealing with[Message](https://developer.android.com/reference/android/os/Message)objects.                                                                                                                                                                                                                                                                                                                          |
| MimeIconUtils                  |                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| NotificationMessagingUtil      | A util to look up messaging related functions for notifications.                                                                                                                                                                                                                                                                                                                                                                            |
| Preconditions                  | Simple static methods to be called at the start of your own methods to verify correct arguments and state.                                                                                                                                                                                                                                                                                                                                  |
| ProcFileReader                 | Reader that specializes in parsing`/proc/`files quickly.                                                                                                                                                                                                                                                                                                                                                                                    |
| ScreenshotHelper               |                                                                                                                                                                                                                                                                                                                                                                                                                                             |
| SizedInputStream               | Reads exact number of bytes from wrapped stream, returning EOF once those bytes have been read.                                                                                                                                                                                                                                                                                                                                             |
| TypedProperties                | A`Map`that publishes a set of typed properties, defined by zero or more`Reader`s containing textual definitions and assignments.                                                                                                                                                                                                                                                                                                            |
| UserIcons                      | Helper class that generates default user icons.                                                                                                                                                                                                                                                                                                                                                                                             |
| VirtualRefBasePtr              | Helper class that contains a strong reference to a VirtualRefBase native object.                                                                                                                                                                                                                                                                                                                                                            |

## Exceptions

|--------------------------------|------------------------------------------------------------------------------------------------------------------------------------------|
| TypedProperties.ParseException | An unchecked exception that is thrown when encountering a syntax or semantic error in the input.                                         |
| TypedProperties.TypeException  | An unchecked exception that is thrown if a`get<TYPE>()`method is used to retrieve a parameter whose type does not match the method name. |

## Errors

|-------------------------------------|----------------------------------------------------------|
| MessageUtils.DuplicateConstantError | Thrown when two different constants have the same value. |

-

  ## Interfaces

  - DumpUtils.Dump
  - FileRotator.Reader
  - FileRotator.Rewriter
  - FileRotator.Writer
  - FunctionalUtils.RemoteExceptionIgnoringConsumer
  - FunctionalUtils.ThrowingConsumer
  - FunctionalUtils.ThrowingRunnable
  - FunctionalUtils.ThrowingSupplier
  - [Predicate](https://developer.android.com/reference/com/android/internal/util/Predicate)
-

  ## Classes

  - ArrayUtils
  - AsyncChannel
  - AsyncService
  - AsyncService.AsyncServiceInfo
  - BitwiseInputStream
  - BitwiseOutputStream
  - CallbackRegistry
  - CharSequences
  - CollectionUtils
  - DumpUtils
  - ExponentiallyBucketedHistogram
  - FastMath
  - FastPrintWriter
  - FastXmlSerializer
  - FileRotator
  - FunctionalUtils
  - HexDump
  - IndentingPrintWriter
  - JournaledFile
  - LatencyTracker
  - LineBreakBufferedWriter
  - MessageUtils
  - MimeIconUtils
  - NotificationMessagingUtil
  - Preconditions
  - ProcFileReader
  - ScreenshotHelper
  - SizedInputStream
  - TypedProperties
  - UserIcons
  - VirtualRefBasePtr
-

  ## Exceptions

  - TypedProperties.ParseException
  - TypedProperties.TypeException
-

  ## Errors

  - MessageUtils.DuplicateConstantError