Package org.apache.tools.ant.filters

Examples of org.apache.tools.ant.filters.StringInputStream


    List<String> args = new ArrayList<String>();
    args.add(schema.toString());
    args.add("-");
    args.addAll(extra);
    new DataFileWriteTool().run(
        new StringInputStream(jsonData),
        new PrintStream(out), // stdout
        null, // stderr
        args);
    out.close();
    fout.close();
View Full Code Here


  public void testFailureOnWritingPartialJSONValues() throws Exception {
    ByteArrayOutputStream baos = new ByteArrayOutputStream();
    PrintStream out = new PrintStream(baos);
    try {
      new DataFileWriteTool().run(
          new StringInputStream("{"),
          new PrintStream(out), // stdout
          null, // stderr
          Arrays.asList("{ \"type\":\"record\", \"fields\":" +
                        "[{\"name\":\"foo\", \"type\":\"string\"}], " +
                        "\"name\":\"boring\" }", "-"));
View Full Code Here

    File outFile = AvroTestUtil.tempFile(
        TestDataFileTools.class + "." + testName + ".avro");
    FileOutputStream fout = new FileOutputStream(outFile);
    PrintStream out = new PrintStream(fout);
    new DataFileWriteTool().run(
        new StringInputStream(json),
        new PrintStream(out), // stdout
        null, // stderr
        Arrays.asList(schema, "-"));
    out.close();
    fout.close();
View Full Code Here

    }

    private Properties loadProperties(String systemPropertiesCSV) {
        Properties properties = new Properties();
        try {
            properties.load(new StringInputStream(systemPropertiesCSV.replace(",", "\n")));
        } catch (IOException e) {
            // return empty map
        }
        return properties;
    }
View Full Code Here

        Document doc = documentBuilder.parse(in);

        Element root = doc.getDocumentElement();
        NodeList nodeList = root.getElementsByTagName("soap:Envelope");
       
        StringInputStream request;
       
        for(int i = 0; i < nodeList.getLength(); i++){
          StringBuffer envelope = new StringBuffer("<soap:Envelope");
          Element element = (Element)nodeList.item(i);
          NamedNodeMap attributes = element.getAttributes();
          if(attributes != null){
            for(int k=0; k < attributes.getLength(); k++){
              envelope.append(" "+attributes.item(k).getNodeName().trim());
              envelope.append("=\""+attributes.item(k).getNodeValue().trim()+"\"");
            }
            String content = element.getTextContent();
           
            if(content != null && !content.equals("")){
              envelope.append(">");
               
                NodeList children = element.getChildNodes();
                if(children != null){
                  for(int j=0; j < children.getLength(); j++){
                    if(children.item(j).getNodeType() == org.w3c.dom.Node.ELEMENT_NODE){
                          Element child = (Element)children.item(j);
                          envelope.append(getElementContent(child).trim());
                      }else if(children.item(j).getNodeType() == org.w3c.dom.Node.TEXT_NODE){
                        envelope.append(children.item(j).getNodeValue().trim());
                      }
                    }
                }
                envelope.append("</soap:Envelope>");
            }else {
              envelope.append("/>");
            }
          }
         
          request = new StringInputStream(envelope.toString());
         
            PortInfo portInfo = new PortInfo();
            portInfo.setLocation(serviceName);
           
            File wsdlFile = new File(RESOURCE_PATH + wsdl);
            portInfo.setWsdlFile(wsdlFile.toURL().toString());

            try {
                Axis2Request req = new Axis2Request(504,
                        "text/xml; charset=utf-8",
                        request,
                        Request.POST,
                        new HashMap(),
                        new URI("/axis2/"+serviceName),
                        new HashMap(),
                        "127.0.0.1");

                ByteArrayOutputStream out = new ByteArrayOutputStream();
                Axis2Response res = new Axis2Response("text/xml; charset=utf-8", "127.0.0.1", null, null, 8080, out);

                POJOWebServiceContainer container = new POJOWebServiceContainer(portInfo, endPointClassName, cl, null, null);
                container.invoke(req, res);
                System.out.println("Response "+out);
                out.flush();

            } catch (Throwable ex) {
                ex.printStackTrace();
                throw new Exception(ex.toString());
            } finally {
                if (request != null) {
                    try {
                        request.close();
                    } catch (IOException ignore) {
                        // ignore
                    }
                }
            }
View Full Code Here

            if (text != null) {
                if (!text.endsWith("\n")) {
                    text = text + "\n";
                }

                final StringInputStream sis = new StringInputStream(text);
                final Properties props = new Properties();
                props.load(sis);
                final Enumeration e = props.keys();
                while (e.hasMoreElements()) {
                    final String key = (String) e.nextElement();
                    final String value = props.getProperty(key);
                    if (key != null && value != null
                            && value.trim().length() > 0) {
                        project.setNewProperty(key, value);
                    }
                }
                sis.close();
            }

        } catch (final IOException ioe) {
            final String message = "Unable to load file: " + ioe.toString();
            throw new BuildException(message, ioe, location);
View Full Code Here

                      if (editor instanceof AbstractDecoratedTextEditor && (!editor.isDirty())) {
                        System.out.println("Save");
                        IDocumentProvider documentProvider = ((AbstractDecoratedTextEditor)editor).getDocumentProvider();
                        String content = documentProvider.getDocument(editorInput).get();
                        try {
                          editorInput.setContents(new StringInputStream(content));
                          editorInput.getNode().getSession().save();
                        } catch (Exception e) {
                          e.printStackTrace();
                        }
                      }
View Full Code Here

        if (obj instanceof InputStream) {
          Binary binary = node.getSession().getValueFactory().createBinary((InputStream)obj);
          value = node.getSession().getValueFactory().createValue(binary);
        } else
        if (obj instanceof String) {
          Binary binary = node.getSession().getValueFactory().createBinary(new StringInputStream((String)obj));
          value = node.getSession().getValueFactory().createValue(binary);
        }
      }
      break;
    case ELEMENT: {
View Full Code Here

                + "\n<Match>"
                + "\n" + xml
                + "\n</Match>"
                + "\n</FindBugsFilter>\n";

        Filter filter = new Filter(new StringInputStream(xml));

        assertFalse(filter.match(bug));

        bug.addClass("bla", fileName);
        assertTrue(filter.match(bug));
View Full Code Here

    Platform.startup(config);
    IReportEngineFactory factory = (IReportEngineFactory) Platform
      .createFactoryObject( IReportEngineFactory.EXTENSION_REPORT_ENGINE_FACTORY );
    engine = factory.createReportEngine(config);
       
    runnable = engine.openReportDesign(new StringInputStream(report.getReportText()));
    task = engine.createRunAndRenderTask(runnable);
  }
View Full Code Here

TOP

Related Classes of org.apache.tools.ant.filters.StringInputStream

Copyright © 2018 www.massapicom. 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.