public class DataFileAccessorImpl extends java.lang.Object implements DataFileAccessor
| Modifier and Type | Field and Description |
|---|---|
protected java.nio.channels.FileChannel |
channel |
protected java.util.Date |
end |
protected java.io.RandomAccessFile |
file |
protected static byte |
FLAG_DELETED |
protected static byte |
FLAG_ERROR |
protected static byte |
FLAG_HEARTBEAT |
protected static byte |
FLAG_MANUAL |
protected static int |
HEADER_SIZE |
protected java.util.Date |
start |
| Constructor and Description |
|---|
DataFileAccessorImpl(java.io.File file) |
| Modifier and Type | Method and Description |
|---|---|
static DataFileAccessorImpl |
create(java.io.File file,
java.util.Date startDate,
java.util.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,
java.util.Date timestamp,
boolean error,
boolean manual)
Forward correct entries
|
java.util.Date |
getEnd() |
java.util.Date |
getStart() |
void |
insertValue(double value,
java.util.Date date,
boolean error,
boolean manual,
boolean heartbeat) |
boolean |
visit(ValueVisitor visitor) |
boolean |
visitFirstValue(ValueVisitor visitor) |
protected static final byte FLAG_DELETED
protected static final byte FLAG_HEARTBEAT
protected static final byte FLAG_MANUAL
protected static final byte FLAG_ERROR
protected static final int HEADER_SIZE
protected java.io.RandomAccessFile file
protected final java.nio.channels.FileChannel channel
protected java.util.Date start
protected java.util.Date end
public DataFileAccessorImpl(java.io.File file)
throws java.lang.Exception
java.lang.Exceptionpublic java.util.Date getStart()
getStart in interface DataFileAccessorpublic java.util.Date getEnd()
getEnd in interface DataFileAccessorpublic void insertValue(double value,
java.util.Date date,
boolean error,
boolean manual,
boolean heartbeat)
throws java.io.IOException
insertValue in interface DataFileAccessorjava.io.IOExceptionpublic boolean visitFirstValue(ValueVisitor visitor) throws java.lang.Exception
visitFirstValue in interface DataFileAccessorjava.lang.Exceptionpublic boolean visit(ValueVisitor visitor) throws java.io.IOException
visit in interface DataFileAccessorjava.io.IOExceptionpublic void forwardCorrect(double value,
java.util.Date timestamp,
boolean error,
boolean manual)
throws java.lang.Exception
DataFileAccessor
forwardCorrect in interface DataFileAccessorvalue - the valuetimestamp - the starting pointerror - the error flagmanual - the manual flagjava.lang.Exceptionpublic void dispose()
dispose in interface DataFileAccessorpublic void delete()
delete in interface DataFileAccessorpublic static DataFileAccessorImpl create(java.io.File file, java.util.Date startDate, java.util.Date endDate) throws java.lang.Exception
file - The file to create. This file must not exists.startDate - the start date of the fileendDate - the end date of the filejava.lang.Exception - if anything goes wrong
Copyright (c) IBH SYSTEMS GmbH and others 2010, 2013.
All rights reserved. This program and the accompanying materials
are made available under the terms of the
Eclipse Public License v1.0