ShortBlob.java :  » Google-tech » slim3 » com » google » appengine » api » datastore » Java Open Source

Java Open Source » Google tech » slim3 
slim3 » com » google » appengine » api » datastore » ShortBlob.java
package com.google.appengine.api.datastore;

import java.io.Serializable;
import java.util.Arrays;

public final class ShortBlob implements Serializable {

    public static final long serialVersionUID = -234210296L;
    
    private byte bytes[];
    
    protected ShortBlob() {
        bytes = null;
    }

    public ShortBlob(byte bytes[]) {
        this.bytes = new byte[bytes.length];
        System.arraycopy(bytes, 0, this.bytes, 0, bytes.length);
    }

    public byte[] getBytes() {
        return bytes;
    }

    public int hashCode() {
        return Arrays.hashCode(bytes);
    }

    public boolean equals(Object object) {
        if (object instanceof ShortBlob) {
            ShortBlob other = (ShortBlob) object;
            return Arrays.equals(bytes, other.bytes);
        } else {
            return false;
        }
    }

    public String toString() {
        return (new StringBuilder())
            .append("<ShortBlob: ")
            .append(bytes.length)
            .append(" bytes>")
            .toString();
    }

    public int compareTo(ShortBlob other) {
        throw new RuntimeException("compareTo is not supported on gwt");
    }
}
java2s.com  | Contact Us | Privacy Policy
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.