Package hudson.plugins.timestamper.io
Class TimestampsReader
- java.lang.Object
-
- hudson.plugins.timestamper.io.TimestampsReader
-
- All Implemented Interfaces:
Closeable
,Serializable
,AutoCloseable
public class TimestampsReader extends Object implements Serializable, Closeable
Read the time-stamps for a build from disk.- Author:
- Steven G. Brown
- See Also:
- Serialized Form
-
-
Constructor Summary
Constructors Constructor Description TimestampsReader(Run<?,?> build)
Create a time-stamps reader for the given build.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description void
close()
Close this reader.int
getAbs(int lineNumber)
Convert negative line number that was calculated from end of file to absolute line number (from head)Optional<Timestamp>
read()
Read the next time-stamp.void
skip(int count)
Skip past the given number of time-stamp entries.
-
-
-
Constructor Detail
-
TimestampsReader
public TimestampsReader(Run<?,?> build)
Create a time-stamps reader for the given build.
-
-
Method Detail
-
skip
public void skip(int count) throws IOException
Skip past the given number of time-stamp entries.- Parameters:
count
- the number of time-stamp entries to skip- Throws:
IOException
-
getAbs
public int getAbs(int lineNumber) throws IOException
Convert negative line number that was calculated from end of file to absolute line number (from head)- Parameters:
lineNumber
- line number (should be negative)- Returns:
- absolute line
- Throws:
IOException
-
read
public Optional<Timestamp> read() throws IOException
Read the next time-stamp.- Returns:
- the next time-stamp, or
Optional.empty()
if there are no more to read - Throws:
IOException
-
close
public void close()
Close this reader.- Specified by:
close
in interfaceAutoCloseable
- Specified by:
close
in interfaceCloseable
-
-