Examples of BinaryReader


Examples of aterm.pure.binary.BinaryReader

  public void read(byte[] input, ATerm expectedResult){
    ByteBuffer buffer = ByteBuffer.allocate(input.length);
    buffer.put(input);
    buffer.flip();
   
    BinaryReader binaryReader = new BinaryReader(pureFactory);
    binaryReader.deserialize(buffer);
    ATerm result = binaryReader.getRoot();
   
    if(result != expectedResult){
      log("The result didn't match the expected result.");
      /*log("Was: "+result+", expected: "+expectedResult);*/
      return;
 
View Full Code Here

Examples of aterm.pure.binary.BinaryReader

 
  public void testChunkification() throws VisitFailure{
    ATerm in = makeBigDummyTerm(2500);
    ByteBuffer buffer = ByteBuffer.allocate(1000);
    BinaryWriter bw = new BinaryWriter(in);
    BinaryReader binaryReader = new BinaryReader(pureFactory);
   
    while(!binaryReader.isDone()){
      buffer.clear();
      bw.serialize(buffer);
      binaryReader.deserialize(buffer);
    }
   
    ATerm result = binaryReader.getRoot();
   
    if(result == in) log("Chunkification OK");
    else log("Chunkification FAILED");
  }
View Full Code Here

Examples of fiftyone.mobile.detection.readers.BinaryReader

     * be called to return the reader to the pool when finished.
     *
     * @return Reader open and ready to read from the temp file
     */
    BinaryReader getReader() throws IOException {
        BinaryReader reader = readers.poll();
        if (reader == null) {
            reader = source.createReader();
        }
        return reader;
    }
View Full Code Here

Examples of fiftyone.mobile.detection.readers.BinaryReader

     *
     * @return A reader open for read access to the stream
     */
    public synchronized BinaryReader createReader() throws IOException {
        if (data != null) {
            return new BinaryReader(createByteBuffer());
        }
        return new BinaryReader(createMappedByteBuffer());
    }
View Full Code Here

Examples of fiftyone.mobile.detection.readers.BinaryReader

    @Override
    public T get(int offsetOrIndex) throws IOException {
        T item;
        item = cache.itemsActive.get(offsetOrIndex);
        if (item == null) {
            BinaryReader reader = pool.getReader();
            item = createEntity(offsetOrIndex, reader);
            pool.release(reader);
            // if we get a collision in here, doesn't really matter - better
            // a collision here than having each read queued
            cache.itemsActive.put(offsetOrIndex, item);
View Full Code Here

Examples of fiftyone.mobile.detection.readers.BinaryReader

     * Builds a new provider with the embedded data set.
     *
     * @throws IOException
     */
    public Provider() throws IOException {
        this(MemoryFactory.read(new BinaryReader(getEmbeddedByteArray()), false), 0);
    }
View Full Code Here

Examples of fiftyone.mobile.detection.readers.BinaryReader

     * @param cacheServiceInterval cache service internal in seconds.
     * @throws IOException
     */
    public Provider(int cacheServiceInterval) throws IOException {
        this(MemoryFactory.read(
                new BinaryReader(getEmbeddedByteArray()), false),
                cacheServiceInterval);
    }
View Full Code Here

Examples of fiftyone.mobile.detection.readers.BinaryReader

*/
public final class StreamFactory {

    public static Dataset create(byte[] data) throws IOException {
        return read(
                new BinaryReader(data),
                new Source(data));
    }
View Full Code Here

Examples of fiftyone.mobile.detection.readers.BinaryReader

    public static Dataset create(String filename) throws IOException {
        FileInputStream fileInputStream = new FileInputStream(filename);
        try {
            return read(
                    new BinaryReader(fileInputStream),
                    new Source(filename));
        } catch (Exception e) {
            return null;
        } finally {
            fileInputStream.close();
View Full Code Here

Examples of fiftyone.mobile.detection.readers.BinaryReader

    public static Dataset create(byte[] data) throws IOException {
        return create(data, false);
    }

    public static Dataset create(byte[] data, boolean init) throws IOException {
        return read(new BinaryReader(data), init);
    }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.