Examples of CharSequenceReader


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

            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

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

   * 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

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

            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

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

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

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

        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

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

    }

    @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

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

    }

    @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

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

    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

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

    @Test
    public void givenUsingCommonsIO_whenConvertingInputStreamIntoReader_thenCorrect() throws IOException {
        final InputStream initialStream = IOUtils.toInputStream("With Commons IO");
        final byte[] buffer = IOUtils.toByteArray(initialStream);
        final Reader targetReader = new CharSequenceReader(new String(buffer));

        targetReader.close();
    }
View Full Code Here

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

        } catch (PrivilegedActionException pae){
            Exception e = pae.getException();
            log.error("Unable to initialise PoadingAnalyzer",e);
            throw new EngineException("Unable to initialise PoadingAnalyzer",e);
        }
        TokenStream ts = pa.tokenStream("dummy", new CharSequenceReader(at.getText()));
        int lastEnd = 0;
        try {
            while(ts.incrementToken()){
                OffsetAttribute offset = ts.addAttribute(OffsetAttribute.class);
                //when tokenizing labels we need to preserve all chars
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.