Examples of TrieReader


Examples of fiftyone.mobile.detection.readers.TrieReader

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

Examples of fiftyone.mobile.detection.readers.TrieReader

     * Creates a new reader and stores a reference to it.
     *
     * @return A reader open for read access to the stream
     */
    public synchronized TrieReader createReader() throws IOException {
        return new TrieReader(fileInputStream.getChannel());
    }
View Full Code Here

Examples of fiftyone.mobile.detection.readers.TrieReader

     *
     * @param userAgent
     */
    public String getUserAgent(String userAgent) throws Exception {
        StringBuilder matchedUserAgent = new StringBuilder();
        TrieReader reader = _pool.getReader();
        reader.setPos(_nodesOffset);
        getDeviceIndex(
                reader,
                getUserAgentByteArray(userAgent),
                0,
                0,
View Full Code Here

Examples of fiftyone.mobile.detection.readers.TrieReader

     * and should not be stored. The "Id" property will remain unique.
     *
     * @param userAgent
     */
    public int getDeviceIndex(String userAgent) throws Exception {
        TrieReader reader = _pool.getReader();
        reader.setPos(_nodesOffset);
        int index = getDeviceIndex(
                reader,
                getUserAgentByteArray(userAgent),
                0,
                0);
View Full Code Here

Examples of fiftyone.mobile.detection.readers.TrieReader

    public static TrieProvider create(String fileName) throws IOException {
        File file = new File(fileName);
        if (file.exists()) {
            FileInputStream stream = new FileInputStream(file);

            TrieReader reader = new TrieReader(stream.getChannel());

            // Check the version number is correct for this API.
            //Version version = new Version(reader.readInt(), reader.readInt(),
            //    reader.readInt(), reader.readInt());

            int version = reader.readUShort();

            // Add this
                /*if (version != BinaryConstants.FormatVersion.Major)
             {
             throw new MobileException(String.Format(
             "Version mismatch. Data is version '{0}' for '{1}' reader",
             version,
             BinaryConstants.FormatVersion.Major));
             }*/

            // Create the new provider.
            return new TrieProvider(
                    new String(reader.readBytes((int) reader.readUInt())),
                    ReadStrings(reader),
                    ReadProperties(reader),
                    ReadDevices(reader),
                    ReadLookupList(reader),
                    reader.readLong(),
                    reader.getPos(),
                    fileName);

        } else {
            return null;
        }
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.