Class ReadRecord
- java.lang.Object
-
- org.apache.jackrabbit.core.journal.AbstractRecord
-
- org.apache.jackrabbit.core.journal.ReadRecord
-
- All Implemented Interfaces:
Record
public class ReadRecord extends AbstractRecord
Record used for reading.
-
-
Field Summary
-
Fields inherited from class org.apache.jackrabbit.core.journal.AbstractRecord
nsResolver, resolver
-
-
Constructor Summary
Constructors Constructor Description ReadRecord(String journalId, String producerId, long revision, DataInputStream dataIn, int length, NamespaceResolver resolver, NamePathResolver npResolver)Create a new instance of this class.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description voidcancelUpdate()Cancel the changes made to an appended record.voidclose()Close this record, eventually skipping unconsumed bytes.StringgetJournalId()Return this record's journal identifier.StringgetProducerId()Return this record's producer identifier.longgetRevision()Returns the revision this record represents.booleanreadBoolean()Read a boolean from the underlying stream.bytereadByte()Read a byte from the underlying stream.charreadChar()Read a character from the underlying stream.voidreadFully(byte[] b)Fully read an array of bytes from the underlying stream.intreadInt()Read an integer from the underlying stream.longreadLong()Read a long from the underlying stream.StringreadString()Read a string from the underlying stream.longupdate()Update the changes made to an appended record.voidwrite(byte[] b)Write an array of bytes to the underlying stream.voidwriteBoolean(boolean b)Write a boolean from the underlying stream.voidwriteByte(int n)Unsupported methods when appending.voidwriteChar(char c)Write a character to the underlying stream.voidwriteInt(int n)Write an integer to the underlying stream.voidwriteLong(long n)Write a long to the underlying stream.voidwriteQName(Name name)Write aNameto the underlying stream.voidwriteString(String s)Write a string to the underlying stream.-
Methods inherited from class org.apache.jackrabbit.core.journal.AbstractRecord
readNodeId, readNodeTypeDef, readPath, readPathElement, readPrivilegeDef, readPropertyId, readQName, writeNodeId, writeNodeTypeDef, writePath, writePathElement, writePrivilegeDef, writePropertyId
-
-
-
-
Constructor Detail
-
ReadRecord
public ReadRecord(String journalId, String producerId, long revision, DataInputStream dataIn, int length, NamespaceResolver resolver, NamePathResolver npResolver)
Create a new instance of this class.
-
-
Method Detail
-
getJournalId
public String getJournalId()
Return this record's journal identifier.- Returns:
- journal identifier
-
getProducerId
public String getProducerId()
Return this record's producer identifier.- Returns:
- producer identifier
-
getRevision
public long getRevision()
Returns the revision this record represents.- Returns:
- revision
-
readByte
public byte readByte() throws JournalExceptionRead a byte from the underlying stream.- Returns:
- byte
- Throws:
JournalException- if an error occurs
-
readChar
public char readChar() throws JournalExceptionRead a character from the underlying stream.- Returns:
- character
- Throws:
JournalException- if an error occurs
-
readBoolean
public boolean readBoolean() throws JournalExceptionRead a boolean from the underlying stream.- Returns:
- boolean
- Throws:
JournalException- if an error occurs
-
readInt
public int readInt() throws JournalExceptionRead an integer from the underlying stream.- Returns:
- integer
- Throws:
JournalException- if an error occurs
-
readLong
public long readLong() throws JournalExceptionRead a long from the underlying stream.- Returns:
- long value.
- Throws:
JournalException- if an error occurs
-
readString
public String readString() throws JournalException
Read a string from the underlying stream.- Returns:
- string or
null - Throws:
JournalException- if an error occurs
-
readFully
public void readFully(byte[] b) throws JournalExceptionFully read an array of bytes from the underlying stream.- Parameters:
b- byte array- Throws:
JournalException- if an error occurs
-
close
public void close() throws IOExceptionClose this record, eventually skipping unconsumed bytes.- Throws:
IOException- if an I/O error occurs
-
writeByte
public void writeByte(int n) throws JournalExceptionUnsupported methods when appending.- Parameters:
n- byte- Throws:
JournalException- if an error occurs
-
writeChar
public void writeChar(char c) throws JournalExceptionDescription copied from interface:RecordWrite a character to the underlying stream.- Parameters:
c- character- Throws:
JournalException- if an error occurs
-
writeBoolean
public void writeBoolean(boolean b) throws JournalExceptionDescription copied from interface:RecordWrite a boolean from the underlying stream.- Parameters:
b- boolean- Throws:
JournalException- if an error occurs
-
writeInt
public void writeInt(int n) throws JournalExceptionDescription copied from interface:RecordWrite an integer to the underlying stream.- Parameters:
n- integer- Throws:
JournalException- if an error occurs
-
writeLong
public void writeLong(long n) throws JournalExceptionDescription copied from interface:RecordWrite a long to the underlying stream.- Parameters:
n- long- Throws:
JournalException- if an error occurs
-
writeString
public void writeString(String s) throws JournalException
Description copied from interface:RecordWrite a string to the underlying stream.- Parameters:
s- string, may benull- Throws:
JournalException- if an error occurs
-
writeQName
public void writeQName(Name name) throws JournalException
Description copied from class:AbstractRecordWrite aNameto the underlying stream.- Specified by:
writeQNamein interfaceRecord- Overrides:
writeQNamein classAbstractRecord- Parameters:
name- name- Throws:
JournalException- if an error occurs
-
write
public void write(byte[] b) throws JournalExceptionDescription copied from interface:RecordWrite an array of bytes to the underlying stream.- Parameters:
b- byte array- Throws:
JournalException- if an error occurs
-
update
public long update() throws JournalExceptionDescription copied from interface:RecordUpdate the changes made to an appended record. This will also update this record's revision.- Returns:
- The update size in bytes.
- Throws:
JournalException- if this record has not been appended, or if another error occurs
-
cancelUpdate
public void cancelUpdate()
Description copied from interface:RecordCancel the changes made to an appended record.
-
-