/*
Writes a processing instruction

(non-Javadoc)

@see
javax.xml.stream.XMLStreamWriter#writeProcessingInstruction(java.lang
.String, java.lang.String)
967875
public void writeProcessingInstruction(String target, String data)
			throws XMLStreamException {
		if (preservePI) {
			try {
				this.checkPendingATEvents();
				encoder.encodeProcessingInstruction(target, data);
			} catch (Exception e) {
				throw new XMLStreamException(e.getLocalizedMessage(), e);
			}
		}
	}
1032894
protected void writeData(@NotNull Bytes inBytes, @NotNull WriteMarshallable c) {
        outWire.writeDocument(false, out -> {
            final long readPosition = inBytes.readPosition();
            final long position = outWire.bytes().writePosition();
            try {
                c.writeMarshallable(outWire);
            } catch (Throwable t) {
                inBytes.readPosition(readPosition);
                if (LOG.isInfoEnabled())
                    LOG.info("While reading " + inBytes.toDebugString(),
                            " processing wire " + c, t);
                outWire.bytes().writePosition(position);
                outWire.writeEventName(() -> "exception").throwable(t);
            }

            // write 'reply : {} ' if no data was sent
            if (position == outWire.bytes().writePosition()) {
                outWire.writeEventName(reply).marshallable(EMPTY);
            }
        });

        logYaml(outWire);
    }
333918
public boolean isAssertionInstruction(Instruction ins, ConstantPoolGen cpg) {

        if (ins instanceof InvokeInstruction) {
            return isAssertionCall((InvokeInstruction) ins);
        }
        if (ins instanceof GETSTATIC) {
            GETSTATIC getStatic = (GETSTATIC) ins;
            String className = getStatic.getClassName(cpg);
            String fieldName = getStatic.getFieldName(cpg);
            if ("java.util.logging.Level".equals(className) && "SEVERE".equals(fieldName)) {
                return true;
            }
            return "org.apache.log4j.Level".equals(className)
                && ("ERROR".equals(fieldName) || "FATAL".equals(fieldName));
        }
        return false;
    }
1155426
void writeConstructor(Definition def, Writer out, int indent) throws IOException
   {
      writeSimpleMethodSignature(out, indent, " * Default constructor", "public " + getClassName(def) + "()");
      writeLeftCurlyBracket(out, indent);

      writeWithIndent(out, indent + 1, "this.mbeanServer = null;\n");
      writeWithIndent(out, indent + 1, "this.objectName = \"" + def.getDefaultValue() + ",class=HelloWorld\";\n");
      writeWithIndent(out, indent + 1, "this.registered = false;\n\n");

      writeRightCurlyBracket(out, indent);
      writeEol(out);
   }
451565
protected void compareProcessingInstruction(ProcessingInstruction control,
                                                ProcessingInstruction test, DifferenceListener listener)
        throws DifferenceFoundException {
        compare(control.getTarget(), test.getTarget(), control, test, listener,
                PROCESSING_INSTRUCTION_TARGET);
        compare(control.getData(), test.getData(), control, test, listener,
                PROCESSING_INSTRUCTION_DATA);
    }
1363364
@Override
  public void write(int b) throws IOException
  {
    if(!bytesBuffer.hasRemaining()) {
      processBytesBuffer(false);
    }
    bytesBuffer.put((byte)b);
  }
466932
@Override
    public void write(IChemObject object) throws CDKException {
        try {
            ProcessingInstruction processingInstruction = new ProcessingInstruction("xml-stylesheet",
                    "href=\"http://www.w3.org/2000/08/w3c-synd/style.css\" type=\"text/css\"");
            Element rdfElement = new Element("rdf:RDF", NS_RDF);
            rdfElement.addNamespaceDeclaration("", NS_RSS10);
            rdfElement.addNamespaceDeclaration("mn", "http://usefulinc.com/rss/manifest/");
            rdfElement.addNamespaceDeclaration("dc", NS_DCELEMENTS);
            rdfElement.addNamespaceDeclaration("cml", Convertor.NS_CML);
            Document doc = new Document(rdfElement);
            doc.insertChild(processingInstruction, 0);
            Element channelElement = new Element("channel", NS_RSS10);
            Element titleElement = new Element("title", NS_RSS10);
            titleElement.appendChild(new Text(title));
            channelElement.appendChild(titleElement);
            Element linkElement = new Element("link", NS_RSS10);
            linkElement.appendChild(new Text(link));
            channelElement.appendChild(linkElement);
            Element descriptionElement = new Element("description", NS_RSS10);
            descriptionElement.appendChild(new Text(description));
            channelElement.appendChild(descriptionElement);
            Element publisherElement = new Element("dc:publisher", NS_DCELEMENTS);
            publisherElement.appendChild(new Text(publisher));
            channelElement.appendChild(publisherElement);
            Element creatorElement = new Element("dc:creator", NS_DCELEMENTS);
            creatorElement.appendChild(new Text(creator));
            channelElement.appendChild(creatorElement);
            Element imageElement = new Element("image", NS_RSS10);
            imageElement.addAttribute(new Attribute("rdf:resource", NS_RDF, imagelink));
            channelElement.appendChild(imageElement);
            Element itemsElement = new Element("items", NS_RSS10);
            Element seqElement = new Element("rdf:Seq", NS_RDF);
            itemsElement.appendChild(seqElement);
            channelElement.appendChild(itemsElement);
            channelElement.addAttribute(new Attribute("rdf:about", NS_RDF, about));
            rdfElement.appendChild(channelElement);
            List<IChemObject> list = new ArrayList<>();
            if (object instanceof IAtomContainerSet) {
                for (int i = 0; i < ((IAtomContainerSet) object).getAtomContainerCount(); i++) {
                    list.add(((IAtomContainerSet) object).getAtomContainer(i));
                }
            } else {
                list.add(object);
            }
            for (int i = 0; i < list.size(); i++) {
                IChemObject chemObject = (IChemObject) list.get(i);
                Element itemElement = new Element("item", NS_RSS10);
                String easylink = (String) linkmap.get(chemObject);
                if (easylink != null) itemElement.addAttribute(new Attribute("rdf:about", NS_RDF, easylink));
                Element link2Element = new Element("link", NS_RSS10);
                link2Element.appendChild(new Text(easylink));
                itemElement.appendChild(link2Element);
                String title = (String) chemObject.getProperties().get(CDKConstants.TITLE);
                if (titlemap.get(chemObject) != null) {
                    Element title2Element = new Element("title", NS_RSS10);
                    title2Element.appendChild(new Text((String) titlemap.get(chemObject)));
                    itemElement.appendChild(title2Element);
                }
                if (title != null) {
                    Element description2Element = new Element("description", NS_RSS10);
                    description2Element.appendChild(new Text(title));
                    itemElement.appendChild(description2Element);
                    Element subjectElement = new Element("dc:subject", NS_DCELEMENTS);
                    subjectElement.appendChild(new Text(title));
                    itemElement.appendChild(subjectElement);
                }
                if (datemap.get(chemObject) != null) {
                    Element dateElement = new Element("dc:date", NS_DCELEMENTS);
                    SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss", Locale.ROOT);
                    dateElement.appendChild(new Text(formatter.format((Date) datemap.get(chemObject)) + timezone));
                    itemElement.appendChild(dateElement);
                }
                Element creator2Element = new Element("dc:creator", NS_DCELEMENTS);
                creator2Element.appendChild(new Text((String) creatormap.get(chemObject)));
                itemElement.appendChild(creator2Element);
                // add the InChI to the CMLRSS feed
                if (inchimap.get(chemObject) != null) {
                    Element inchiElement = new Element("cml:identifier", "http://www.xml-cml.org/schema/cml2/core/");
                    inchiElement.appendChild(new Text((String) inchimap.get(chemObject)));
                    itemElement.appendChild(inchiElement);
                }
                Element root = null;
                Convertor convertor = new Convertor(true, null);
                object = list.get(i);
                if (object instanceof ICrystal) {
                    root = convertor.cdkCrystalToCMLMolecule((ICrystal) object);
                } else if (object instanceof IAtomContainer) {
                    root = convertor.cdkAtomContainerToCMLMolecule((IAtomContainer) object);
                } else if (object instanceof IAtom) {
                    root = convertor.cdkAtomToCMLAtom(null, (IAtom) object);
                } else if (object instanceof IBond) {
                    root = convertor.cdkBondToCMLBond((IBond) object);
                } else if (object instanceof IReaction) {
                    root = convertor.cdkReactionToCMLReaction((IReaction) object);
                } else if (object instanceof IReactionSet) {
                    root = convertor.cdkReactionSetToCMLReactionList((IReactionSet) object);
                } else if (object instanceof IAtomContainerSet) {
                    root = convertor.cdkAtomContainerSetToCMLList((IAtomContainerSet) object);
                } else if (object instanceof IChemSequence) {
                    root = convertor.cdkChemSequenceToCMLList((IChemSequence) object);
                } else if (object instanceof IChemModel) {
                    root = convertor.cdkChemModelToCMLList((IChemModel) object);
                } else if (object instanceof IChemFile) {
                    root = convertor.cdkChemFileToCMLList((IChemFile) object);
                } else {
                    throw new CDKException("Unsupported chemObject: " + object.getClass().getName());
                }
                itemElement.appendChild(root);
                if (multiMap.get(chemObject) != null) {
                    Collection coll = (Collection) multiMap.get(chemObject);
                    Iterator iterator = coll.iterator();
                    while (iterator.hasNext()) {
                        itemElement.appendChild((Element) iterator.next());
                    }
                }
                rdfElement.appendChild(itemElement);
                Element imageElement2 = new Element("rdf:li", NS_RDF);
                imageElement2.addAttribute(new Attribute("rdf:resource", NS_RDF, (String) linkmap.get(chemObject)));
                seqElement.appendChild(imageElement2);
            }
            writer.write(doc.toXML());
            writer.flush();
        } catch (IOException ex) {
            throw new CDKException(ex.getMessage(), ex);
        }

    }
264788
@Override
    public void handleInstruction(int opcode, int index) {
        bytecodeSet.set(opcode);
        offsetToOpcodeMap[index] = (short) opcode;
    }
680279
public void writeElement(StringBuffer buffer, String tag, String content) {

        buffer.append("<" + tag + ">");
        buffer.append(CmsEncoder.escapeXml(content));
        buffer.append("</" + tag + ">");
    }
154864
public XMLDocument addProcessingInstruction(String target, String data) throws SAXException{
        xml.processingInstruction(target, data);
        return this;
    }
27649
@Override
   public void writeClassBody(Definition def, Writer out) throws IOException
   {
      int indent = 1;
      out.write("public interface " + getClassName(def));
      writeLeftCurlyBracket(out, 0);
      writeWithIndent(out, indent, "/**\n");
      writeWithIndent(out, indent, " * Receive message\n");
      writeWithIndent(out, indent, " * @param msg String.\n");
      writeWithIndent(out, indent, " */\n");

      writeWithIndent(out, indent, "public void onMessage(String msg);");

      writeRightCurlyBracket(out, 0);
   }
