Java 8 Reader - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 Reader class.

This code example shows how to use the following methods: close
    protected void parseOneInputStreamAsReader( 
            TreeImportingParserBase parser, InputStream inputStream, JSONObject options) {
        ImportColumnGroup rootColumnGroup = new ImportColumnGroup();
        List<Exception> exceptions = new ArrayList<Exception>();
         
        Reader reader = new InputStreamReader(inputStream);
        parser.parseOneFile(
            project,
            metadata,
            job,
            "file-source", 
            reader,
            rootColumnGroup,
            -1, 
            options,
            exceptions
        ); 
        postProcessProject(project, rootColumnGroup, exceptions);
         
        try { 

9
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: close, mark, markSupported, read, ready
  } 
   
  @Test
  public void testMarkReset() throws IOException {
    Reader reader = new ReusableStringReader();
    if (reader.markSupported()) {
      ((ReusableStringReader)reader).set(fox);
      assertTrue(reader.ready());
       
      char[] cc = new char[6];
      int read;
      read = reader.read(cc);
      assertEquals(6, read);
      assertEquals("Quick ", new String(cc));
       
      reader.mark(100);
       
      read = reader.read(cc);
      assertEquals(6, read);
      assertEquals("brown ", new String(cc));

8
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: close, read, ready
            if (f.length() > sizeLimit) {
                throw new IOException("File " + fileName + " length " + f.length() +
                        " exceeds limit " + sizeLimit);
            } 
            char[] buffer = new char[(int) f.length()];
            reader = new InputStreamReader(new FileInputStream(f), "UTF-8");
            int charsRead = reader.read(buffer);
            // Debug check that we've exhausted the input stream (will fail e.g. if the 
            // file grew after we inspected its length). 
            assert !reader.ready();
            return charsRead < buffer.length ? Arrays.copyOfRange(buffer, 0, charsRead) : buffer;
        } finally { 
            if (reader != null) reader.close();
        } 
    } 
} 
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: close
        String basedir = System.getProperty( "basedir", System.getProperty( "user.dir" ) );
 
        File globalSettingsFile = new File( basedir, "src/conf/settings.xml" );
        assertTrue( globalSettingsFile.getAbsolutePath(), globalSettingsFile.isFile() );
 
        Reader reader = new InputStreamReader( new FileInputStream( globalSettingsFile ), "UTF-8" );
        try 
        { 
            new SettingsXpp3Reader().read( reader );
        } 
        finally 
        { 
            reader.close();
        } 
    } 
 
} 
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE
This code example shows how to use the following methods: close
public class CssValidator implements IValidator<String> {
    @Override 
    public void validate(IValidatable<String> text) {
        if (text.getValue() != null) {
            try { 
                Reader in = new StringReader(text.getValue());
                CSS2SLD.convert(in);
                in.close();
            } catch (Exception e) {
                ValidationError error = new ValidationError();
                error.setMessage(e.getMessage());
                text.error(error);
            } 
        } else { 
            ValidationError error = new ValidationError();
            error.setMessage("CSS text must not be empty");
            text.error(error);
        } 
    } 
} 
Full Snippet Info
7
CodeRank
Stop searching for code, let great code find you!  Add Codota to your java IDE

Related Java 8 Reader Questions & Answers:

See Code Examples for Java 8 Reader Methods: