Examples of FastOutputStream


Examples of com.sleepycat.util.FastOutputStream

        char c = 0;
        byte[] buf = new byte[10];
        byte[] javaBuf = new byte[10];
        char[] cArray = new char[1];
        FastOutputStream javaBufStream = new FastOutputStream(javaBuf);
        DataOutputStream javaOutStream = new DataOutputStream(javaBufStream);

        try {
            for (int cInt = Character.MIN_VALUE; cInt <= Character.MAX_VALUE;
                 cInt += 1) {
                c = (char) cInt;
                cArray[0] = c;
                int byteLen = UtfOps.getByteLength(cArray);

                javaBufStream.reset();
                javaOutStream.writeUTF(new String(cArray));
                int javaByteLen = javaBufStream.size() - 2;

                if (byteLen != javaByteLen) {
                    fail("Character 0x" + Integer.toHexString(c) +
                         " UtfOps size " + byteLen +
                         " != JavaIO size " + javaByteLen);
View Full Code Here

Examples of com.sleepycat.util.FastOutputStream

    }

    void initSerialUnshared()
        throws Exception {

        fo = new FastOutputStream();
    }
View Full Code Here

Examples of com.sleepycat.util.FastOutputStream

    void initSerialShared()
        throws Exception {

        jtc = new TestClassCatalog();
        fo = new FastOutputStream();
    }
View Full Code Here

Examples of com.sleepycat.util.FastOutputStream

    void initXmlSax()
        throws Exception {

        buf = new byte[500];
        fo = new FastOutputStream();
        SAXParserFactory saxFactory = SAXParserFactory.newInstance();
        saxFactory.setNamespaceAware(true);
        parser = saxFactory.newSAXParser().getXMLReader();
    }
View Full Code Here

Examples of com.sleepycat.util.FastOutputStream

     * @see #setSerialBufferSize
     */
    protected FastOutputStream getSerialOutput(Object object) {
        int byteSize = getSerialBufferSize();
        if (byteSize != 0) {
            return new FastOutputStream(byteSize);
        } else {
            return new FastOutputStream();
        }
    }
View Full Code Here

Examples of com.sleepycat.util.FastOutputStream

        }
    }

    public void testBufferOverride() {

        FastOutputStream out = new FastOutputStream(10);
        CachedOutputBinding binding =
            new CachedOutputBinding(catalog, String.class, out);

        binding.used = false;
        binding.objectToEntry("x", buffer);
View Full Code Here

Examples of com.sleepycat.util.FastOutputStream

        CaptureSizeBinding(ClassCatalog classCatalog, Class baseClass) {
            super(classCatalog, baseClass);
        }

        public FastOutputStream getSerialOutput(Object object) {
            FastOutputStream fos = super.getSerialOutput(object);
            bufSize = fos.getBufferBytes().length;
            return fos;
        }
View Full Code Here

Examples of com.sleepycat.util.FastOutputStream

                 * [#18163]
                 */
                if (EnvironmentImpl.IS_DALVIK) {
                    try {
                        /* Serialize classFormat first. */
                        FastOutputStream fo = new FastOutputStream();
                        ObjectOutputStream oos = new ObjectOutputStream(fo);
                        oos.writeObject(classFormat);
                        byte[] bytes = fo.toByteArray();
                        /* Then deserialize classFormat. */
                        FastInputStream fi = new FastInputStream(bytes);
                        ObjectInputStream ois = new ObjectInputStream(fi);
                        classFormat = (ObjectStreamClass) ois.readObject();
                    } catch (Exception e) {
View Full Code Here

Examples of com.sleepycat.util.FastOutputStream

            throw new IllegalArgumentException
                ("Data object class (" + object.getClass() +
                 ") not an instance of binding's base class (" +
                 baseClass + ')');
        }
        FastOutputStream fo = getSerialOutput(object);
        try {
            SerialOutput jos = new SerialOutput(fo, classCatalog);
            jos.writeObject(object);
        } catch (IOException e) {
            throw RuntimeExceptionWrapper.wrapIfNeeded(e);
        }

        byte[] hdr = SerialOutput.getStreamHeader();
        entry.setData(fo.getBufferBytes(), hdr.length,
                     fo.getBufferLength() - hdr.length);
    }
View Full Code Here

Examples of com.sleepycat.util.FastOutputStream

            throw new IllegalArgumentException(
                        "Data object class (" + object.getClass() +
                        ") not an instance of binding's base class (" +
                        baseClass + ')');
        }
        FastOutputStream fo = getSerialOutput(object);
        try {
            SerialOutput jos = new SerialOutput(fo, classCatalog);
            jos.writeObject(object);
        } catch (IOException e) {
            throw new RuntimeExceptionWrapper(e);
        }

        byte[] hdr = SerialOutput.getStreamHeader();
        entry.setData(fo.getBufferBytes(), hdr.length,
                     fo.getBufferLength() - hdr.length);
    }
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.