Package krati.io

Examples of krati.io.DataReader


    if (!_file.exists() || _file.length() == 0) {
      return;
    }
   
    Chronos c = new Chronos();
    DataReader r = IOFactory.createDataReader(_file, _type);
   
    try {
      r.open();
      r.position(DATA_START_POSITION);
     
      for (int i = 0; i < _arrayLength; i++) {
        intArray.set(i, r.readInt());
      }
     
      _log.info(_file.getName() + " loaded in " + c.getElapsedTime());
    } finally {
      r.close();
    }
  }
View Full Code Here


    if (!_file.exists() || _file.length() == 0) {
      return;
    }
   
    Chronos c = new Chronos();
    DataReader r = IOFactory.createDataReader(_file, _type);
   
    try {
      r.open();
      r.position(DATA_START_POSITION);
     
      for (int i = 0; i < _arrayLength; i++) {
        longArray.set(i, r.readLong());
      }
     
      _log.info(_file.getName() + " loaded in " + c.getElapsedTime());
    } finally {
      r.close();
    }
  }
View Full Code Here

    if (!_file.exists() || _file.length() == 0) {
      return;
    }
   
    Chronos c = new Chronos();
    DataReader r = IOFactory.createDataReader(_file, _type);
   
    try {
      r.open();
      r.position(DATA_START_POSITION);
     
      for (int i = 0; i < _arrayLength; i++) {
        shortArray.set(i, r.readShort());
      }
     
      _log.info(_file.getName() + " loaded in " + c.getElapsedTime());
    } finally {
      r.close();
    }
  }
View Full Code Here

    if (!_file.exists() || _file.length() == 0) {
      return null;
    }
   
    Chronos c = new Chronos();
    DataReader r = IOFactory.createDataReader(_file, _type);
   
    try {
      r.open();
      r.position(DATA_START_POSITION);
     
      int[] array = new int[_arrayLength];
      for (int i = 0; i < _arrayLength; i++) {
        array[i] = r.readInt();
      }
     
      _log.info(_file.getName() + " loaded in " + c.getElapsedTime());
      return array;
    } finally {
      r.close();
    }
  }
View Full Code Here

    if (!_file.exists() || _file.length() == 0) {
      return null;
    }
   
    Chronos c = new Chronos();
    DataReader r = IOFactory.createDataReader(_file, _type);
   
    try {
      r.open();
      r.position(DATA_START_POSITION);
     
      long[] array = new long[_arrayLength];
      for (int i = 0; i < _arrayLength; i++) {
        array[i] = r.readLong();
      }
     
      _log.info(_file.getName() + " loaded in " + c.getElapsedTime());
      return array;
    } finally {
      r.close();
    }
  }
View Full Code Here

    if (!_file.exists() || _file.length() == 0) {
      return null;
    }
   
    Chronos c = new Chronos();
    DataReader r = IOFactory.createDataReader(_file, _type);
   
    try {
      r.open();
      r.position(DATA_START_POSITION);
       
      short[] array = new short[_arrayLength];
      for (int i = 0; i < _arrayLength; i++) {
        array[i] = r.readShort();
      }
     
      _log.info(_file.getName() + " loaded in " + c.getElapsedTime());
      return array;
    } finally {
      r.close();
    }
  }
View Full Code Here

       
        writer.writeShort((short)871);
        writer.writeShort((short)-23);
        writer.writeShort(Short.MAX_VALUE);
       
        DataReader reader = createDataReader(file);
        reader.open();
       
        int intValue;
        intValue = reader.readInt();
        assertEquals(12345, intValue);
       
        intValue = reader.readInt();
        assertEquals(54321, intValue);
       
        intValue = reader.readInt();
        assertEquals(Integer.MAX_VALUE, intValue);
       
        long longValue;
        longValue = reader.readLong();
        assertEquals(0L, longValue);
       
        longValue = reader.readLong();
        assertEquals(-123L, longValue);
       
        longValue = reader.readLong();
        assertEquals(Long.MAX_VALUE, longValue);
       
        short shortValue;
        shortValue = reader.readShort();
        assertEquals((short)871, shortValue);
       
        shortValue = reader.readShort();
        assertEquals((short)-23, shortValue);
       
        shortValue = reader.readShort();
        assertEquals(Short.MAX_VALUE, shortValue);
       
        writer.close();
        reader.close();
    }
View Full Code Here

            writer.writeInt(posList.get(i), valList.get(i));
        }
        writer.flush();
        writer.close();
       
        DataReader reader = createDataReader(file);
        reader.open();
        for(int i = 0, cnt = posList.size(); i < cnt; i++) {
            position = posList.get(i);
            int valW = valList.get(i);
            int valR = reader.readInt(position);
            assertEquals(valW, valR);
        }
        reader.close();
    }
View Full Code Here

            writer.writeInt(posList.get(i), valList.get(i));
        }
        writer.flush();
        writer.close();
       
        DataReader reader = createDataReader(file);
        reader.open();
        for(int i = 0, cnt = posList.size(); i < cnt; i++) {
            position = posList.get(i);
            int valW = valList.get(i);
            int valR = reader.readInt(position);
            assertEquals(valW, valR);
        }
        reader.close();
    }
View Full Code Here

TOP

Related Classes of krati.io.DataReader

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.