org.opensolaris.opengrok.history
Class HistoryReader

java.lang.Object
  extended by java.io.Reader
      extended by org.opensolaris.opengrok.history.HistoryReader
All Implemented Interfaces:
java.io.Closeable, java.lang.Readable
Direct Known Subclasses:
DirectoryHistoryReader

public class HistoryReader
extends java.io.Reader

Class for reading history entries. The HistoryReader have three mutually exclusive usages:

  1. where you read it as if from a Reader (used by lucene)
  2. you read each entry as one string ( one line = rev + date + author + comment) used for showing matching context in search results. '\n' doesn't matter.
  3. you read it in a structured way. (used by history.jsp)
Please note that it is the clients responsibility that if one access pattern is used, it should not switch access method.


Field Summary
 
Fields inherited from class java.io.Reader
lock
 
Method Summary
 void close()
           
 java.lang.String getAuthor()
           
 java.lang.String getComment()
           
 java.util.Date getDate()
           
 java.util.List<java.lang.String> getFiles()
           
 java.lang.String getLine()
           
 java.lang.String getRevision()
           
 boolean isActive()
           
 boolean next()
          Read a single line of delta record and sets
 int read(char[] cbuf, int off, int len)
           
 
Methods inherited from class java.io.Reader
mark, markSupported, read, read, read, ready, reset, skip
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Method Detail

next

public boolean next()
             throws java.io.IOException
Read a single line of delta record and sets

Returns:
true if more log records exist Eg. do { r.getRevision(); } while(r.next())
Throws:
java.io.IOException

getLine

public java.lang.String getLine()
Returns:
get the history line in one String of current log record

getRevision

public java.lang.String getRevision()
Returns:
get the revision string of current log record

getDate

public java.util.Date getDate()
Returns:
get the date assosiated with current log record

getAuthor

public java.lang.String getAuthor()
Returns:
get the author of current log record

getComment

public java.lang.String getComment()
Returns:
get the comments of current log record

isActive

public boolean isActive()
Returns:
Does current log record is actually point to a revision

read

public int read(char[] cbuf,
                int off,
                int len)
         throws java.io.IOException
Specified by:
read in class java.io.Reader
Throws:
java.io.IOException

close

public void close()
           throws java.io.IOException
Specified by:
close in interface java.io.Closeable
Specified by:
close in class java.io.Reader
Throws:
java.io.IOException

getFiles

public java.util.List<java.lang.String> getFiles()