public class FileRecordLog extends Object
Record
s. Every file record
log contains a header with the following physical layout:
After this header, zero or more
Physical Record Layout Byte 1
Byte 2
Byte 3
Byte 4
'J'
'L'
'O'
'G'
MAJOR
MINOR
START REVISION
ReadRecord
s follow.Constructor and Description |
---|
FileRecordLog(File logFile)
Create a new instance of this class.
|
Modifier and Type | Method and Description |
---|---|
long |
append(String journalId,
String producerId,
InputStream in,
int length)
Append a record to this log.
|
void |
close()
Close this log.
|
boolean |
contains(long revision)
Return a flag indicating whether this record log contains a certain revision.
|
boolean |
exceeds(long size)
Return a flag indicating whether this record log exceeds a given size.
|
long |
getLastRevision()
Return the last revision.
|
long |
getPreviousRevision()
Return the previous revision.
|
void |
init(long previousRevision)
Initialize this record log by writing a header containing the
previous revision.
|
boolean |
isNew()
Return a flag indicating whether this record log is new.
|
ReadRecord |
read(NamespaceResolver resolver,
NamePathResolver npResolver)
Read the file record at the current seek position.
|
void |
seek(long revision)
Seek an entry.
|
public FileRecordLog(File logFile) throws IOException
logFile
- file containing record logIOException
- if an I/O error occurspublic void init(long previousRevision) throws IOException
IOException
public boolean contains(long revision)
revision
- revision to look fortrue
if this record log contain a certain revision;
false
otherwisepublic boolean isNew()
true
if this record log is new;
false
otherwisepublic boolean exceeds(long size)
public void seek(long revision) throws IOException
revision
- revision to seekIOException
- if an I/O error occurspublic ReadRecord read(NamespaceResolver resolver, NamePathResolver npResolver) throws IOException
resolver
- namespace resolverIOException
- if an I/O error occurspublic long append(String journalId, String producerId, InputStream in, int length) throws IOException
journalId
- journal identifierproducerId
- producer identifierin
- record to addlength
- record lengthIOException
- if an I/O error occurspublic long getPreviousRevision()
public long getLastRevision()
public void close()
Copyright © 2004–2024 The Apache Software Foundation. All rights reserved.