Added in API level 1

Serializable

interface Serializable
AbstractMap.SimpleEntry

An Entry maintaining a key and a value.

AbstractMap.SimpleImmutableEntry

An unmodifiable Entry maintaining a key and a value.

AbstractOwnableSynchronizer

A synchronizer that may be exclusively owned by a thread.

AbstractQueuedLongSynchronizer

A version of AbstractQueuedSynchronizer in which synchronization state is maintained as a long.

AbstractQueuedLongSynchronizer.ConditionObject

Condition implementation for a AbstractQueuedLongSynchronizer serving as the basis of a Lock implementation.

AbstractQueuedSynchronizer

Provides a framework for implementing blocking locks and related synchronizers (semaphores, events, etc) that rely on first-in-first-out (FIFO) wait queues.

AbstractQueuedSynchronizer.ConditionObject

Condition implementation for a AbstractQueuedSynchronizer serving as the basis of a Lock implementation.

ArrayBlockingQueue

A bounded blocking queue backed by an array.

ArrayDeque

Resizable-array implementation of the Deque interface.

ArrayList

Resizable-array implementation of the List interface.

AtomicBoolean

A boolean value that may be updated atomically.

AtomicInteger

An int value that may be updated atomically.

AtomicIntegerArray

An int array in which elements may be updated atomically.

AtomicLong

A long value that may be updated atomically.

AtomicLongArray

A long array in which elements may be updated atomically.

AtomicReference

An object reference that may be updated atomically.

AtomicReferenceArray

An array of object references in which elements may be updated atomically.

AttributedCharacterIterator.Attribute

Defines attribute keys that are used to identify text attributes.

BasicPermission

Android doesn't support SecurityManager.

BigDecimal

The BigDecimal class implements immutable arbitrary-precision decimal numbers.

BitSet

This class implements a vector of bits that grows as needed.

Boolean

The Boolean class wraps a value of the primitive type boolean in an object.

Calendar

[icu enhancement] ICU's replacement for java.util.Calendar.

Calendar

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

CertPath

An immutable sequence of certificates (a certification path).

CertPath.CertPathRep

Alternate CertPath class for serialization.

CertPathValidatorException.Reason

The reason the validation algorithm failed.

Certificate

Abstract class for managing a variety of identity certificates.

Certificate.CertificateRep

Alternate Certificate class for serialization.

Character

The Character class wraps a value of the primitive type char in an object.

Class

Instances of the class represent classes and interfaces in a running Java application.

CodeSigner

This class encapsulates information about a code signer.

CodeSource

Legacy security code; do not use.

ConcurrentHashMap

A hash table supporting full concurrency of retrievals and high expected concurrency for updates.

ConcurrentHashMap.KeySetView

A view of a ConcurrentHashMap as a Set of keys, in which additions may optionally be enabled by mapping to a common value.

ConcurrentLinkedDeque

An unbounded concurrent deque based on linked nodes.

ConcurrentLinkedQueue

An unbounded thread-safe queue based on linked nodes.

ConcurrentSkipListMap

A scalable concurrent ConcurrentNavigableMap implementation.

ConcurrentSkipListSet

A scalable concurrent NavigableSet implementation based on a ConcurrentSkipListMap.

CopyOnWriteArrayList

A thread-safe variant of java.util.ArrayList in which all mutative operations (add, set, and so on) are implemented by making a fresh copy of the underlying array.

CopyOnWriteArraySet

A Set that uses an internal CopyOnWriteArrayList for all of its operations.

Currency

Represents a currency.

CurrencyPluralInfo

This class represents the information needed by DecimalFormat to format currency plural, such as "3.

Date

The class Date represents a specific instant in time, with millisecond precision.

DateFormatSymbols

[icu enhancement] ICU's replacement for java.text.DateFormatSymbols.

DateFormatSymbols

DateFormatSymbols is a public class for encapsulating localizable date-time formatting data, such as the names of the months, the names of the days of the week, and the time zone data.

DateInterval

This class represents date interval.

DateIntervalInfo

DateIntervalInfo is a public class for encapsulating localizable date time interval patterns.

DateIntervalInfo.PatternInfo

PatternInfo class saves the first and second part of interval pattern, and whether the interval pattern is earlier date first.

DecimalFormatSymbols

[icu enhancement] ICU's replacement for java.text.DecimalFormatSymbols.

DecimalFormatSymbols

