Examples of Savable


Examples of com.ardor3d.util.export.Savable

            bis = null;

            _dataArray = baos.toByteArray();
            baos = null;

            final Savable rVal = readObject(id);

            if (logger.isLoggable(Level.FINE)) {
                logger.fine("Importer Stats: ");
                logger.fine("Tags: " + numClasses);
                logger.fine("Objects: " + numLocs);
View Full Code Here

Examples of com.ardor3d.util.export.Savable

        return load(url, null);
    }

    public Savable load(final URL url, final ReadListener listener) throws IOException {
        final InputStream is = url.openStream();
        final Savable rVal = load(is, listener);
        is.close();
        return rVal;
    }
View Full Code Here

Examples of com.ardor3d.util.export.Savable

        return load(file, null);
    }

    public Savable load(final File file, final ReadListener listener) throws IOException {
        final FileInputStream fis = new FileInputStream(file);
        final Savable rVal = load(fis, listener);
        fis.close();
        return rVal;
    }
View Full Code Here

Examples of com.ardor3d.util.export.Savable

        return rVal;
    }

    public Savable load(final byte[] data) throws IOException {
        final ByteArrayInputStream bais = new ByteArrayInputStream(data);
        final Savable rVal = load(bais);
        bais.close();
        return rVal;
    }
View Full Code Here

Examples of com.ardor3d.util.export.Savable

            loc += 4;

            final BinaryInputCapsule cap = new BinaryInputCapsule(this, bco);
            cap.setContent(_dataArray, loc, loc + dataLength);

            final Savable out;

            try {
                @SuppressWarnings("unchecked")
                final Class<? extends Savable> clazz = (Class<? extends Savable>) Class.forName(bco._className);
                final SavableFactory ann = clazz.getAnnotation(SavableFactory.class);
                if (ann == null) {
                    out = clazz.newInstance();
                } else {
                    out = (Savable) clazz.getMethod(ann.factoryMethod(), (Class<?>[]) null).invoke(null,
                            (Object[]) null);
                }
            } catch (final InstantiationException e) {
                logger.logp(Level.SEVERE, this.getClass().toString(), "readObject(int)",
                        "Could not access constructor of class '" + bco._className + "'! \n"
                                + "Some types may require the annotation SavableFactory.  Please double check.", e);
                throw new Ardor3dException(e);
            } catch (final NoSuchMethodException e) {
                logger
                        .logp(
                                Level.SEVERE,
                                this.getClass().toString(),
                                "readObject(int)",
                                e.getMessage()
                                        + " \n"
                                        + "Method specified in annotation does not appear to exist or has an invalid method signature.",
                                e);
                throw new Ardor3dException(e);
            }

            _capsuleTable.put(out, cap);
            _contentTable.put(id, out);

            out.read(_capsuleTable.get(out));

            _capsuleTable.remove(out);

            return out;
View Full Code Here

Examples of com.ardor3d.util.export.Savable

        final Element old = _currentElement;
        final Element el = appendElement(name);
        el.setAttribute("size", String.valueOf(objects.length));
        for (int i = 0; i < objects.length; i++) {
            final Savable o = objects[i];
            if (o == null) {
                // renderStateList has special loading code, so we can leave out the null values
                if (!name.equals("renderStateList")) {
                    final Element before = _currentElement;
                    appendElement("null");
                    _currentElement = before;
                }
            } else {
                write(o, o.getClassTag().getName(), null);
            }
        }
        _currentElement = old;
    }
View Full Code Here

Examples of com.ardor3d.util.export.Savable

        el.setAttribute(XMLExporter.ATTRIBUTE_SIZE, String.valueOf(array.size()));
        for (final Object o : array) {
            if (o == null) {
                continue;
            } else if (o instanceof Savable) {
                final Savable s = (Savable) o;
                write(s, s.getClassTag().getName(), null);
            } else {
                throw new ClassCastException("Not a Savable instance: " + o);
            }
        }
        _currentElement = old;
View Full Code Here

Examples of com.ardor3d.util.export.Savable

        }
        final Element stringMap = appendElement(name);

        final Iterator<? extends Savable> keyIterator = map.keySet().iterator();
        while (keyIterator.hasNext()) {
            final Savable key = keyIterator.next();
            appendElement(XMLExporter.ELEMENT_MAPENTRY);
            write(key, XMLExporter.ELEMENT_KEY, null);
            final Savable value = map.get(key);
            write(value, XMLExporter.ELEMENT_VALUE, null);
            _currentElement = stringMap;
        }

        _currentElement = (Element) stringMap.getParentNode();
View Full Code Here

Examples of com.ardor3d.util.export.Savable

        final Iterator<String> keyIterator = map.keySet().iterator();
        while (keyIterator.hasNext()) {
            final String key = keyIterator.next();
            final Element mapEntry = appendElement("MapEntry");
            mapEntry.setAttribute("key", key);
            final Savable s = map.get(key);
            write(s, "Savable", null);
            _currentElement = stringMap;
        }

        _currentElement = (Element) stringMap.getParentNode();
View Full Code Here

Examples of com.ardor3d.util.export.Savable

        }
        return ret;
    }

    public Savable readSavable(final String name, final Savable defVal) throws IOException {
        Savable ret = defVal;

        try {
            Element tmpEl = null;
            if (name != null) {
                tmpEl = findChildElement(_currentElem, name);
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.