public class DataFileAccessorImpl extends Object implements DataFileAccessor
Modifier and Type | Class and Description |
---|---|
static interface |
DataFileAccessorImpl.EntryVisitor |
Modifier and Type | Field and Description |
---|---|
protected FileChannel |
channel |
protected Date |
end |
protected static int |
ENTRY_SIZE |
protected RandomAccessFile |
file |
static byte |
FLAG_DELETED
Entry is deleted
|
static byte |
FLAG_ERROR
Marks a value as erroneous
|
static byte |
FLAG_HEARTBEAT
Entry is a heartbeat entry
|
static byte |
FLAG_MANUAL
Marks a value as manually overridden
|
protected static int |
HEADER_SIZE |
protected Date |
start |
Constructor and Description |
---|
DataFileAccessorImpl(File file) |
Modifier and Type | Method and Description |
---|---|
static DataFileAccessorImpl |
create(File file,
Date startDate,
Date endDate)
Initialize a new file, write the empty structure to disk and return a new
accessor to it
|
void |
delete()
Dispose and delete the file
|
void |
dispose()
Dispose the file.
|
void |
forwardCorrect(double value,
Date afterDate)
Forward correct entries
This deletes all entries which are after the specified date |
boolean |
forwardVisitAll(DataFileAccessorImpl.EntryVisitor visitor) |
Date |
getEnd() |
Date |
getStart() |
void |
insertValue(double value,
Date date,
boolean error,
boolean manual,
boolean heartbeat) |
boolean |
visit(ValueVisitor visitor) |
boolean |
visitFirstValue(ValueVisitor visitor) |
public static final byte FLAG_DELETED
public static final byte FLAG_HEARTBEAT
public static final byte FLAG_MANUAL
public static final byte FLAG_ERROR
protected static final int HEADER_SIZE
protected static final int ENTRY_SIZE
protected RandomAccessFile file
protected final FileChannel channel
protected Date start
protected Date end
public Date getStart()
getStart
in interface DataFileAccessor
public Date getEnd()
getEnd
in interface DataFileAccessor
public void insertValue(double value, Date date, boolean error, boolean manual, boolean heartbeat) throws IOException
insertValue
in interface DataFileAccessor
IOException
public boolean visitFirstValue(ValueVisitor visitor) throws Exception
visitFirstValue
in interface DataFileAccessor
Exception
public boolean forwardVisitAll(DataFileAccessorImpl.EntryVisitor visitor) throws IOException
IOException
public boolean visit(ValueVisitor visitor) throws IOException
visit
in interface DataFileAccessor
IOException
public void forwardCorrect(double value, Date afterDate) throws Exception
DataFileAccessor
forwardCorrect
in interface DataFileAccessor
value
- the valueafterDate
- the starting point, correct everything afterException
- if anything goes wrongpublic void dispose()
dispose
in interface DataFileAccessor
public void delete()
delete
in interface DataFileAccessor
public static DataFileAccessorImpl create(File file, Date startDate, Date endDate) throws Exception
file
- The file to create. This file must not exists.startDate
- the start date of the fileendDate
- the end date of the fileException
- if anything goes wrongCopyright © 2016 Eclipse NeoSCADA Project. All rights reserved.