Java Doc for LogReader.java in  » Web-Crawler » heritrix » org » archive » crawler » util » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Web Crawler » heritrix » org.archive.crawler.util 
Source Cross Reference  Class Diagram Java Document (Java Doc) 


java.lang.Object
   org.archive.crawler.util.LogReader

LogReader
public class LogReader (Code)
This class contains a variety of methods for reading log files (or other text files containing repeated lines with similar information).

All methods are static.
author:
   Kristinn Sigurdsson





Method Summary
public static  StringbuildDisplayingHeader(int len, long logsize)
    
public static  intfindFirstLineBeginning(InputStreamReader reader, String prefix)
     Return the line number of the first line in the log/file that that begins with the given string.
Parameters:
  reader - The reader of the log/file
Parameters:
  prefix - The prefix string to match The line number (counting from 1, not zero) of the first linethat matches the given regular expression.
public static  intfindFirstLineBeginningFromSeries(String aFileName, String prefix)
     Return the line number of the first line in the log/file that begins with the given string.
Parameters:
  aFileName - The filename of the log/file
Parameters:
  prefix - The prefix string to match The line number (counting from 1, not zero) of the first linethat matches the given regular expression.
public static  intfindFirstLineContaining(String aFileName, String regExpr)
     Return the line number of the first line in the log/file that matches a given regular expression.
Parameters:
  aFileName - The filename of the log/file
Parameters:
  regExpr - The regular expression that is to be used The line number (counting from 1, not zero) of the first linethat matches the given regular expression.
public static  intfindFirstLineContaining(InputStreamReader reader, String regExpr)
     Return the line number of the first line in the log/file that matches a given regular expression.
Parameters:
  reader - The reader of the log/file
Parameters:
  regExpr - The regular expression that is to be used The line number (counting from 1, not zero) of the first linethat matches the given regular expression.
public static  intfindFirstLineContainingFromSeries(String aFileName, String regExpr)
     Return the line number of the first line in the log/file that matches a given regular expression.
Parameters:
  aFileName - The filename of the log/file
Parameters:
  regExpr - The regular expression that is to be used The line number (counting from 1, not zero) of the first linethat matches the given regular expression.
public static  Stringget(String aFileName)
     Returns the entire file.
public static  Stringget(InputStreamReader reader)
     Reads entire contents of reader, returns as string.
public static  String[]get(String aFileName, int lineNumber, int n)
     Gets a portion of a log file.
public static  String[]get(InputStreamReader reader, int lineNumber, int n, long logsize)
     Gets a portion of a log file.
public static  String[]getByRegExpr(String aFileName, String regExpr, int addLines, boolean prependLineNumbers, int skipFirstMatches, int numberOfMatches)
     Returns all lines in a log/file matching a given regular expression.
public static  String[]getByRegExpr(InputStreamReader reader, String regExpr, int addLines, boolean prependLineNumbers, int skipFirstMatches, int numberOfMatches, long logsize)
     Returns all lines in a log/file matching a given regular expression.
public static  String[]getByRegExpr(String aFileName, String regExpr, String addLines, boolean prependLineNumbers, int skipFirstMatches, int numberOfMatches)
     Returns all lines in a log/file matching a given regular expression.
public static  String[]getByRegExpr(InputStreamReader reader, String regExpr, String addLines, boolean prependLineNumbers, int skipFirstMatches, int numberOfMatches, long logsize)
     Returns all lines in a log/file matching a given regular expression.
public static  String[]getByRegExprFromSeries(String aFileName, String regExpr, int addLines, boolean prependLineNumbers, int skipFirstMatches, int numberOfMatches)
     Returns all lines in a log/file matching a given regular expression.
public static  String[]getByRegExprFromSeries(String aFileName, String regExpr, String addLines, boolean prependLineNumbers, int skipFirstMatches, int numberOfMatches)
     Returns all lines in a log/file matching a given regular expression.
public static  String[]getFromSeries(String aFileName, int lineNumber, int n)
     Gets a portion of a log spread across a numbered series of files. Starting at a given line number and the n-1 lines following that one or until the end of the log if that is reached first.
Parameters:
  aFileName - The filename of the log/file
Parameters:
  lineNumber - The number of the first line to get (if larger then thefile an empty string will be returned)
Parameters:
  n - How many lines to return (total, including the one indicated by lineNumber).
public static  String[]tail(String aFileName)
     Implementation of a unix-like 'tail' command
Parameters:
  aFileName - a file name String An array of two strings is returned.
public static  String[]tail(String aFileName, int n)
     Implementation of a unix-like 'tail -n' command
Parameters:
  aFileName - a file name String
Parameters:
  n - int number of lines to be returned An array of two strings is returned.
public static  String[]tail(RandomAccessFile raf, int n)
     Implementation of a unix-like 'tail -n' command
