Search in sources :

Example 61 with Tag

use of org.mozilla.jss.asn1.Tag in project omegat by omegat-org.

the class Handler method queueTag.

private void queueTag(String tag, Attributes attributes) {
    Tag xmltag = null;
    XMLIntactTag intacttag = null;
    setTranslatableTag(tag, XMLUtils.convertAttributes(attributes));
    setSpacePreservingTag(XMLUtils.convertAttributes(attributes));
    if (!collectingIntactText()) {
        if (isContentBasedTag(tag, XMLUtils.convertAttributes(attributes))) {
            intacttag = new XMLContentBasedTag(dialect, this, tag, getShortcut(tag), dialect.getContentBasedTags().get(tag), attributes);
            xmltag = intacttag;
            intacttagName = tag;
            intacttagAttributes = XMLUtils.convertAttributes(attributes);
        } else if (isIntactTag(tag, XMLUtils.convertAttributes(attributes))) {
            intacttag = new XMLIntactTag(dialect, this, tag, getShortcut(tag), attributes);
            xmltag = intacttag;
            intacttagName = tag;
            intacttagAttributes = XMLUtils.convertAttributes(attributes);
        }
    }
    if (xmltag == null) {
        xmltag = new XMLTag(tag, getShortcut(tag), Tag.Type.BEGIN, attributes, this.translator);
        xmlTagName.push(xmltag.getTag());
        xmlTagAttributes.push(xmltag.getAttributes());
    }
    currEntry().add(xmltag);
    if (intacttag != null) {
        intacttagEntry = intacttag.getIntactContents();
    }
    if (!collectingIntactText()) {
        for (int i = 0; i < xmltag.getAttributes().size(); i++) {
            Attribute attr = xmltag.getAttributes().get(i);
            if ((dialect.getTranslatableAttributes().contains(attr.getName()) || dialect.getTranslatableTagAttributes().containsPair(tag, attr.getName())) && dialect.validateTranslatableTagAttribute(tag, attr.getName(), xmltag.getAttributes())) {
                attr.setValue(StringUtil.makeValidXML(translator.translate(StringUtil.unescapeXMLEntities(attr.getValue()), null)));
            }
        }
    }
}
Also used : Attribute(org.omegat.filters3.Attribute) Tag(org.omegat.filters3.Tag)

Example 62 with Tag

use of org.mozilla.jss.asn1.Tag in project jss by dogtagpki.

the class CRLDistributionPoint method encode.

@Override
public void encode(Tag implicitTag, OutputStream ostream) throws IOException {
    SEQUENCE seq = new SEQUENCE();
    DerOutputStream derOut;
    try {
        // is a CHOICE, the [0] tag is forced to be EXPLICIT.
        if (fullName != null) {
            EXPLICIT distPoint = new EXPLICIT(Tag.get(0), fullNameEncoding);
            seq.addElement(distPoint);
        } else if (relativeName != null) {
            derOut = new DerOutputStream();
            relativeName.encode(derOut);
            ANY rn = new ANY(derOut.toByteArray());
            EXPLICIT raw = new EXPLICIT(Tag.get(1), rn);
            ByteArrayOutputStream bos = new ByteArrayOutputStream();
            raw.encode(bos);
            ANY distPointName = new ANY(bos.toByteArray());
            EXPLICIT distPoint = new EXPLICIT(Tag.get(0), distPointName);
            seq.addElement(distPoint);
        }
        // Encodes the ReasonFlags.
        if (reasons != null) {
            derOut = new DerOutputStream();
            derOut.putUnalignedBitString(reasons);
            ANY raw = new ANY(derOut.toByteArray());
            ByteArrayOutputStream bos = new ByteArrayOutputStream();
            raw.encodeWithAlternateTag(Tag.get(1), bos);
            ANY reasonEncoding = new ANY(bos.toByteArray());
            seq.addElement(Tag.get(1), reasonEncoding);
        }
        // Encodes the CRLIssuer
        if (CRLIssuer != null) {
            seq.addElement(Tag.get(2), CRLIssuerEncoding);
        }
        seq.encode(implicitTag, ostream);
    } catch (InvalidBERException e) {
        // the Sun encoding classes
        throw new IOException(e.toString());
    }
}
Also used : InvalidBERException(org.mozilla.jss.asn1.InvalidBERException) DerOutputStream(org.mozilla.jss.netscape.security.util.DerOutputStream) SEQUENCE(org.mozilla.jss.asn1.SEQUENCE) ByteArrayOutputStream(java.io.ByteArrayOutputStream) IOException(java.io.IOException) ANY(org.mozilla.jss.asn1.ANY) EXPLICIT(org.mozilla.jss.asn1.EXPLICIT)