684741
private void processProvideCall(NodeTraversal t, Node n, Node parent) {
    checkState(n.isCall());
    Node left = n.getFirstChild();
    Node arg = left.getNext();
    if (verifyProvide(left, arg)) {
      String ns = arg.getString();

      maybeAddNameToSymbolTable(left);
      maybeAddStringToSymbolTable(arg);

      if (providedNames.containsKey(ns)) {
        ProvidedName previouslyProvided = providedNames.get(ns);
        if (!previouslyProvided.isExplicitlyProvided() || previouslyProvided.isPreviouslyProvided) {
          previouslyProvided.addProvide(parent, t.getModule(), true);
        } else {
          String explicitSourceName = previouslyProvided.explicitNode.getSourceFileName();
          compiler.report(
              JSError.make(
                  n, ProcessClosurePrimitives.DUPLICATE_NAMESPACE_ERROR, ns, explicitSourceName));
        }
      } else {
        registerAnyProvidedPrefixes(ns, parent, t.getModule());
        providedNames.put(
            ns,
            new ProvidedName(
                ns, parent, t.getModule(), /* explicit= */ true, /* fromPreviousProvide= */ false));
      }
    }
  }
1325379
@Override
	public void process(String xmlString, ITempelEntryProcessor entryProcessor) throws Exception {
		process(new ByteArrayInputStream(xmlString.getBytes()), entryProcessor);
	}
