Package java.io

Examples of java.io.StringBufferInputStream


  public void testWriteOut() throws IOException
  {
    File tmpDir = new File("ioUtilsTest/tmp");
    tmpDir.mkdir();
   
    IOUtils.writeOut(tmpDir, "simple.txt", new StringBufferInputStream("abc"));
    IOUtils.writeOut(tmpDir, "some/relative/directory/complex.txt", new StringBufferInputStream("def"));
    IOUtils.writeOut(tmpDir, "some/relative/directory/complex2.txt", new StringBufferInputStream("ghi"));
   
    File simple = new File("ioUtilsTest/tmp/simple.txt");
    assertTrue(simple.exists());

    File complex = new File("ioUtilsTest/tmp/some/relative/directory/complex.txt");
View Full Code Here


      FileOutputStream fout = new FileOutputStream(new File (tmpDir, "bb" + n + ".jar"));
      bundle.writeOut(fout);
      fout.close();
    }

    IOUtils.writeOut(tmpDir, "simple.jar", new StringBufferInputStream("abc"));
    IOUtils.writeOut(tmpDir, "simple.war", new StringBufferInputStream("sss"));
    IOUtils.writeOut(tmpDir, "simple.txt", new StringBufferInputStream("abc"));
    IOUtils.writeOut(tmpDir, "some/relative/directory/complex.jar", new StringBufferInputStream("def"));
    IOUtils.writeOut(tmpDir, "some/relative/directory/aa/complex2.war", new StringBufferInputStream("ghi"));
    IOUtils.writeOut(tmpDir, "simple", new StringBufferInputStream("abc"));

    List<URI> jarFiles = FileUtils.getBundlesRecursive(tmpDir.toURI());
    assertEquals("There should be 4 entries.", 4, jarFiles.size());
    assertTrue("The entry should contain this aa0.jar", jarFiles.contains(new File(tmpDir, "aa0.jar").toURI()));
    assertTrue("The entry should contain this aa1.war", jarFiles.contains(new File(tmpDir, "aa1.war").toURI()));
View Full Code Here

  ByteArrayOutputStream out;
 
  public
  TestSocket(String request)
  {
      in = new StringBufferInputStream(request);
      out = new ByteArrayOutputStream();
  }
View Full Code Here

            bugIf(false);
        } catch(Exception e) {
            bugIf(true);
        }
        sTogether = sTest11 + sTest12;
        pJavancss = new Javancss(new StringBufferInputStream(sTogether));
        vFunctions = pJavancss.getFunctionMetrics();
        Util.debug("JavancssTest._doIt().vFunctions: " + vFunctions);
        sFirstFunction = (String)((Vector)vFunctions.elementAt(0)).elementAt(FCT_NAME);
        bugIf(!sFirstFunction.equals("ccl.util.Test11.atoi(String)"));
        String sSomeFunction = (String)((Vector)vFunctions.elementAt(32)).elementAt(FCT_NAME);
View Full Code Here

  /**
   * @tests java.io.StreamTokenizer#StreamTokenizer(java.io.InputStream)
   */
  @SuppressWarnings("deprecation")
    public void test_ConstructorLjava_io_InputStream() throws IOException {
    st = new StreamTokenizer(new StringBufferInputStream(
        "/comments\n d 8 'h'"));

    assertEquals("the next token returned should be the letter d",
           StreamTokenizer.TT_WORD, st.nextToken());
    assertEquals("the next token returned should be the letter d",
View Full Code Here

  }

  public InputStream getInputStream()
    throws ProcessingException, IOException
  {
    return new StringBufferInputStream(stringBuffer.toString());
  }
View Full Code Here

        args.add(arg);
    }
    args.add("-");
    args.addAll(extra);
    new DataFileWriteTool().run(
        new StringBufferInputStream(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 StringBufferInputStream("{"),
          new PrintStream(out), // stdout
          null, // stderr         
          Arrays.asList("-schema", "{ \"type\":\"record\", \"fields\":" +
                        "[{\"name\":\"foo\", \"type\":\"string\"}], " +
                        "\"name\":\"boring\" }", "-"));
View Full Code Here

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

          fileProgram.addAll(parsedResults);
        } catch (Exception e) {
          // write document anyway
          // out.create(source, true, monitor);
          saveDocument(document, out.getLocation().toFile());
          outParsed.create(new StringBufferInputStream(parsed),
              true, monitor);
          outLatex.create(new StringBufferInputStream(latex),
              true, monitor);

          throw new TermParseException("While trying to parse '" + f + "'...: " + e.getMessage(), e);
        }
      }

      // work out the logic formula defined by each rule
      List<LogicRule> rules = investigateLogic(document, name);
      allRules.addAll(rules);

      // out.create(source, true, monitor);
      saveDocument(document, out.getLocation().toFile());

      // write out parsed rules
      System.out.println("Writing to '" + outParsed + "'...");
      outParsed.create(new StringBufferInputStream(parsed),
          true, monitor);
      // write out parsed rules
      System.out.println("Writing to '" + outLatex + "'...");
      outLatex.create(new StringBufferInputStream(latex),
          true, monitor);

      System.out.println("---");
      System.out.println("loops factory in '" + f + "':");
      GraphLoops loops = calculateFactoryLoops(fileProgram);
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.