|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectcom.atlassian.bamboo.build.logger.BuildLogFileAccessor
@NotThreadSafe public class BuildLogFileAccessor
This class provides a mechanism to perform operations on build log files. An accessor class must be instantiated for each build log file. Other notes: When using the file iterator, it is not thread safe. Be sure to open the file for iteration and close it once your done.
Field Summary | |
---|---|
static String |
ENCODING
|
Method Summary | |
---|---|
void |
closeFileForIteration()
close the file iterator |
List<LogEntry> |
getLastNLogs(int numLogs)
Retrives a List of the last N logs. |
List<LogEntry> |
getLastNLogsOfType(int numLogs,
Collection<Class> types)
|
int |
getNumberOfLinesInFile()
Counts the number of lines in the file. |
boolean |
hasNext()
Requires file to be opened for iteration |
String |
nextLine()
Requires file to be opened for iteration |
LogEntry |
nextLogEntry()
Requires file to be opened for iteration |
boolean |
openFileForIteration()
Open the file contained within this accessor to perform iterations (must be called before the hasNext(), nextLogEntry() and nextLine()). |
LogEntry |
searchFileForEntry(String textToSearchFor,
boolean searchInErrorMessages)
Looks incrementally through the file to see if the specified text exists |
LogEntry |
searchFileForEntry(String textToSearchFor,
int lastNLines,
boolean searchInErrorMessages)
Searchers for particular text within the last n lines of a file (eg search within the last 10 lines for a success message) |
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static final String ENCODING
Method Detail |
---|
public boolean openFileForIteration()
public void closeFileForIteration()
public boolean hasNext()
@Nullable public LogEntry nextLogEntry()
@Nullable public String nextLine()
@Nullable public LogEntry searchFileForEntry(@Nullable String textToSearchFor, boolean searchInErrorMessages) throws IOException
textToSearchFor
- the specific text to search forsearchInErrorMessages
- search also in error messages
IOException
- if there were errors accessing the file@Nullable public LogEntry searchFileForEntry(@Nullable String textToSearchFor, int lastNLines, boolean searchInErrorMessages) throws IOException
textToSearchFor
- String text to find in filelastNLines
- number of lines from end to search fromsearchInErrorMessages
- search also in error messages
IOException
- if error closing the log filepublic List<LogEntry> getLastNLogs(int numLogs) throws IOException
numLogs
- number of logs to retrive
IOException
- if errors access the build log filepublic List<LogEntry> getLastNLogsOfType(int numLogs, Collection<Class> types) throws IOException
IOException
public int getNumberOfLinesInFile() throws IOException
IOException
- if errors accessing the file
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |