All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.dongliu.apk.parser.bean.Icon Maven / Gradle / Ivy

There is a newer version: 2.6.6
Show newest version
package net.dongliu.apk.parser.bean;

import javax.annotation.Nullable;
import java.io.Serializable;

/**
 * The plain file apk icon.
 *
 * @author Liu Dong
 */
public class Icon implements IconFace, Serializable {

    private static final long serialVersionUID = 8680309892249769701L;
    private final String path;
    private final int density;
    private final byte[] data;

    public Icon(String path, int density, byte[] data) {
        this.path = path;
        this.density = density;
        this.data = data;
    }

    /**
     * The icon path in apk file
     */
    public String getPath() {
        return path;
    }

    /**
     * Return the density this icon for. 0 means default icon.
     * see {@link net.dongliu.apk.parser.struct.resource.Densities} for more density values.
     */
    public int getDensity() {
        return density;
    }

    @Override
    public boolean isFile() {
        return true;
    }

    /**
     * Icon data may be null, due to some apk missing the icon file.
     */
    @Nullable
    public byte[] getData() {
        return data;
    }

    @Override
    public String toString() {
        return "Icon{path='" + path + '\'' + ", density=" + density + ", size=" + (data == null ? 0 : data.length) + '}';
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy