Package java.io

Examples of java.io.StringBufferInputStream


      // Update the configuration XML file using the generated XSLT.  For now,
      // place the generated file into the undeploy directory:
      File configFile = new File(path);
      File outputFile = new File(this.undeployDir, configFile.getName());
      InputStream configStream = new FileInputStream(configFile);
      InputStream xsltStream = new StringBufferInputStream(buf.toString());
      OutputStream outputStream = new FileOutputStream(outputFile);
      XslTransformer.applyTransformation(configStream, outputStream, xsltStream, null);
      configStream.close();
      xsltStream.close();
      outputStream.close();

      // Now that we have the generated file, move it to its proper location
      if (!configFile.delete())
         throw new Exception("Update failed for '" + name + "', unable to delete old configuration file: " + path);
View Full Code Here


  private CommandReader() {}

  public static List<TrainCommand> parse(String message) {
    try {
      ANTLRInputStream input =
        new ANTLRInputStream(new StringBufferInputStream(message));

      CommandLexer commandLexer =
        new CommandLexer(input);

      CommonTokenStream tokens =
View Full Code Here

  private PushTrainReader() {}

  public static PushTrain parse(String pushTrainString) {
    try {
      ANTLRInputStream input =
        new ANTLRInputStream(new StringBufferInputStream(pushTrainString));

      PushTrainLexer pushTrainLexer =
        new PushTrainLexer(input);

      CommonTokenStream tokens = new CommonTokenStream(pushTrainLexer);
View Full Code Here

    public void testMultipleLoads() throws IOException {
        String props = "foo=bar" + LS + "baz=quux";
        String props2 = "a=b" + LS + "c=d";
        Properties vanilla = new Properties();
        vanilla.load(new BufferedInputStream
            (new StringBufferInputStream(props)));
        vanilla.load(new BufferedInputStream
            (new StringBufferInputStream(props2)));

        Properties p = new FormatPreservingProperties();
        p.load(new BufferedInputStream(new StringBufferInputStream(props)));
        p.load(new BufferedInputStream(new StringBufferInputStream(props2)));
        assertPropertiesSame(vanilla, p);
    }
View Full Code Here

    }

    protected FormatPreservingProperties toProperties(String s,
        FormatPreservingProperties p) throws IOException {
        Properties vanilla = new Properties();
        vanilla.load(new StringBufferInputStream(s));

        p.load(new StringBufferInputStream(s));
        assertRoundTrip(s, p);

        assertPropertiesSame(vanilla, p);

        return p;
View Full Code Here

    public void makeBuilderShouldWork() throws CoreException {
        ensureNoAppSrcExists();
        final IFolder folder = (IFolder) prj.findMember("src");
        final IFile app = folder.getFile("builders.app.src");
        app.create(
                new StringBufferInputStream("{application, builders,[{vsn, \"1\"}]}."),
                true, null);
        try {
            testBuilder(BuilderTool.MAKE);
            testClean(BuilderTool.MAKE);
        } finally {
View Full Code Here

    public void rebarBuilderShouldWork() throws CoreException {
        ensureNoAppSrcExists();
        final IFolder folder = (IFolder) prj.findMember("src");
        final IFile app = folder.getFile("builders.app.src");
        app.create(
                new StringBufferInputStream("{application, builders,[{vsn, \"1\"}]}."),
                true, null);
        try {
            testBuilder(BuilderTool.REBAR);

            final IResource beam = prj.findMember("ebin/builders.app");
View Full Code Here

                        if (validationNode != null &&
                            validationNode.getNodeType() == Node.ELEMENT_NODE &&
                            validationNode.getNodeName().equals(FORM_VALIDATESET_ELEMENT)) {
                            String validationXML = XMLUtils.serializeNodeToXML(validationNode);
                            DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder();
                            conf = builder.build(new StringBufferInputStream(validationXML));
                            session.setAttribute(this.formName+"validate-set", conf);
                        }
                    }
                   
                } catch (SourceException se) {
                    throw new ProcessingException("Cannot resolve"+source, se);
                } catch (ConfigurationException ce) {
                    throw new ProcessingException("Error building Configuration out of validate-set element", ce);
                }

            } else if (validationDoc != null) {
                //validationDoc contains the validation rules inline
                try {
                    validationDoc.normalize();
                    Node validationNode = validationDoc.getFirstChild();
                    while (validationNode.getNodeType() != Node.ELEMENT_NODE) {
                        validationNode = validationNode.getNextSibling();
                        if (validationNode == null) break;
                    }
                    if (validationNode != null &&
                        validationNode.getNodeType() == Node.ELEMENT_NODE &&
                        validationNode.getNodeName().equals("root")) {

                        String validationXML = XMLUtils.serializeNodeToXML(validationNode);
                        DefaultConfigurationBuilder builder = new DefaultConfigurationBuilder();
                        Configuration conf = null;
                        Session session = null;
                        conf = builder.build(new StringBufferInputStream(validationXML));
                        session = this.getSessionManager().getSession(true);
                        session.setAttribute(this.formName, conf);
                        //the constraint-set to validate is the first and single one
                        session.setAttribute(this.formName+"validate-set", conf.getChildren ("constraint-set")[0]);
View Full Code Here

    /**
     * Get input stream from {@link #TEST_XML}.
     */
    private InputStream xmlTestStream() throws IOException {
        return new StringBufferInputStream(TEST_XML);
    }
View Full Code Here

    }

    public InputStream getInputStream() throws IOException {
        // FIXME(VG): This method should never be used because it
        // incorrectly converts characters into bytes.
        return new StringBufferInputStream(stringBuffer.toString());
    }
View Full Code Here

TOP

Related Classes of java.io.StringBufferInputStream

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.