Package net.sf.jpluck.plucker.functions

Source Code of net.sf.jpluck.plucker.functions.EmbeddedImage

package net.sf.jpluck.plucker.functions;

import net.sf.jpluck.palm.PdbOutputStream;
import net.sf.jpluck.plucker.Link;
import net.sf.jpluck.plucker.Text;
import java.io.IOException;

public class EmbeddedImage extends LinkFunction implements SignificantContent {

    private Text alt;

    public EmbeddedImage(String uri) {
        super(uri);
    }

    public EmbeddedImage(String uri, Text alt) {
        super(uri);
        this.alt = alt;
    }

    public void write(PdbOutputStream out) throws IOException {
        int recordId = linkResolver.resolve(uri).getRecordId();
        Link fullSizeLink= linkResolver.resolve(uri + ".alternate");
        if (fullSizeLink != null) {
            out.writeByte(Function.MULTIPLE_EMBEDDED_IMAGE);
            out.writeShort(fullSizeLink.getRecordId());
            out.writeShort(recordId);
        } else {
            out.writeByte(Function.EMBEDDED_IMAGE);
            out.writeShort(recordId);
        }
    }

    public Text getAlt() {
        return alt;
    }

    public int getSize() {
        return 5; // Actual size is either 3 or 5
    }
}
TOP

Related Classes of net.sf.jpluck.plucker.functions.EmbeddedImage

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.