FileDocCategorySizeDatePackage
PrinterInfo.javaAPI DocAndroid 5.1 API9606Thu Mar 12 22:22:10 GMT 2015android.print

PrinterInfo

public final class PrinterInfo extends Object implements android.os.Parcelable
This class represents the description of a printer. Instances of this class are created by print services to report to the system the printers they manage. The information of this class has two major components, printer properties such as name, id, status, description and printer capabilities which describe the various print modes a printer supports such as media sizes, margins, etc.

Fields Summary
public static final int
STATUS_IDLE
Printer status: the printer is idle and ready to print.
public static final int
STATUS_BUSY
Printer status: the printer is busy printing.
public static final int
STATUS_UNAVAILABLE
Printer status: the printer is not available.
private PrinterId
mId
private String
mName
private int
mStatus
private String
mDescription
private PrinterCapabilitiesInfo
mCapabilities
public static final Parcelable.Creator
CREATOR
Constructors Summary
private PrinterInfo()


      
        /* do nothing */
    
private PrinterInfo(PrinterInfo prototype)

        copyFrom(prototype);
    
private PrinterInfo(android.os.Parcel parcel)

        mId = parcel.readParcelable(null);
        mName = parcel.readString();
        mStatus = parcel.readInt();
        mDescription = parcel.readString();
        mCapabilities = parcel.readParcelable(null);
    
Methods Summary
public voidcopyFrom(android.print.PrinterInfo other)

hide

        if (this == other) {
            return;
        }
        mId = other.mId;
        mName = other.mName;
        mStatus = other.mStatus;
        mDescription = other.mDescription;
        if (other.mCapabilities != null) {
            if (mCapabilities != null) {
                mCapabilities.copyFrom(other.mCapabilities);
            } else {
                mCapabilities = new PrinterCapabilitiesInfo(other.mCapabilities);
            }
        } else {
            mCapabilities = null;
        }
    
public intdescribeContents()

        return 0;
    
public booleanequals(java.lang.Object obj)

        if (this == obj) {
            return true;
        }
        if (obj == null) {
            return false;
        }
        if (getClass() != obj.getClass()) {
            return false;
        }
        PrinterInfo other = (PrinterInfo) obj;
        if (mId == null) {
            if (other.mId != null) {
                return false;
            }
        } else if (!mId.equals(other.mId)) {
            return false;
        }
        if (!TextUtils.equals(mName, other.mName)) {
            return false;
        }
        if (mStatus != other.mStatus) {
            return false;
        }
        if (!TextUtils.equals(mDescription, other.mDescription)) {
            return false;
        }
        if (mCapabilities == null) {
            if (other.mCapabilities != null) {
                return false;
            }
        } else if (!mCapabilities.equals(other.mCapabilities)) {
            return false;
        }
        return true;
    
public PrinterCapabilitiesInfogetCapabilities()
Gets the printer capabilities.

return
The capabilities.

        return mCapabilities;
    
public java.lang.StringgetDescription()
Gets the printer description.

return
The description.

        return mDescription;
    
public PrinterIdgetId()
Get the globally unique printer id.

return
The printer id.

        return mId;
    
public java.lang.StringgetName()
Get the printer name.

return
The printer name.

        return mName;
    
public intgetStatus()
Gets the printer status.

return
The status.
see
#STATUS_BUSY
see
#STATUS_IDLE
see
#STATUS_UNAVAILABLE

        return mStatus;
    
public inthashCode()

        final int prime = 31;
        int result = 1;
        result = prime * result + ((mId != null) ? mId.hashCode() : 0);
        result = prime * result + ((mName != null) ? mName.hashCode() : 0);
        result = prime * result + mStatus;
        result = prime * result + ((mDescription != null) ? mDescription.hashCode() : 0);
        result = prime * result + ((mCapabilities != null) ? mCapabilities.hashCode() : 0);
        return result;
    
public java.lang.StringtoString()

        StringBuilder builder = new StringBuilder();
        builder.append("PrinterInfo{");
        builder.append("id=").append(mId);
        builder.append(", name=").append(mName);
        builder.append(", status=").append(mStatus);
        builder.append(", description=").append(mDescription);
        builder.append(", capabilities=").append(mCapabilities);
        builder.append("\"}");
        return builder.toString();
    
public voidwriteToParcel(android.os.Parcel parcel, int flags)

        parcel.writeParcelable(mId, flags);
        parcel.writeString(mName);
        parcel.writeInt(mStatus);
        parcel.writeString(mDescription);
        parcel.writeParcelable(mCapabilities, flags);