This class represents the set of symbols (such as the decimal separator, the grouping separator, and so on) needed by DecimalFormat to format numbers.

DoubleAccumulator

One or more variables that together maintain a running double value updated using a supplied function.

DoubleAdder

One or more variables that together maintain an initially zero double sum.

Duration

A time-based amount of time, such as '34.

Enum

This is the common base class of all Java language enumeration classes.

EnumMap

A specialized Map implementation for use with enum type keys.

EnumSet

A specialized Set implementation for use with enum types.

EventObject

The root class from which all event state objects shall be derived.

Externalizable

Only the identity of the class of an Externalizable instance is written in the serialization stream and it is the responsibility of the class to save and restore the contents of its instances.

File

An abstract representation of file and directory pathnames.

FilePermission

Legacy security code; do not use.

ForkJoinTask

Abstract base class for tasks that run within a ForkJoinPool.

Format

Format is an abstract base class for formatting locale-sensitive information such as dates, messages, and numbers.

GuardedObject

A GuardedObject is an object that is used to protect access to another object.

HashMap

Hash table based implementation of the Map interface.

HashSet

This class implements the Set interface, backed by a hash table (actually a HashMap instance).

Hashtable

This class implements a hash table, which maps keys to values.

HijrahChronology

The Hijrah calendar is a lunar calendar supporting Islamic calendars.

HijrahDate

A date in the Hijrah calendar system.

Identity

This class represents identities: real-world objects such as people, companies or organizations whose identities can be authenticated using their public keys.

IdentityHashMap

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

InetAddress

This class represents an Internet Protocol (IP) address.

Instant

An instantaneous point on the time-line.

IsoChronology

The ISO calendar system.

JapaneseChronology

The Japanese Imperial calendar system.

JapaneseDate

A date in the Japanese Imperial calendar system.

JapaneseEra

An era in the Japanese Imperial calendar system.

Key

The Key interface is the top-level interface for all keys.

KeyPair

This class is a simple holder for a key pair (a public key and a private key).

KeyRep

Standardized representation for serialized Key objects.

Level

The Level class defines a set of standard logging levels that can be used to control logging output.

LinkedBlockingDeque

An optionally-bounded blocking deque based on linked nodes.

LinkedBlockingQueue

An optionally-bounded blocking queue based on linked nodes.

LinkedHashSet

Hash table and linked list implementation of the Set interface, with well-defined encounter order.

LinkedList

Doubly-linked list implementation of the List and Deque interfaces.

LinkedTransferQueue

An unbounded TransferQueue based on linked nodes.

LocalDate

A date without a time-zone in the ISO-8601 calendar system, such as 2007-12-03.

LocalDateTime

A date-time without a time-zone in the ISO-8601 calendar system, such as 2007-12-03T10:15:30.

LocalTime

A time without a time-zone in the ISO-8601 calendar system, such as 10:15:30.

Locale

A object represents a specific geographical, political, or cultural region.

LogRecord

LogRecord objects are used to pass logging requests between the logging framework and individual log Handlers.

LongAccumulator

One or more variables that together maintain a running long value updated using a supplied function.

LongAdder

One or more variables that together maintain an initially zero long sum.

MathContext

The MathContext immutable class encapsulates the settings understood by the operator methods of the BigDecimal class (and potentially other classes).

MathContext

Immutable objects which encapsulate the context settings which describe certain rules for numerical operators, such as those implemented by the BigDecimal class.

MeasureUnit

A unit such as length, mass, volume, currency, etc.

MethodType

A method type represents the arguments and return type accepted and returned by a method handle, or the arguments and return type passed and expected by a method handle caller.

MinguoChronology

The Minguo calendar system.

MinguoDate

A date in the Minguo calendar system.

MonthDay

A month-day in the ISO-8601 calendar system, such as --12-03.

Number

The abstract class Number is the superclass of platform classes representing numeric values that are convertible to the primitive types byte, double, float, int, long, and short.

NumericShaper

The class is used to convert Latin-1 (European) digits to other Unicode decimal digits.

ObjectStreamClass

Serialization's descriptor for classes.

OffsetDateTime

A date-time with an offset from UTC/Greenwich in the ISO-8601 calendar system, such as 2007-12-03T10:15:30+01:00.

OffsetTime

A time with an offset from UTC/Greenwich in the ISO-8601 calendar system, such as 10:15:30+01:00.

PasswordCallback