Parameters:
  raf - a RandomAccessFile to tail
Parameters:
  n - int number of lines to be returned An array of two strings is returned.



Method Detail
buildDisplayingHeader
public static String buildDisplayingHeader(int len, long logsize)(Code)



findFirstLineBeginning
public static int findFirstLineBeginning(InputStreamReader reader, String prefix)(Code)
Return the line number of the first line in the log/file that that begins with the given string.
Parameters:
  reader - The reader of the log/file
Parameters:
  prefix - The prefix string to match The line number (counting from 1, not zero) of the first linethat matches the given regular expression. -1 is returned if noline matches the regular expression. -1 also is returned if errors occur (file not found, io exception etc.)



findFirstLineBeginningFromSeries
public static int findFirstLineBeginningFromSeries(String aFileName, String prefix)(Code)
Return the line number of the first line in the log/file that begins with the given string.
Parameters:
  aFileName - The filename of the log/file
Parameters:
  prefix - The prefix string to match The line number (counting from 1, not zero) of the first linethat matches the given regular expression. -1 is returned if noline matches the regular expression. -1 also is returned if errors occur (file not found, io exception etc.)



findFirstLineContaining
public static int findFirstLineContaining(String aFileName, String regExpr)(Code)
Return the line number of the first line in the log/file that matches a given regular expression.
Parameters:
  aFileName - The filename of the log/file
Parameters:
  regExpr - The regular expression that is to be used The line number (counting from 1, not zero) of the first linethat matches the given regular expression. -1 is returned if noline matches the regular expression. -1 also is returned if errors occur (file not found, io exception etc.)



findFirstLineContaining
public static int findFirstLineContaining(InputStreamReader reader, String regExpr)(Code)
Return the line number of the first line in the log/file that matches a given regular expression.
Parameters:
  reader - The reader of the log/file
Parameters:
  regExpr - The regular expression that is to be used The line number (counting from 1, not zero) of the first linethat matches the given regular expression. -1 is returned if noline matches the regular expression. -1 also is returned if errors occur (file not found, io exception etc.)



findFirstLineContainingFromSeries
public static int findFirstLineContainingFromSeries(String aFileName, String regExpr)(Code)
Return the line number of the first line in the log/file that matches a given regular expression.
Parameters:
  aFileName - The filename of the log/file
Parameters:
  regExpr - The regular expression that is to be used The line number (counting from 1, not zero) of the first linethat matches the given regular expression. -1 is returned if noline matches the regular expression. -1 also is returned if errors occur (file not found, io exception etc.)



get
public static String get(String aFileName)(Code)
Returns the entire file. Useful for smaller files.
Parameters:
  aFileName - a file name The String representation of the entire file.Null is returned if errors occur (file not found or io exception)



get
public static String get(InputStreamReader reader)(Code)
Reads entire contents of reader, returns as string.
Parameters:
  reader - String of entire contents; null for any error.



get
public static String[] get(String aFileName, int lineNumber, int n)(Code)
Gets a portion of a log file. Starting at a given line number and the n-1 lines following that one or until the end of the log if that is reached first.
Parameters:
  aFileName - The filename of the log/file
Parameters:
  lineNumber - The number of the first line to get (if larger then the file an empty string will be returned)
Parameters:
  n - How many lines to return (total, including the one indicated by lineNumber). If smaller then 1 then an empty string will be returned. An array of two strings is returned. At index 0 a portion of thefile starting at lineNumber and reaching lineNumber+n is located.At index 1 there is an informational string about how large asegment of the file is being returned.Null is returned if errors occur (file not found or io exception)



get
public static String[] get(InputStreamReader reader, int lineNumber, int n, long logsize)(Code)
Gets a portion of a log file. Starting at a given line number and the n-1 lines following that one or until the end of the log if that is reached first.
Parameters:
  reader - source to scan for lines
Parameters:
  lineNumber - The number of the first line to get (if larger then thefile an empty string will be returned)
Parameters:
  n - How many lines to return (total, including the one indicated bylineNumber). If smaller then 1 then an empty stringwill be returned.
Parameters:
  logsize - total size of source An array of two strings is returned. At index 0 a portion of thefile starting at lineNumber and reaching lineNumber+n is located.At index 1 there is an informational string about how large asegment of the file is being returned.Null is returned if errors occur (file not found or io exception)



getByRegExpr
public static String[] getByRegExpr(String aFileName, String regExpr, int addLines, boolean prependLineNumbers, int skipFirstMatches, int numberOfMatches)(Code)
Returns all lines in a log/file matching a given regular expression. Possible to get lines immediately following the matched line. Also possible to have each line prepended by it's line number.
Parameters:
  aFileName - The filename of the log/file
Parameters:
  regExpr - The regular expression that is to be used
