Package fiftyone.mobile.detection.readers

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


     *
     * @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

    @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

     * 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

     * @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

*/
public final class StreamFactory {

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

    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

    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

    }

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

TOP

Related Classes of fiftyone.mobile.detection.readers.BinaryReader

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.