Package java.io

Examples of java.io.StringReader


   
    if (value instanceof SQLXML) {
      return ((SQLXML)value).getCharacterStream();
    }
   
    return new StringReader(getString(value));
    }
View Full Code Here


      throw new IllegalArgumentException("Conversion from String to "+ type.getName() + " is not supported"); //$NON-NLS-1$ //$NON-NLS-2$
    }

  public static String[] getLines(final String value) {
      StringReader stringReader = new StringReader(value);
      BufferedReader reader = new BufferedReader(stringReader);
      ArrayList result = new ArrayList();
      try {
          String line = reader.readLine();
          while (line != null) {
View Full Code Here

        "      </publishingInformation>\r\n" //$NON-NLS-1$
        "   </book>\r\n" + //$NON-NLS-1$
        "</Books:bookCollection>"; //$NON-NLS-1$
  
    public void testStreamSourceWithStream() throws Exception {
        StandardXMLTranslator translator = new StandardXMLTranslator(new StreamSource(new StringReader(sourceXML)));
        compareDocuments(sourceXML, translator.getString());
    }   
View Full Code Here

  }

  @Test public void testLobs() throws Exception {
    SocketServerConnection conn = helpEstablishConnection(false);
    FakeService fs = conn.getService(FakeService.class);
    assertEquals(150, fs.lobMethod(new ByteArrayInputStream(new byte[100]), new StringReader(new String(new char[50]))));
    assertEquals(2, storageManager.getCreated());
    assertEquals(2, storageManager.getRemoved());
    assertEquals(0, fs.lobMethod(new ByteArrayInputStream(new byte[0]), new StringReader(new String(new char[0]))));
    assertEquals(4, storageManager.getCreated());
    assertEquals(4, storageManager.getRemoved());
    assertEquals((1 << 17) + 50, fs.lobMethod(new ByteArrayInputStream(new byte[1 << 17]), new StringReader(new String(new char[50]))));
    assertEquals(6, storageManager.getCreated());
    assertEquals(6, storageManager.getRemoved());
  }
View Full Code Here

            }
        }      
    }
   
    private void helpBlockTest(String block, String expectedString, Block expectedBlock) throws ParseException {
        Block actualBlock = new SQLParser(new StringReader(block)).block(new ParseInfo());
        String actualString = actualBlock.toString();
        assertEquals("Parse string does not match: ", expectedString, actualString); //$NON-NLS-1$
        assertEquals("Block does not match: ", expectedBlock, actualBlock);              //$NON-NLS-1$
    }
View Full Code Here

        assertEquals("Parse string does not match: ", expectedString, actualString); //$NON-NLS-1$
        assertEquals("Block does not match: ", expectedBlock, actualBlock);              //$NON-NLS-1$
    }
   
    private void helpCriteriaSelectorTest(String selector, String expectedString, CriteriaSelector expectedSelector) throws ParseException {
        CriteriaSelector actualSelector = new SQLParser(new StringReader(selector)).criteriaSelector();
        String actualString = actualSelector.toString();
        assertEquals("Parse string does not match: ", expectedString, actualString); //$NON-NLS-1$
        assertEquals("CriteriaSelector does not match: ", expectedSelector, actualSelector);              //$NON-NLS-1$
    }
View Full Code Here

        assertEquals("Parse string does not match: ", expectedString, actualString); //$NON-NLS-1$
        assertEquals("Criteria does not match: ", expectedCrit, actualCrit);              //$NON-NLS-1$
    }
   
    private void helpStmtTest(String stmt, String expectedString, Statement expectedStmt) throws ParseException {
        Statement actualStmt = new SQLParser(new StringReader(stmt)).statement(new ParseInfo());
        String actualString = actualStmt.toString();
        assertEquals("Parse string does not match: ", expectedString, actualString); //$NON-NLS-1$
        assertEquals("Language objects do not match: ", expectedStmt, actualStmt);              //$NON-NLS-1$
    }
View Full Code Here

      return ObjectConverterUtil.convertToByteArray(is).length + ObjectConverterUtil.convertToString(r).length();
    }

    @Override
    public Reader getReader() throws IOException {
      return new StringReader("hello world"); //$NON-NLS-1$
    }
View Full Code Here

    private final ScriptReader reader;
    String modfiedSQL;
    String sql;

    private QueryWorkItem(String query) {
      this.reader = new ScriptReader(new StringReader(query));
    }
View Full Code Here

        }
        if (value instanceof Blob) {
          return new StreamSource(((Blob)value).getBinaryStream());
        }
        if (value instanceof String) {
          return new StreamSource(new StringReader((String)value));
        }
      } catch (SQLException e) {
      throw new TeiidProcessingException(e);
    }
      throw new AssertionError("Unknown type"); //$NON-NLS-1$
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.