664082
public void doProcess(BasicServlet servlet, HttpServletRequest req, HttpServletResponse res, PrintWriter out) 
        throws ServletException, IOException
    {
        // Override this
    }
71354
@Override
    public void writeContent(XMLExtendedStreamWriter writer, Dependency value) throws XMLStreamException {

        if(value != null && this != value) {
            throw new IllegalStateException("Wrong target dependency.");
        }

        writer.writeStartElement(ModuleConfigImpl.MODULE);
        writer.writeAttribute(ModuleConfigImpl.NAME, name);
        if (export) {
            writer.writeAttribute(ModuleConfigImpl.EXPORT, "true");
        }
        writer.writeEndElement();
    }
309207
@Override
    public void xmlWriteOn(FormattedWriter writer) throws IOException
    {
        writer.startTag(XML_MESSAGE_STORE);
        writer.indent();
        synchronized (_startLock)
        {
            if (_state == MessageStoreState.STATE_STARTED)
            {
                _rootMembership.xmlWriteItemStreamsOn(writer);
            }
            else
            {
                writer.newLine();
                writer.write(XML_CANNOT_BE_WRITTEN);
            }
        }

        if (null != _itemStorageManager)
        {
            _itemStorageManager.xmlWriteOn(writer);
        }

        if (null != _membershipMap)
        {
            _membershipMap.xmlWriteOn(writer);
        }

        if (null != _persistentMessageStore)
        {
            _persistentMessageStore.xmlWriteOn(writer);
        }

        if (null != _expirer)
        {
            _expirer.xmlWriteOn(writer);
        }

        if (null != _cacheLoader)
        {
            _cacheLoader.xmlWriteOn(writer);
        }

        if (null != _deliveryDelayManager) {
            _deliveryDelayManager.xmlWriteOn(writer);
        }
        writer.outdent();
        writer.newLine();
        writer.endTag(XML_MESSAGE_STORE);
    }
