Package krati.io

Examples of krati.io.ChannelReader


     * @throws IOException
     */
    public void load(File file) throws IOException {
        _entryFile = file;
        Chronos c = new Chronos();
        ChannelReader in = new ChannelReader(file);

        try {
            in.open();

            // Read entry head
            long fileVersion = in.readLong();
            if (fileVersion != STORAGE_VERSION) {
                throw new RuntimeException("Wrong storage version " + fileVersion + " encounted in " + file.getAbsolutePath() + ". Version " + STORAGE_VERSION
                        + " expected.");
            }

            long minScnHead = in.readLong();
            long maxScnHead = in.readLong();
            int length = in.readInt();

            // Read entry body
            loadDataSection(in, length);

            // Read entry tail
            long minScnTail = in.readLong();
            long maxScnTail = in.readLong();

            if (minScnHead != minScnTail) {
                throw new IOException("min scns don't match: " + minScnHead + " vs " + minScnTail);
            }
            if (maxScnHead != maxScnTail) {
                throw new IOException("max scns don't match:" + maxScnHead + " vs " + maxScnTail);
            }

            _minScn = minScnHead;
            _maxScn = maxScnHead;

            if(_log.isInfoEnabled()) {
                _log.info("loaded entry: minScn=" + _minScn + " maxScn=" + _maxScn + " size=" + size() + " file=" + file.getName() + " in " + c.getElapsedTime());
            }
        } finally {
            in.close();
        }
    }
View Full Code Here


*/
public class TestChannelReaderMappedWriter extends AbstractTestDataRW {
   
    @Override
    protected DataReader createDataReader(File file) {
        return new ChannelReader(file);
    }
View Full Code Here

*/
public class TestChannelReaderMultiMappedWriter extends AbstractTestDataRW {
   
    @Override
    protected DataReader createDataReader(File file) {
        return new ChannelReader(file);
    }
View Full Code Here

*/
public class TestChannelReaderChannelWriter extends AbstractTestDataRW {
   
    @Override
    protected DataReader createDataReader(File file) {
        return new ChannelReader(file);
    }
View Full Code Here

TOP

Related Classes of krati.io.ChannelReader

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.