Underlying security services instantiate and pass a PasswordCallback to the handle method of a CallbackHandler to retrieve password information.

Pattern

A compiled representation of a regular expression.

Period

A date-based amount of time in the ISO-8601 calendar system, such as '2 years, 3 months and 4 days'.

Permission

Android doesn't support SecurityManager.

PermissionCollection

Android doesn't support SecurityManager.

Permissions

Android doesn't support SecurityManager.

PluralRules

Defines rules for mapping non-negative numeric values onto a small set of keywords.

PriorityBlockingQueue

An unbounded blocking queue that uses the same ordering rules as class PriorityQueue and supplies blocking retrieval operations.

PriorityQueue

An unbounded priority queue based on a priority heap.

PropertyChangeSupport

This is a utility class that can be used by beans that support bound properties.

Proxy

Proxy provides static methods for creating dynamic proxy classes and instances, and it is also the superclass of all dynamic proxy classes created by those methods.

QName

QName represents a qualified name as defined in the XML specifications: XML Schema Part2: Datatypes specification, Namespaces in XML, Namespaces in XML Errata.

Random

An instance of this class is used to generate a stream of pseudorandom numbers; its period is only 248.

ReentrantLock

A reentrant mutual exclusion Lock with the same basic behavior and semantics as the implicit monitor lock accessed using synchronized methods and statements, but with extended capabilities.

ReentrantReadWriteLock

An implementation of ReadWriteLock supporting similar semantics to ReentrantLock.

ReentrantReadWriteLock.ReadLock

The lock returned by method ReentrantReadWriteLock.readLock.

ReentrantReadWriteLock.WriteLock

The lock returned by method ReentrantReadWriteLock.writeLock.

SealedObject

This class enables a programmer to create an object and protect its confidentiality with a cryptographic algorithm.

SecureRandomSpi

This class defines the Service Provider Interface (SPI) for the SecureRandom class.

Semaphore

A counting semaphore.

SignedObject

SignedObject is a class for the purpose of creating authentic runtime objects whose integrity cannot be compromised without being detected.

SipProfile

Defines a SIP profile, including a SIP account, domain and server information.

SocketAddress

This class represents a Socket Address with no protocol attachment.

SocketPermission

Legacy security code; do not use.

StackTraceElement

An element in a stack trace, as returned by java.lang.Throwable#getStackTrace().

StampedLock

A capability-based lock with three modes for controlling read/write access.

String

The String class represents character strings.

StringBuffer

A thread-safe, mutable sequence of characters.

StringBuilder

A mutable sequence of characters.

Subject

A Subject represents a grouping of related information for a single entity, such as a person.

SynchronousQueue

A blocking queue in which each insert operation must wait for a corresponding remove operation by another thread, and vice versa.

ThaiBuddhistChronology

The Thai Buddhist calendar system.

ThaiBuddhistDate

A date in the Thai Buddhist calendar system.

Throwable

The Throwable class is the superclass of all errors and exceptions in the Java language.

TimeZone

[icu enhancement] ICU's replacement for java.util.TimeZone.

TimeZone

represents a time zone offset, and also figures out daylight savings.

TimeZoneFormat

TimeZoneFormat supports time zone display name formatting and parsing.

TimeZoneNames

TimeZoneNames is an abstract class representing the time zone display name data model defined by UTS#35 Unicode Locale Data Markup Language (LDML).

Timestamp

This class encapsulates information about a signed timestamp.

TreeMap

A Red-Black tree based NavigableMap implementation.

TreeSet

A NavigableSet implementation based on a TreeMap.

ULocale

[icu enhancement] ICU's replacement for java.util.Locale.

URI

Represents a Uniform Resource Identifier (URI) reference.

URL

Class URL represents a Uniform Resource Locator, a pointer to a "resource" on the World Wide Web.

UUID

A class that represents an immutable universally unique identifier (UUID).

UnresolvedPermission

Legacy security code; do not use.

ValueRange

The range of valid values for a date-time field.

Vector

The Vector class implements a growable array of objects.

WebBackForwardList

This class contains the back/forward list for a WebView.

WeekFields

Localized definitions of the day-of-week, week-of-month and week-of-year fields.

X500Principal

This class represents an X.

Year

A year in the ISO-8601 calendar system, such as 2007.

YearMonth

A year-month in the ISO-8601 calendar system, such as 2007-12.

ZoneId

A time-zone ID, such as Europe/Paris

ZoneOffset