525862
public void processXML()
                    throws InjectionException
    {
        final boolean isTraceOn = TraceComponent.isAnyTracingEnabled();
        if (isTraceOn && tc.isEntryEnabled())
            Tr.entry(tc, "processXML");

        for (int processorIndex = 0; processorIndex < ivProviders.size(); processorIndex++)
        {
            InjectionProcessorProvider<?, ?> provider = ivProviders.get(processorIndex);
            if (isProcessXMLNeeded(provider))
            {
                InjectionProcessor<?, ?> processor = getProcessor(processorIndex, provider);

                try
                {
                    processor.processXML();
                } catch (InjectionException iex)
                {
                    FFDCFilter.processException(iex, CLASS_NAME + ".processXML",
                                                "300", this, new Object[] { processor });
                    // Include the cause message in the logged message, and don't
                    // unnecessarily wrap the exception.                          F53641
                    Tr.error(tc, "FAILED_TO_PROCESS_XML_FROM_DD_CWNEN0009E", iex.getMessage());
                    throw iex;
                } catch (Throwable t)
                {
                    FFDCFilter.processException(t, CLASS_NAME + ".processXML",
                                                "768", this, new Object[] { processor });
                    // Include the cause stack in the logged message.             F53641
                    Tr.error(tc, "FAILED_TO_PROCESS_XML_FROM_DD_CWNEN0009E", t);
                    throw new InjectionConfigurationException("Failed to process xml from Deployment Descriptor.", t);
                }
            }
        }

        if (isTraceOn && tc.isEntryEnabled())
            Tr.exit(tc, "processXML");
    }