Package java.io

Examples of java.io.StringBufferInputStream


    public void testMultipartMessage2() throws MessagingException, TransformerException
    {
        MimeMessage message = new MimeMessage(Session.getDefaultInstance(new Properties()));
        MimeMultipart mimeMultipart = new MimeMultipart();
        MimeBodyPart bp1 = new MimeBodyPart();
        bp1.setContent(new StringBufferInputStream(TEXT), "binary");
        mimeMultipart.addBodyPart(bp1);
        message.setContent(mimeMultipart);
        message.setRecipient(Message.RecipientType.TO, new InternetAddress(TO));
        assertEquals("", transformer.transform(message));
    }
View Full Code Here


  public static void main(String args[]) throws Exception{
   
    StringBuffer classContext = new StringBuffer();
    classContext.append("public class TestClass{ String a;}");
    SimpleCompiler compiler = new SimpleCompiler();
    compiler.cook(new StringBufferInputStream(classContext.toString()));
    Class testcls = compiler.getClassLoader().loadClass("TestClass");
    System.out.println(testcls);
   
   
   
View Full Code Here

         * TODO RI just using byte[].toString to construct
         * StringBufferInputStream, while Harmony using new String(byte[])
         */
        if ("true".equals(System.getProperty("Testing Harmony"))) {
            String value = new String(bs);
            StringBufferInputStream expectedIn = new StringBufferInputStream(
                    value);
            InputStream actualIn = crset.getUnicodeStream(3);

            i = -1;
            while ((i = expectedIn.read()) != -1) {
                assertEquals(i, actualIn.read());
            }
        }

        assertNotSame(crset.getCharacterStream(2), crset.getCharacterStream(2));
View Full Code Here

        assertTrue(crset.getObject(2) instanceof String);
        assertEquals(value, crset.getString(2));

        InputStream in = crset.getUnicodeStream(2);
        StringBufferInputStream sin = new StringBufferInputStream(value);

        int i = -1;
        while ((i = in.read()) != -1) {
            assertEquals(sin.read(), i);
        }

    }
View Full Code Here

            while ((line = br.readLine()) != null) {
                sb.append(line);
                sb.append("\n");
            }
            mLogger.debug(sb.toString());
            is = new StringBufferInputStream(sb.toString());
        }
       
        // execute XML-RPC request
        byte[] result = mXmlRpcServer.execute(is);
       
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

        //begin ��ȡ������Ϣ
        //gh start
        CmdlParser cp = new CmdlParserPrototype();
    try {
      String custom = dataSrc.getCustomizationIndex();
      InputStream inputStream = new StringBufferInputStream(custom);

      for (Iterator<String> itCVId = cp.openCustomizationVersionIds(
          inputStream).iterator(); itCVId.hasNext();) {
        String cvId = itCVId.next();
        String cusVersionFileContent = dataSrc.getCustomizationVersionFileContent(cvId);
View Full Code Here

            }
        }, Phases.CLASS_GENERATION);
    }
   
    public void testDep(){
        cu.addSource("testDep.gtest", new StringBufferInputStream(
                "class C1 {}\n" +
                "class C2 {}\n" +
                "class C3 {}\n" +
                "class A1 {C1 x}\n" +
                "class A2 extends C2{}\n" +
View Full Code Here

        assertTrue(dep.contains("C2"));
        assertTrue(dep.contains("C3"));
    }
   
    public void testTransitiveDep(){
        cu.addSource("testTransitiveDep.gtest", new StringBufferInputStream(
                "class A1 {}\n" +
                "class A2 extends A1{}\n" +
                "class A3 extends A2{}\n"
        ));
        cu.compile(Phases.CLASS_GENERATION);
View Full Code Here

      String value = ((String) templateVars.get(aKey)).replaceAll("\\\\", "\\\\\\\\");//$NON-NLS-1$ //$NON-NLS-2$
      contents = contents.replaceAll(aKey, value);
    }

    if (output.exists())
      output.setContents(new StringBufferInputStream(contents), true, false, null);
    else
      output.create(new StringBufferInputStream(contents), true, null);
  }
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.