A time-zone offset from Greenwich/UTC, such as +02:00.

ZoneOffsetTransition

A transition between two offsets caused by a discontinuity in the local time-line.

ZoneOffsetTransitionRule

A rule expressing how to create a transition.

ZoneRules

The rules defining how the zone offset varies for a single time-zone.

ZonedDateTime

A date-time with a time-zone in the ISO-8601 calendar system, such as 2007-12-03T10:15:30+01:00 Europe/Paris.

AbstractQueuedLongSynchronizer

A version of AbstractQueuedSynchronizer in which synchronization state is maintained as a long.

AbstractQueuedSynchronizer

Provides a framework for implementing blocking locks and related synchronizers (semaphores, events, etc) that rely on first-in-first-out (FIFO) wait queues.

AllPermission

Android doesn't support SecurityManager.

AuthPermission

Legacy security code; do not use.

AuthPermission

Legacy security code; do not use.

AuthProvider

Legacy security code; do not use.

BasicPermission

Android doesn't support SecurityManager.

BuddhistCalendar

BuddhistCalendar is a subclass of GregorianCalendar that numbers years since the birth of the Buddha.

CertPathValidatorException.BasicReason

The BasicReason enumerates the potential reasons that a certification path of any type may be invalid.

CertPathValidatorException.BasicReason.ALGORITHM_CONSTRAINED

The public key or the signature algorithm has been constrained.

CertPathValidatorException.BasicReason.EXPIRED

The certificate is expired.

CertPathValidatorException.BasicReason.INVALID_SIGNATURE

The signature is invalid.

CertPathValidatorException.BasicReason.NOT_YET_VALID

The certificate is not yet valid.

CertPathValidatorException.BasicReason.REVOKED

The certificate is revoked.

CertPathValidatorException.BasicReason.UNDETERMINED_REVOCATION_STATUS

The revocation status of the certificate could not be determined.

CertPathValidatorException.BasicReason.UNSPECIFIED

Unspecified reason.

ChineseCalendar

ChineseCalendar is a concrete subclass of Calendar that implements a traditional Chinese calendar.

ChoiceFormat

A ChoiceFormat allows you to attach a format to a range of numbers.

CompactDecimalFormat

Formats numbers in compact (abbreviated) notation, like "1.

ConnectionEvent

An Event object that provides information about the source of a connection-related event.

CopticCalendar

Implement the Coptic calendar system.

CountedCompleter

A ForkJoinTask with a completion action performed when triggered and there are no remaining pending actions.

Currency

A class encapsulating a currency, as defined by ISO 4217.

DHPrivateKey

The interface to a Diffie-Hellman private key.

DHPublicKey

The interface to a Diffie-Hellman public key.

DSAPrivateKey

The standard interface to a DSA private key.

DSAPublicKey

The interface to a DSA public key.

Date

A thin wrapper around a millisecond value that allows JDBC to identify this as an SQL DATE value.

DateFormat

DateFormat is an abstract class for date/time formatting subclasses which formats and parses dates or time in a language-independent manner.

DateFormat

[icu enhancement] ICU's replacement for java.text.DateFormat.

DateFormat.Field

The instances of this inner class are used as attribute keys and values in AttributedCharacterIterator that DateFormat.

DateFormat.Field

Defines constants that are used as attribute keys in the AttributedCharacterIterator returned from DateFormat.formatToCharacterIterator and as field identifiers in FieldPosition.

DateIntervalFormat

DateIntervalFormat is a class for formatting and parsing date intervals in a language-independent manner.

DecimalFormat

is a concrete subclass of NumberFormat that formats decimal numbers.

DecimalFormat

[icu enhancement] ICU's replacement for java.text.DecimalFormat.

ECPrivateKey

The interface to an elliptic curve (EC) private key.

ECPublicKey

The interface to an elliptic curve (EC) public key.

EdECPrivateKey

An interface for an elliptic curve private key as defined by RFC 8032: Edwards-Curve Digital Signature Algorithm (EdDSA).

EdECPublicKey

An interface for an elliptic curve public key as defined by RFC 8032: Edwards-Curve Digital Signature Algorithm (EdDSA).

EthiopicCalendar

Implement the Ethiopic calendar system.

FilePermission

Legacy security code; do not use.

Format.Field

Defines constants that are used as attribute keys in the AttributedCharacterIterator returned from Format.formatToCharacterIterator and as field identifiers in FieldPosition.

GregorianCalendar

[icu enhancement] ICU's replacement for java.util.GregorianCalendar.

GregorianCalendar

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

HandshakeCompletedEvent

This event indicates that an SSL handshake completed on a given SSL connection.

HebrewCalendar

HebrewCalendar is a subclass of Calendar that that implements the traditional Hebrew calendar.

IdentityScope

This class represents a scope for identities.

IndexedPropertyChangeEvent

An "IndexedPropertyChange" event gets delivered whenever a component that conforms to the JavaBeans™ specification (a "bean") changes a bound indexed property.

IndianCalendar

IndianCalendar is a subclass of GregorianCalendar that numbers years since the birth of the Buddha.

Inet4Address

This class represents an Internet Protocol version 4 (IPv4) address.

Inet6Address

This class represents an Internet Protocol version 6 (IPv6) address.

InetSocketAddress

This class implements an IP Socket Address (IP address + port number) It can also be a pair (hostname + port number), in which case an attempt will be made to resolve the hostname.

IslamicCalendar

IslamicCalendar is a subclass of Calendar that that implements the Islamic civil and religious calendars.

JapaneseCalendar

JapaneseCalendar is a subclass of GregorianCalendar that numbers years and eras based on the reigns of the Japanese emperors.

LinkPermission

The Permission class for link creation operations.

LinkPermission

The Permission class for link creation operations.

LinkedHashMap

Hash table and linked list implementation of the Map interface, with well-defined encounter order.

LinkedHashSet

Hash table and linked list implementation of the Set interface, with well-defined encounter order.

LoggingPermission

Legacy security code; do not use.

LoggingPermission

Legacy security code; do not use.

MeasureFormat

A formatter for Measure objects.

MessageFormat

provides a means to produce concatenated messages in a language-neutral way.

MessageFormat

[icu enhancement] ICU's replacement for java.text.MessageFormat.

MessageFormat.Field

Defines constants that are used as attribute keys in the AttributedCharacterIterator returned from MessageFormat.formatToCharacterIterator.

MessageFormat.Field

Defines constants that are used as attribute keys in the AttributedCharacterIterator returned from MessageFormat.formatToCharacterIterator.

NetPermission

Legacy security code; do not use.

NetPermission

Legacy security code; do not use.

NodeChangeEvent

An event emitted by a Preferences node to indicate that a child of that node has been added or removed.

NumberFormat

NumberFormat is the abstract base class for all number formats.

NumberFormat

[icu enhancement] ICU's replacement for java.text.NumberFormat.

NumberFormat.Field

The instances of this inner class are used as attribute keys and values in AttributedCharacterIterator that NumberFormat.

NumberFormat.Field

Defines constants that are used as attribute keys in the AttributedCharacterIterator returned from NumberFormat.formatToCharacterIterator and as field identifiers in FieldPosition.

PBEKey

The interface to a PBE key.

PKIXReason

The PKIXReason enumerates the potential PKIX-specific reasons that an X.

PKIXReason.INVALID_KEY_USAGE

The certificate's key usage is invalid.

PKIXReason.INVALID_NAME

The name constraints have been violated.

PKIXReason.INVALID_POLICY

The policy constraints have been violated.

PKIXReason.NAME_CHAINING

The certificate does not chain correctly.

PKIXReason.NOT_CA_CERT

The certificate is not a CA certificate.

PKIXReason.NO_TRUST_ANCHOR

No acceptable trust anchor found.

PKIXReason.PATH_TOO_LONG

The path length constraint has been violated.

PKIXReason.UNRECOGNIZED_CRIT_EXT

The certificate contains one or more unrecognized critical extensions.

Permissions

Android doesn't support SecurityManager.

PluralFormat

PluralFormat supports the creation of internationalized messages with plural inflection.

PreferenceChangeEvent

An event emitted by a Preferences node to indicate that a preference has been added, removed or has had its value changed.

PrivateCredentialPermission

Legacy security code; do not use.

PrivateKey

A private key.

Properties

The Properties class represents a persistent set of properties.

PropertyChangeEvent

A "PropertyChange" event gets delivered whenever a bean changes a "bound" or "constrained" property.

PropertyPermission

Legacy security code; do not use.

PropertyPermission

Legacy security code; do not use.

Provider

This class represents a "provider" for the Java Security API, where a provider implements some or all parts of Java Security.

PublicKey

A public key.

