Package org.apache.commons.io.input

Examples of org.apache.commons.io.input.CharSequenceReader


                + "indicates an Bug in the used EnhancementJobManager implementation. "
                + "Please report this on the dev@apache.stanbol.org or create an "
                + "JIRA issue about this.");
        }
        //first the sentences
        TokenStream sentences = new SentenceTokenizer(new CharSequenceReader(at.getText()));
        try {
            while(sentences.incrementToken()){
                OffsetAttribute offset = sentences.addAttribute(OffsetAttribute.class);
                Sentence s = at.addSentence(offset.startOffset(), offset.endOffset());
                if(log.isTraceEnabled()) {
View Full Code Here


                + "Please report this on the dev@apache.stanbol.org or create an "
                + "JIRA issue about this.");
        }
        if(!at.getSentences().hasNext()) { //no sentences  ... use this engine to detect
            //first the sentences
            TokenStream sentences = new SentenceTokenizer(new CharSequenceReader(at.getText()));
            try {
                while(sentences.incrementToken()){
                    OffsetAttribute offset = sentences.addAttribute(OffsetAttribute.class);
                    Sentence s = at.addSentence(offset.startOffset(), offset.endOffset());
                    if(log.isTraceEnabled()) {
View Full Code Here

            throw new IllegalArgumentException(
                    "Illegal input char(s) at following positions: "
                    + badIndexes);
        //if (sb.length() > 0 && sb.charAt(sb.length()-1) != '\n')
            //sb.append('\n');
        return new CreoleScanner(new CharSequenceReader(sb));
    }
View Full Code Here

   * Create a buffered reader from a text.
   *
   * @return the reader
   */
  public static BufferedReader createBufferedReader(CharSequence text) {
    return new BufferedReader(new CharSequenceReader(text));
  }
View Full Code Here

            throw new IllegalArgumentException(
                    "Illegal input char(s) at following positions: "
                    + badIndexes);
        //if (sb.length() > 0 && sb.charAt(sb.length()-1) != '\n')
            //sb.append('\n');
        return new CreoleScanner(new CharSequenceReader(sb));
    }
View Full Code Here

         return new Resource(path)
         {
            @Override
            public Reader read()
            {
               return new CharSequenceReader(sb);
            }
         };
      }
      else
      {
View Full Code Here

        initialReader.close();
    }

    @Test
    public void givenUsingCommonsIO_whenWritingReaderContentsToFile_thenCorrect() throws IOException {
        final Reader initialReader = new CharSequenceReader("CharSequenceReader extends Reader");

        final File targetFile = new File("src/test/resources/targetFile.txt");
        FileUtils.touch(targetFile);
        final byte[] buffer = IOUtils.toByteArray(initialReader);
        FileUtils.writeByteArrayToFile(targetFile, buffer);
        initialReader.close();
    }
View Full Code Here

    }

    @Test
    public void givenUsingCommonsIO_whenConvertingStringIntoReader_thenCorrect() throws IOException {
        final String initialString = "With Apache Commons IO";
        final Reader targetReader = new CharSequenceReader(initialString);

        targetReader.close();
    }
View Full Code Here

    }

    @Test
    public void givenUsingCommonsIO_whenConvertingByteArrayIntoReader_thenCorrect() throws IOException {
        final byte[] initialArray = "With Commons IO".getBytes();
        final Reader targetReader = new CharSequenceReader(new String(initialArray));

        targetReader.close();
    }
View Full Code Here

    public void givenUsingCommonsIO_whenConvertingFileIntoReader_thenCorrect() throws IOException {
        final File initialFile = new File("src/test/resources/initialFile.txt");
        FileUtils.touch(initialFile);
        FileUtils.write(initialFile, "With Commons IO");
        final byte[] buffer = FileUtils.readFileToByteArray(initialFile);
        final Reader targetReader = new CharSequenceReader(new String(buffer));

        targetReader.close();
    }
View Full Code Here

TOP

Related Classes of org.apache.commons.io.input.CharSequenceReader

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.