return type;
}
long processOneRecord(final long from, final long timestamp, final int recordSize, final int type) throws Exception {
if (recordSize >= _blockSize || recordSize < SUB_RECORD_OVERHEAD) {
throw new CorruptJournalException("Bad JournalRecord length " + recordSize + " at position "
+ addressToString(from, timestamp));
}
long address = from;
switch (type) {
case JE.TYPE:
if (_selectedTypes.get(type)) {
_action.je(address, timestamp, recordSize);
}
break;
case JH.TYPE:
read(_currentAddress, recordSize);
final long blockSize = JH.getBlockSize(_readBuffer);
if (blockSize != _blockSize) {
address = _currentAddress = (_currentAddress / _blockSize) * blockSize;
_readBufferAddress = _currentAddress;
_blockSize = blockSize;
}
if (_selectedTypes.get(type)) {
_action.jh(address, timestamp, recordSize);
}
break;
case SR.TYPE:
if (_selectedTypes.get(type) && _selectedTimestamps.isSelected(timestamp)) {
_action.sr(address, timestamp, recordSize);
}
break;
case DR.TYPE:
if (_selectedTypes.get(type) && _selectedTimestamps.isSelected(timestamp)) {
_action.dr(address, timestamp, recordSize);
}
break;
case DT.TYPE:
if (_selectedTypes.get(type) && _selectedTimestamps.isSelected(timestamp)) {
_action.dt(address, timestamp, recordSize);
}
break;
case IV.TYPE:
if (_selectedTypes.get(type)) {
_action.iv(address, timestamp, recordSize);
}
break;
case IT.TYPE:
if (_selectedTypes.get(type)) {
_action.it(address, timestamp, recordSize);
}
break;
case PA.TYPE:
if (_selectedTypes.get(type) && _selectedTimestamps.isSelected(timestamp)) {
_action.pa(address, timestamp, recordSize);
}
break;
case PM.TYPE:
if (_selectedTypes.get(type)) {
_action.pm(address, timestamp, recordSize);
}
break;
case TM.TYPE:
if (_selectedTypes.get(type)) {
_action.tm(address, timestamp, recordSize);
}
break;
case TX.TYPE:
if (_selectedTypes.get(type) && _selectedTimestamps.isSelected(timestamp)) {
_action.tx(address, timestamp, recordSize);
}
break;
case CP.TYPE:
if (_selectedTypes.get(type) && _selectedTimestamps.isSelected(timestamp)) {
_action.cp(address, timestamp, recordSize);
}
break;
case D0.TYPE:
if (_selectedTypes.get(type) && _selectedTimestamps.isSelected(timestamp)) {
_action.d0(address, timestamp, recordSize);
}
break;
case D1.TYPE:
if (_selectedTypes.get(type) && _selectedTimestamps.isSelected(timestamp)) {
_action.d1(address, timestamp, recordSize);
}
break;
default:
if (!isValidType(type)) {
_currentAddress -= OVERHEAD;
throw new CorruptJournalException("Invalid record type " + type + " at " + addressToString(address));
}
}
return address + recordSize;
}