RSAMultiPrimePrivateCrtKey

The interface to an RSA multi-prime private key, as defined in the PKCS#1 v2.2 standard, using the Chinese Remainder Theorem (CRT) information values.

RSAPrivateCrtKey

The interface to an RSA private key, as defined in the PKCS#1 v2.2 standard, using the Chinese Remainder Theorem (CRT) information values.

RSAPrivateKey

The interface to an RSA private key.

RSAPublicKey

The interface to an RSA public key.

RecursiveAction

A recursive resultless ForkJoinTask.

RecursiveTask

A recursive result-bearing ForkJoinTask.

ReflectPermission

Legacy security code; do not use.

ReflectPermission

Legacy security code; do not use.

RowSetEvent

An Event object generated when an event occurs to a RowSet object.

RuntimePermission

Legacy security code; do not use.

RuntimePermission

Legacy security code; do not use.

SQLPermission

Legacy security code; do not use.

SQLPermission

Legacy security code; do not use.

SSLPermission

Legacy security code; do not use.

SSLPermission

Legacy security code; do not use.

SSLSessionBindingEvent

This event is propagated to a SSLSessionBindingListener.

SecretKey

A secret (symmetric) key.

SecretKeySpec

This class specifies a secret key in a provider-independent fashion.

SecureRandom

This class provides a cryptographically strong random number generator (RNG).

SecurityPermission

Legacy security code; do not use.

SecurityPermission

Legacy security code; do not use.

SelectFormat

SelectFormat supports the creation of internationalized messages by selecting phrases based on keywords.

SerializablePermission

This legacy security is not supported on Android.

SerializablePermission

This legacy security is not supported on Android.

Signer

This class is used to represent an Identity that can also digitally sign data.

SimpleDateFormat

is a concrete class for formatting and parsing dates in a locale-sensitive manner.

SimpleDateFormat

[icu enhancement] ICU's replacement for java.text.SimpleDateFormat.

SimpleTimeZone

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

SocketPermission

Legacy security code; do not use.

Stack

The Stack class represents a last-in-first-out (LIFO) stack of objects.

StatementEvent

A StatementEvent is sent to all StatementEventListeners which were registered with a PooledConnection.

TaiwanCalendar

TaiwanCalendar is a subclass of GregorianCalendar that numbers years since 1912.

TextAttribute

The TextAttribute class defines attribute keys and attribute values used for text rendering.

ThreadLocalRandom

A random number generator (with period 264) isolated to the current thread.

Time

A thin wrapper around the java.util.Date class that allows the JDBC API to identify this as an SQL TIME value.

TimeUnit

Measurement unit for time units.

TimeZoneFormat

TimeZoneFormat supports time zone display name formatting and parsing.

Timestamp

A thin wrapper around java.util.Date that allows the JDBC API to identify this as an SQL TIMESTAMP value.

UFormat

An abstract class that extends java.text.Format to provide additional ICU protocol, specifically, the getLocale() API.

UnresolvedPermission

Legacy security code; do not use.

VmSocketAddress

A virtio-vsock address VmSocketAddress.

X509Certificate

Abstract class for X.

XECPrivateKey

An interface for an elliptic curve private key as defined by RFC 7748.

XECPublicKey

An interface for an elliptic curve public key as defined by RFC 7748.

ZoneOffset

A time-zone offset from Greenwich/UTC, such as +02:00.

Serializability of a class is enabled by the class implementing the java.io.Serializable interface.

Warning: Deserialization of untrusted data is inherently dangerous and should be avoided. Untrusted data should be carefully validated.

Classes that do not implement this interface will not have any of their state serialized or deserialized. All subtypes of a serializable class are themselves serializable. The serialization interface has no methods or fields and serves only to identify the semantics of being serializable.

To allow subtypes of non-serializable classes to be serialized, the subtype may assume responsibility for saving and restoring the state of the supertype's public, protected, and (if accessible) package fields. The subtype may assume this responsibility only if the class it extends has an accessible no-arg constructor to initialize the class's state. It is an error to declare a class Serializable if this is not the case. The error will be detected at runtime.

During deserialization, the fields of non-serializable classes will be initialized using the public or protected no-arg constructor of the class. A no-arg constructor must be accessible to the subclass that is serializable. The fields of serializable subclasses will be restored from the stream.

When traversing a graph, an object may be encountered that does not support the Serializable interface. In this case the NotSerializableException will be thrown and will identify the class of the non-serializable object.

