Package java.io

Examples of java.io.LineNumberReader.skip()


        // Find the line number(s) being modified
        // TODO: this could be more efficient
        try {
          LineNumberReader lineNumberReader =
              new LineNumberReader(new StringReader(source.toString()));
          lineNumberReader.skip(repl.startPosition());
          modifiedLines.add(lineNumberReader.getLineNumber());
        } catch (IOException e) {
          // impossible since source is in-memory
        }
      }
View Full Code Here


 
  protected static int getLineNumber(int charNumber, Reader reader){
    LineNumberReader lnr = new LineNumberReader(reader);
    int res = 0;
    try{
      lnr.skip(charNumber);
      res = lnr.getLineNumber();
      lnr.close();
    }catch (Exception e) {
      // TODO: handle exception
    }
View Full Code Here

      assertThat("Line /abbot is missing?", hasAbbot);
      assertThat("Line /com/apple is missing?", hasComApple);
      assertThat("Line /org/sonatype is missing?", hasOrgSonatype);

      // count lines
      lnr.skip(Long.MAX_VALUE);
      // 2013. 02. 08. Today, Nexus scraped prefix file with 5517 lines (depth=2)
      // So, safely assuming the prefix file MUST HAVE more than 5k lines
      // Naturally, if depth changes, making it lesser, this might fail.
      // 2012. 02. 14. Today the prefix file is deployed to Central, no more scraping
      // The prefix file has around 1600 entries.
View Full Code Here

  {
    LineNumberReader lnr = new LineNumberReader(new InputStreamReader(new FileInputStream(inFile),
        Charset.forName("UTF-8")));
    try
    {
      lnr.skip(Long.MAX_VALUE);
      return lnr.getLineNumber() + 1;
    }
    finally
    {
      IOUtils.closeQuietly(lnr);
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.