Parameters:
  addLines - How many lines (in addition to the matched line) to add. A value less then 1 will mean that only the matched line will be included. If another matched line is hit before we reach this limit it will be included and this countereffectively reset for it.
Parameters:
  prependLineNumbers - If true, then each line will be prepended by it's line number in the file.
Parameters:
  skipFirstMatches - The first number of matches up to this value willbe skipped over.
Parameters:
  numberOfMatches - Once past matches that are to be skipped this manymatches will be added to the return value. Avalue of 0 will cause all matching lines to beincluded. An array of two strings is returned. At index 0 tall lines in alog/file matching a given regular expression is located.At index 1 there is an informational string about how large asegment of the file is being returned.Null is returned if errors occur (file not found or io exception)If a PatternSyntaxException occurs, it's error message will bereturned and the informational string will be empty (not null).



getByRegExpr
public static String[] getByRegExpr(InputStreamReader reader, String regExpr, int addLines, boolean prependLineNumbers, int skipFirstMatches, int numberOfMatches, long logsize)(Code)
Returns all lines in a log/file matching a given regular expression. Possible to get lines immediately following the matched line. Also possible to have each line prepended by it's line number.
Parameters:
  reader - The reader of the log/file
Parameters:
  regExpr - The regular expression that is to be used
Parameters:
  addLines - How many lines (in addition to the matched line) to add. A value less then 1 will mean that only the matched line will be included. If another matched line is hit before we reach this limit it will be included and this countereffectively reset for it.
Parameters:
  prependLineNumbers - If true, then each line will be prepended by it's line number in the file.
Parameters:
  skipFirstMatches - The first number of matches up to this value willbe skipped over.
Parameters:
  numberOfMatches - Once past matches that are to be skipped this manymatches will be added to the return value. Avalue of 0 will cause all matching lines to beincluded.
Parameters:
  logsize - Size of the log in bytes An array of two strings is returned. At index 0 all lines in alog/file matching a given regular expression is located.At index 1 there is an informational string about how large asegment of the file is being returned.Null is returned if errors occur (file not found or io exception)If a PatternSyntaxException occurs, it's error message will bereturned and the informational string will be empty (not null).



getByRegExpr
public static String[] getByRegExpr(String aFileName, String regExpr, String addLines, boolean prependLineNumbers, int skipFirstMatches, int numberOfMatches)(Code)
Returns all lines in a log/file matching a given regular expression. Possible to get lines immediately following the matched line. Also possible to have each line prepended by it's line number.
Parameters:
  aFileName - The filename of the log/file
Parameters:
  regExpr - The regular expression that is to be used
Parameters:
  addLines - Any lines following a match that begin with this string will also be included. We will stop including new lines once we hit the first that does not match.
Parameters:
  prependLineNumbers - If true, then each line will be prepended by it's line number in the file.
Parameters:
  skipFirstMatches - The first number of matches up to this value willbe skipped over.
Parameters:
  numberOfMatches - Once past matches that are to be skipped this manymatches will be added to the return value. Avalue of 0 will cause all matching lines to beincluded. An array of two strings is returned. At index 0 tall lines in alog/file matching a given regular expression is located.At index 1 there is an informational string about how large asegment of the file is being returned.Null is returned if errors occur (file not found or io exception)If a PatternSyntaxException occurs, it's error message will bereturned and the informational string will be empty (not null).



getByRegExpr
public static String[] getByRegExpr(InputStreamReader reader, String regExpr, String addLines, boolean prependLineNumbers, int skipFirstMatches, int numberOfMatches, long logsize)(Code)
Returns all lines in a log/file matching a given regular expression. Possible to get lines immediately following the matched line. Also possible to have each line prepended by it's line number.
Parameters:
  reader - The reader of the log/file
Parameters:
  regExpr - The regular expression that is to be used
Parameters:
  addLines - Any lines following a match that begin with this string will also be included. We will stop including new lines once we hit the first that does not match.
Parameters:
  prependLineNumbers - If true, then each line will be prepended by it's line number in the file.
Parameters:
  skipFirstMatches - The first number of matches up to this value willbe skipped over.
Parameters:
  numberOfMatches - Once past matches that are to be skipped this manymatches will be added to the return value. Avalue of 0 will cause all matching lines to beincluded.
Parameters:
  logsize - Size of the log in bytes An array of two strings is returned. At index 0 tall lines in alog/file matching a given regular expression is located.At index 1 there is an informational string about how large asegment of the file is being returned.Null is returned if errors occur (file not found or io exception)If a PatternSyntaxException occurs, it's error message will bereturned and the informational string will be empty (not null).



getByRegExprFromSeries
public static String[] getByRegExprFromSeries(String aFileName, String regExpr, int addLines, boolean prependLineNumbers, int skipFirstMatches, int numberOfMatches)(Code)
Returns all lines in a log/file matching a given regular expression. Possible to get lines immediately following the matched line. Also possible to have each line prepended by it's line number.
Parameters:
  aFileName - The filename of the log/file
