Package java.io

Examples of java.io.StringReader


    KnowledgeBuilder kbuilder = KnowledgeBuilderFactory.newKnowledgeBuilder(conf);
    List<Process> processes = processReader.read(SimpleBPMNProcessTest.class.getResourceAsStream("/" + process));
        for (Process p : processes) {
            RuleFlowProcess ruleFlowProcess = (RuleFlowProcess) p;
            kbuilder.add(ResourceFactory.newReaderResource(
                    new StringReader(XmlBPMNProcessDumper.INSTANCE.dump(ruleFlowProcess))), ResourceType.BPMN2);
        }
    if (!kbuilder.getErrors().isEmpty()) {
      for (KnowledgeBuilderError error: kbuilder.getErrors()) {
        System.err.println(error);
      }
View Full Code Here


   * @throws TransformationException if value is an incorrect input type or
   * the transformation fails
   */
  public Object transformDirect(Object value) throws TransformationException {
        String xml = (String)value;
        Reader reader = new StringReader(xml);
        Type type = isXml(reader);
        XMLType result = new XMLType(new SQLXMLImpl(xml));
        result.setType(type);
        return result;
  }
View Full Code Here

        }
      }
     
      if (source == null) {
        // JBoss Native DispatchImpl throws exception when the source is null
        source = new StreamSource(new StringReader("<none/>")); //$NON-NLS-1$
      }
      this.returnValue = dispatch.invoke(source);
    } catch (SQLException e) {
      throw new TranslatorException(e);
    } catch (WebServiceException e) {
View Full Code Here

                if (j < l - 1) {
                    buff.append(";");
                }
            }
            String s = buff.toString();
            StringReader reader = new StringReader(s);
            ScriptReader source = new ScriptReader(reader);
            for (int j = 0; j < l; j++) {
                String e = source.readStatement();
                String c = sql[j];
                if (c.length() == 0 && j == l - 1) {
View Full Code Here

    private void testCommon() {
        String s;
        ScriptReader source;

        s = "$$;$$;";
        source = new ScriptReader(new StringReader(s));
        assertEquals("$$;$$", source.readStatement());
        assertEquals(null, source.readStatement());
        source.close();

        s = "a;';';\";\";--;\n;/*;\n*/;//;\na;";
        source = new ScriptReader(new StringReader(s));
        assertEquals("a", source.readStatement());
        assertEquals("';'", source.readStatement());
        assertEquals("\";\"", source.readStatement());
        assertEquals("--;\n", source.readStatement());
        assertEquals("/*;\n*/", source.readStatement());
        assertEquals("//;\na", source.readStatement());
        assertEquals(null, source.readStatement());
        source.close();

        s = "/\n$ \n\n $';$$a$$ $\n;'";
        source = new ScriptReader(new StringReader(s));
        assertEquals("/\n$ \n\n $';$$a$$ $\n;'", source.readStatement());
        assertEquals(null, source.readStatement());
        source.close();

    }
View Full Code Here

            return getLobStorage().createBlob(new ByteArrayInputStream(data), len);
        }
        case Value.CLOB: {
            int len = (int) Math.abs(random.nextGaussian() * 10);
            String s = randomString(len);
            return getLobStorage().createClob(new StringReader(s), len);
        }
        case Value.ARRAY: {
            int len = random.nextInt(20);
            Value[] list = new Value[len];
            for (int i = 0; i < list.length; i++) {
View Full Code Here

    }
  }
 
  @Test public void testUTF16() throws Exception {
    String actual = "!?abc"; //$NON-NLS-1$
    ReaderInputStream ris = new ReaderInputStream(new StringReader(actual), Charset.forName("UTF-16"), 1); //$NON-NLS-1$
    byte[] result = new byte[(actual.length()) * 2 + 2];
    ris.read(result);
    String resultString = new String(result, "UTF-16"); //$NON-NLS-1$
    assertEquals(resultString, actual);
  }
View Full Code Here

    assertEquals(resultString, actual);
  }
 
  @Test public void testASCII() throws Exception  {
    String actual = "!?abc"; //$NON-NLS-1$
    ReaderInputStream ris = new ReaderInputStream(new StringReader(actual), Charset.forName("US-ASCII"), 1); //$NON-NLS-1$
    byte[] result = new byte[actual.length()];
    ris.read(result);
    String resultString = new String(result, "US-ASCII"); //$NON-NLS-1$
    assertEquals(resultString, actual);   
  }
View Full Code Here

    public void setContextItem(Sequence<? extends Item> contextItem) {
        this.contextItem = contextItem;
    }

    public XQueryModule parse(String query) throws XQueryException {
        return parse(new StringReader(query));
    }
View Full Code Here

    public XQueryModule parse(String query) throws XQueryException {
        return parse(new StringReader(query));
    }

    public XQueryModule parse(String query, URI baseUri) throws XQueryException {
        return parse(new StringReader(query), baseUri);
    }
View Full Code Here

TOP

Related Classes of java.io.StringReader

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.