Example 63 with Tag

use of org.mozilla.jss.asn1.Tag in project jss by dogtagpki.

the class Attribute method encode.

@Override
public void encode(Tag implicit, OutputStream ostream) throws IOException {
    SEQUENCE seq = new SEQUENCE();
    seq.addElement(type);
    seq.addElement(values);
    seq.encode(implicit, ostream);
}
Also used : SEQUENCE(org.mozilla.jss.asn1.SEQUENCE)

Example 64 with Tag

use of org.mozilla.jss.asn1.Tag in project jss by dogtagpki.

the class SignerInfo method encode.

@Override
public void encode(Tag tag, OutputStream ostream) throws IOException {
    SEQUENCE sequence = new SEQUENCE();
    sequence.addElement(version);
    sequence.addElement(issuerAndSerialNumber);
    sequence.addElement(digestAlgorithm);
    if (authenticatedAttributes != null) {
        sequence.addElement(new Tag(0), authenticatedAttributes);
    }
    sequence.addElement(digestEncryptionAlgorithm);
    sequence.addElement(encryptedDigest);
    if (unauthenticatedAttributes != null) {
        sequence.addElement(new Tag(1), unauthenticatedAttributes);
    }
    sequence.encode(tag, ostream);
}
Also used : SEQUENCE(org.mozilla.jss.asn1.SEQUENCE) Tag(org.mozilla.jss.asn1.Tag)

Example 65 with Tag

use of org.mozilla.jss.asn1.Tag in project jss by dogtagpki.

the class CMCStatusInfoV2 method encode.

@Override
public void encode(Tag implicitTag, OutputStream ostream) throws IOException {
    SEQUENCE seq = new SEQUENCE();
    seq.addElement(status);
    seq.addElement(bodyList);
    if (statusString != null) {
        seq.addElement(statusString);
    }
    if (otherInfo != null) {
        seq.addElement(otherInfo);
    }
    seq.encode(implicitTag, ostream);
}
Also used : SEQUENCE(org.mozilla.jss.asn1.SEQUENCE)

Aggregations

Tag (org.openstreetmap.osmosis.core.domain.v0_6.Tag)66 SEQUENCE (org.mozilla.jss.asn1.SEQUENCE)23 CommonEntityData (org.openstreetmap.osmosis.core.domain.v0_6.CommonEntityData)23 WayNode (org.openstreetmap.osmosis.core.domain.v0_6.WayNode)17 IOException (java.io.IOException)16 Test (org.junit.Test)16 Node (org.openstreetmap.osmosis.core.domain.v0_6.Node)16 OsmUser (org.openstreetmap.osmosis.core.domain.v0_6.OsmUser)16 Way (org.openstreetmap.osmosis.core.domain.v0_6.Way)12 Date (java.util.Date)10 RelationMember (org.openstreetmap.osmosis.core.domain.v0_6.RelationMember)10 OsmosisRuntimeException (org.openstreetmap.osmosis.core.OsmosisRuntimeException)9 Relation (org.openstreetmap.osmosis.core.domain.v0_6.Relation)9 Tag (org.mozilla.jss.asn1.Tag)7 SQLException (java.sql.SQLException)6 ArrayList (java.util.ArrayList)6 EXPLICIT (org.mozilla.jss.asn1.EXPLICIT)6 Osmformat (crosby.binary.Osmformat)5 NodeContainer (org.openstreetmap.osmosis.core.container.v0_6.NodeContainer)5 Point (com.vividsolutions.jts.geom.Point)4