Classes that require special handling during the serialization and deserialization process must implement special methods with these exact signatures:

private void writeObject(java.io.ObjectOutputStream out)
      throws IOException
  private void readObject(java.io.ObjectInputStream in)
      throws IOException, ClassNotFoundException;
  private void readObjectNoData()
      throws ObjectStreamException;
  

The writeObject method is responsible for writing the state of the object for its particular class so that the corresponding readObject method can restore it. The default mechanism for saving the Object's fields can be invoked by calling out.defaultWriteObject. The method does not need to concern itself with the state belonging to its superclasses or subclasses. State is saved by writing the individual fields to the ObjectOutputStream using the writeObject method or by using the methods for primitive data types supported by DataOutput.

The readObject method is responsible for reading from the stream and restoring the classes fields. It may call in.defaultReadObject to invoke the default mechanism for restoring the object's non-static and non-transient fields. The defaultReadObject method uses information in the stream to assign the fields of the object saved in the stream with the correspondingly named fields in the current object. This handles the case when the class has evolved to add new fields. The method does not need to concern itself with the state belonging to its superclasses or subclasses. State is restored by reading data from the ObjectInputStream for the individual fields and making assignments to the appropriate fields of the object. Reading primitive data types is supported by DataInput.

The readObjectNoData method is responsible for initializing the state of the object for its particular class in the event that the serialization stream does not list the given class as a superclass of the object being deserialized. This may occur in cases where the receiving party uses a different version of the deserialized instance's class than the sending party, and the receiver's version extends classes that are not extended by the sender's version. This may also occur if the serialization stream has been tampered; hence, readObjectNoData is useful for initializing deserialized objects properly despite a "hostile" or incomplete source stream.

Serializable classes that need to designate an alternative object to be used when writing an object to the stream should implement this special method with the exact signature:

ANY-ACCESS-MODIFIER Object writeReplace() throws ObjectStreamException;
  

This writeReplace method is invoked by serialization if the method exists and it would be accessible from a method defined within the class of the object being serialized. Thus, the method can have private, protected and package-private access. Subclass access to this method follows java accessibility rules.

Classes that need to designate a replacement when an instance of it is read from the stream should implement this special method with the exact signature.

ANY-ACCESS-MODIFIER Object readResolve() throws ObjectStreamException;
  

This readResolve method follows the same invocation rules and accessibility rules as writeReplace.

The serialization runtime associates with each serializable class a version number, called a serialVersionUID, which is used during deserialization to verify that the sender and receiver of a serialized object have loaded classes for that object that are compatible with respect to serialization. If the receiver has loaded a class for the object that has a different serialVersionUID than that of the corresponding sender's class, then deserialization will result in an InvalidClassException. A serializable class can declare its own serialVersionUID explicitly by declaring a field named "serialVersionUID" that must be static, final, and of type long:

ANY-ACCESS-MODIFIER static final long serialVersionUID = 42L;
  
If a serializable class does not explicitly declare a serialVersionUID, then the serialization runtime will calculate a default serialVersionUID value for that class based on various aspects of the class, as described in the Java(TM) Object Serialization Specification. However, it is strongly recommended that all serializable classes explicitly declare serialVersionUID values, since the default serialVersionUID computation is highly sensitive to class details that may vary depending on compiler implementations, and can thus result in unexpected InvalidClassExceptions during deserialization. Therefore, to guarantee a consistent serialVersionUID value across different java compiler implementations, a serializable class must declare an explicit serialVersionUID value. It is also strongly advised that explicit serialVersionUID declarations use the private modifier where possible, since such declarations apply only to the immediately declaring class--serialVersionUID fields are not useful as inherited members. Array classes cannot declare an explicit serialVersionUID, so they always have the default computed value, but the requirement for matching serialVersionUID values is waived for array classes. Android implementation of serialVersionUID computation will change slightly for some classes if you're targeting android N. In order to preserve compatibility, this change is only enabled if the application target SDK version is set to 24 or higher. It is highly recommended to use an explicit serialVersionUID field to avoid compatibility issues.

Implement Serializable Judiciously

Refer to Effective Java's chapter on serialization for thorough coverage of the serialization API. The book explains how to use this interface without harming your application's maintainability. JSON is concise, human-readable and efficient. Android includes both a streaming API and a to read and write JSON. Use a binding library like GSON to read and write Java objects directly.

Summary