FileDocCategorySizeDatePackage
Timestamp.javaAPI DocAndroid 1.5 API5182Wed May 06 22:41:06 BST 2009java.security

Timestamp

public final class Timestamp extends Object implements Serializable
{@code Timestamp} represents a signed time stamp. {@code Timestamp} is immutable.
since
Android 1.0

Fields Summary
private static final long
serialVersionUID
private Date
timestamp
private CertPath
signerCertPath
private transient int
hash
Constructors Summary
public Timestamp(Date timestamp, CertPath signerCertPath)
Constructs a new instance of {@code Timestamp} with the specified {@code timestamp} and the given certificate path.

param
timestamp date and time.
param
signerCertPath the certificate path.
throws
NullPointerException if {@code timestamp} is {@code null} or if {@code signerCertPath} is {@code null}.
since
Android 1.0


                                                                                                     
         
        if (timestamp == null) {
            throw new NullPointerException(Messages.getString("security.0F")); //$NON-NLS-1$
        }
        if (signerCertPath == null) {
            throw new NullPointerException(Messages.getString("security.10")); //$NON-NLS-1$
        }
        // Clone timestamp to prevent modifications
        this.timestamp = new Date(timestamp.getTime());
        this.signerCertPath = signerCertPath;
    
Methods Summary
public booleanequals(java.lang.Object obj)
Compares the specified object with this {@code Timestamp} for equality and returns {@code true} if the specified object is equal, {@code false} otherwise. The given object is equal to this {@code Timestamp}, if it is an instance of {@code Timestamp}, the two timestamps have an equal date and time and their certificate paths are equal.

param
obj object to be compared for equality with this {@code Timestamp}.
return
{@code true} if the specified object is equal to this {@code Timestamp}, otherwise {@code false}.
see
#hashCode
since
Android 1.0

        if (obj == this) {
            return true;
        }
        if (obj instanceof Timestamp) {
            Timestamp that = (Timestamp) obj;
            return timestamp.equals(that.timestamp)
                    && signerCertPath.equals(that.signerCertPath);
        }
        return false;
    
public java.security.cert.CertPathgetSignerCertPath()
Returns the certificate path of this {@code Timestamp}.

return
the certificate path of this {@code Timestamp}.
since
Android 1.0

        return signerCertPath;
    
public java.util.DategetTimestamp()
Returns the date and time of this {@code Timestamp}.

return
the date and time of this {@code Timestamp}.
since
Android 1.0

        // BEGIN android-changed
        // copied from a newer version of harmony
        return (Date) timestamp.clone();
        // END android-changed
    
public inthashCode()
Returns the hash code value for this {@code Timestamp}. Returns the same hash code for {@code Timestamp}s that are equal to each other as required by the general contract of {@link Object#hashCode}.

return
the hash code value for this {@code Timestamp}.
see
Object#equals(Object)
see
Timestamp#equals(Object)
since
Android 1.0

        if (hash == 0) {
            hash = timestamp.hashCode() ^ signerCertPath.hashCode();
        }
        return hash;
    
public java.lang.StringtoString()
Returns a string containing a concise, human-readable description of this {@code Timestamp}.

return
a printable representation for this {@code Timestamp}.
since
Android 1.0

        StringBuffer buf = new StringBuffer(256);
        // Dump only the first certificate
        buf.append("Timestamp [").append(timestamp).append(" certPath="); //$NON-NLS-1$ //$NON-NLS-2$
        buf.append(signerCertPath.getCertificates().get(0)).append("]"); //$NON-NLS-1$
        return buf.toString();