Parameters:
  regExpr - The regular expression that is to be used
Parameters:
  addLines - How many lines (in addition to the matched line) to add. A value less then 1 will mean that only the matched line will be included. If another matched line is hit before we reach this limit it will be included and this countereffectively reset for it.
Parameters:
  prependLineNumbers - If true, then each line will be prepended by it's line number in the file.
Parameters:
  skipFirstMatches - The first number of matches up to this value willbe skipped over.
Parameters:
  numberOfMatches - Once past matches that are to be skipped this manymatches will be added to the return value. Avalue of 0 will cause all matching lines to beincluded. An array of two strings is returned. At index 0 tall lines in alog/file matching a given regular expression is located.At index 1 there is an informational string about how large asegment of the file is being returned.Null is returned if errors occur (file not found or io exception)If a PatternSyntaxException occurs, it's error message will bereturned and the informational string will be empty (not null).



getByRegExprFromSeries
public static String[] getByRegExprFromSeries(String aFileName, String regExpr, String addLines, boolean prependLineNumbers, int skipFirstMatches, int numberOfMatches)(Code)
Returns all lines in a log/file matching a given regular expression. Possible to get lines immediately following the matched line. Also possible to have each line prepended by it's line number.
Parameters:
  aFileName - The filename of the log/file
Parameters:
  regExpr - The regular expression that is to be used
Parameters:
  addLines - Any lines following a match that begin with this string will also be included. We will stop including new lines once we hit the first that does not match.
Parameters:
  prependLineNumbers - If true, then each line will be prepended by it's line number in the file.
Parameters:
  skipFirstMatches - The first number of matches up to this value willbe skipped over.
Parameters:
  numberOfMatches - Once past matches that are to be skipped this manymatches will be added to the return value. Avalue of 0 will cause all matching lines to beincluded. An array of two strings is returned. At index 0 tall lines in alog/file matching a given regular expression is located.At index 1 there is an informational string about how large asegment of the file is being returned.Null is returned if errors occur (file not found or io exception)If a PatternSyntaxException occurs, it's error message will bereturned and the informational string will be empty (not null).



getFromSeries
public static String[] getFromSeries(String aFileName, int lineNumber, int n)(Code)
Gets a portion of a log spread across a numbered series of files. Starting at a given line number and the n-1 lines following that one or until the end of the log if that is reached first.
Parameters:
  aFileName - The filename of the log/file
Parameters:
  lineNumber - The number of the first line to get (if larger then thefile an empty string will be returned)
Parameters:
  n - How many lines to return (total, including the one indicated by lineNumber). If smaller then 1 then an empty string will be returned. An array of two strings is returned. At index 0 a portion of thefile starting at lineNumber and reaching lineNumber+n is located.At index 1 there is an informational string about how large asegment of the file is being returned.Null is returned if errors occur (file not found or io exception)



tail
public static String[] tail(String aFileName)(Code)
Implementation of a unix-like 'tail' command
Parameters:
  aFileName - a file name String An array of two strings is returned. At index 0 the Stringrepresentation of at most 10 last lines is located.At index 1 there is an informational string about how large asegment of the file is being returned.Null is returned if errors occur (file not found or io exception)



tail
public static String[] tail(String aFileName, int n)(Code)
Implementation of a unix-like 'tail -n' command
Parameters:
  aFileName - a file name String
Parameters:
  n - int number of lines to be returned An array of two strings is returned. At index 0 the Stringrepresentation of at most n last lines is located.At index 1 there is an informational string about how large asegment of the file is being returned.Null is returned if errors occur (file not found or io exception)



tail
public static String[] tail(RandomAccessFile raf, int n)(Code)
Implementation of a unix-like 'tail -n' command
Parameters:
  raf - a RandomAccessFile to tail
Parameters:
  n - int number of lines to be returned An array of two strings is returned. At index 0 the Stringrepresentation of at most n last lines is located.At index 1 there is an informational string about how large asegment of the file is being returned.Null is returned if errors occur (file not found or io exception)



Methods inherited from java.lang.Object
native protected Object clone() throws CloneNotSupportedException(Code)(Java Doc)
public boolean equals(Object obj)(Code)(Java Doc)
protected void finalize() throws Throwable(Code)(Java Doc)
final native public Class getClass()(Code)(Java Doc)
native public int hashCode()(Code)(Java Doc)
final native public void notify()(Code)(Java Doc)
final native public void notifyAll()(Code)(Java Doc)
public String toString()(Code)(Java Doc)
final native public void wait(long timeout) throws InterruptedException(Code)(Java Doc)
final public void wait(long timeout, int nanos) throws InterruptedException(Code)(Java Doc)
final public void wait() throws InterruptedException(Code)(Java Doc)

www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.