Package java.io

Examples of java.io.CharArrayReader


                    }
                } catch (IOException ignored) {
                }
                caw.close();
                try{ rdr.reset();} catch(IOException ignored) {}
                ret = new SAXSource(new InputSource(new CharArrayReader(caw.toCharArray())));
            } else {
                ret = new SAXSource();
            }
        } else if(src instanceof StreamSource) {
            StreamSource ssrc = (StreamSource)src;
            if(ssrc.getInputStream() != null) {
                InputStream inp = ssrc.getInputStream();
                ByteArrayOutputStream bout = new ByteArrayOutputStream();
                int b;
                try {
                    while((b = inp.read()) != -1) {
                        bout.write(b);
                    }
                } catch (IOException ignored) {
                }
                try { bout.close();} catch (IOException ignored) {}
                try { inp.reset();} catch (IOException ignored) {}
                ret = new StreamSource(new ByteArrayInputStream(bout.toByteArray()));
            } else if(ssrc.getReader() != null) {
                Reader rdr = ssrc.getReader();
                CharArrayWriter caw = new CharArrayWriter();
                try {
                    int c;
                    while((c = rdr.read()) != -1) {
                        caw.append((char)c);
                    }
                } catch (IOException ignored) {
                }
                caw.close();
                try{ rdr.reset();} catch(IOException ignored) {}
                ret = new StreamSource(new CharArrayReader(caw.toCharArray()));
            } else {
                ret = new StreamSource();
            }
        }
       
View Full Code Here


                    }
                } catch (IOException ignored) {
                }
                caw.close();
                try{ rdr.reset();} catch(IOException ignored) {}
                ret = new SAXSource(new InputSource(new CharArrayReader(caw.toCharArray())));
            } else {
                ret = new SAXSource();
            }
        } else if(src instanceof StreamSource) {
            StreamSource ssrc = (StreamSource)src;
            if(ssrc.getInputStream() != null) {
                InputStream inp = ssrc.getInputStream();
                ByteArrayOutputStream bout = new ByteArrayOutputStream();
                int b;
                try {
                    while((b = inp.read()) != -1) {
                        bout.write(b);
                    }
                } catch (IOException ignored) {
                }
                try { bout.close();} catch (IOException ignored) {}
                try { inp.reset();} catch (IOException ignored) {}
                ret = new StreamSource(new ByteArrayInputStream(bout.toByteArray()));
            } else if(ssrc.getReader() != null) {
                Reader rdr = ssrc.getReader();
                CharArrayWriter caw = new CharArrayWriter();
                try {
                    int c;
                    while((c = rdr.read()) != -1) {
                        caw.append((char)c);
                    }
                } catch (IOException ignored) {
                }
                caw.close();
                try{ rdr.reset();} catch(IOException ignored) {}
                ret = new StreamSource(new CharArrayReader(caw.toCharArray()));
            } else {
                ret = new StreamSource();
            }
        }
       
View Full Code Here

        TextEvent(Locator location,
                  char[] chars, int start, int length)
            throws SAXException {
            super(location);
            StringBuffer buf = new StringBuffer();
            CharArrayReader in = new CharArrayReader(chars, start, length);
            int ch;
            boolean inExpr = false;
            boolean xpath = false;
            try {
                top: while ((ch = in.read()) != -1) {
                    char c = (char)ch;
                    processChar: while (true) {
                        if (inExpr) {
                            if (c == '\\') {
                                ch = in.read();
                                if (ch == -1) {
                                    buf.append('\\');
                                } else {
                                    buf.append((char)ch);
                                }
                            } else if (c == '}') {
                                String str = buf.toString();
                                Object compiledExpression;
                                try {
                                    if (xpath) {
                                        compiledExpression =
                                            JXPathContext.compile(str);
                                    } else {
                                        compiledExpression =
                                            ExpressionFactory.createExpression(str);
                                    }
                                } catch (Exception exc) {
                                    throw new SAXParseException(exc.getMessage(),
                                                                location,
                                                                exc);
                                }
                                substitutions.add(compiledExpression);
                                buf.setLength(0);
                                inExpr = false;
                            } else {
                                buf.append(c);
                            }
                        } else {
                            if (c == '\\') {
                                ch = in.read();
                                if (ch == -1) {
                                    buf.append('\\');
                                } else {
                                    buf.append((char)ch);
                                }
                            } else if (c == '$' || c == '#') {
                                ch = in.read();
                                if (ch == '{') {
                                    xpath = c == '#';
                                    inExpr = true;
                                    if (buf.length() > 0) {
                                        char[] charArray =
View Full Code Here

   
    public void insertClobForStreamingLoad(Row row, Column col, Object ob)
    throws SQLException {
        if (ob != null) {
        row.setCharacterStream(col,
                new CharArrayReader(new char[0]), 0);
        } else {
            row.setNull(col);
        }
    }
View Full Code Here

                                    }
                                }
                            }
                        }

                        delegate = new CharArrayReader(writer.toCharArray());
                    } finally {
                        in.close();
                    }
                }
            };
View Full Code Here

                            PDFTextStripper stripper = new PDFTextStripper();
                            stripper.setLineSeparator("\n");
                            stripper.writeText(document, writer);

                            delegate = new CharArrayReader(writer.toCharArray());
                        } finally {
                            document.close();
                        }
                    } catch (Exception e) {
                        // it may happen that PDFParser throws a runtime
View Full Code Here

            throw new XMLStreamException(e);
        }
    }
   
    public XMLStreamReader getReader() throws XMLStreamException {
        CharArrayReader reader = new CharArrayReader(chars);
       
        return StAXUtils.createXMLStreamReader(reader);                                                                  
    }
View Full Code Here

    if(startOffset != text.getBeginIndex()) {
      System.out.println("startOffset = " + startOffset);
    }
   
    RLexer lexer = new RLexer(parseOptions, parseState,
        new CharArrayReader(text.array, text.getBeginIndex(), text.getEndIndex() - text.getBeginIndex()));
   
    Token head = null;
    Token tail = null;
    do {
      Token token = nextToken(text, lexer);
View Full Code Here

  public abstract Class getReturnedClass();

  public void set(PreparedStatement st, Object value, int index) throws SQLException {
    char[] chars = toInternalFormat( value );
    st.setCharacterStream(index, new CharArrayReader(chars), chars.length);
  }
View Full Code Here

public class SimpleRead extends FilterReader implements Testlet
{

public SimpleRead()
{
  this(new CharArrayReader(new char[0]));
}
View Full Code Here

TOP

Related Classes of java.io.CharArrayReader

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.