Package xbird.util.io

Examples of xbird.util.io.FastMultiByteArrayOutputStream


        protected synchronized void write() throws IOException, DbException {
            if(!dirty) {
                return;
            }
            FastMultiByteArrayOutputStream bos = new FastMultiByteArrayOutputStream(_fileHeader.getWorkSize());
            DataOutputStream os = new DataOutputStream(bos);
            boolean varKey = !isFixedKey();
            for(int i = 0; i < keys.length; i++) {
                // Write out the keys
                if(varKey) {
                    os.writeInt(keys[i].getLength());
                }
                keys[i].writeTo(os);
                // Write out the Values
                os.writeInt(values[i].getLength());
                values[i].writeTo(os);
            }
            writeValue(page, new Value(bos.toByteArray()));
            this.dirty = false;
        }
View Full Code Here


            probe(out.toByteArray_clear());
        }
    }

    public void testRand10000() throws IOException {
        FastMultiByteArrayOutputStream out = new FastMultiByteArrayOutputStream(4096);
        DataOutputStream data = new DataOutputStream(out);
        Random rand = new Random(44444);
        for(int times = 0; times < 3; times++) {
            for(int i = 0; i < 10000; i++) {
                data.writeInt(rand.nextInt());
            }
            probe(out.toByteArray_clear());
        }
    }
View Full Code Here

            probe(out.toByteArray_clear());
        }
    }

    public void testRandGaussian10000() throws IOException {
        FastMultiByteArrayOutputStream out = new FastMultiByteArrayOutputStream(4096);
        DataOutputStream data = new DataOutputStream(out);
        Random rand = new Random(3333);
        for(int times = 0; times < 3; times++) {
            for(int i = 0; i < 10000; i++) {
                data.writeDouble(rand.nextGaussian());
            }
            probe(out.toByteArray_clear());
        }
    }
View Full Code Here

    public void test2() {
        probe("asasdfdfagfffffaerawefgsgsdffffgvsdfgsgfsgfgweffvsregsrevsdfsagghhawdfd".getBytes());
    }

    public void testRand1000() throws IOException {
        FastMultiByteArrayOutputStream out = new FastMultiByteArrayOutputStream(4096);
        DataOutputStream data = new DataOutputStream(out);
        Random rand = new Random(22222);
        for(int times = 0; times < 3; times++) {
            for(int i = 0; i < 1000; i++) {
                data.writeInt(rand.nextInt());
            }
            probe(out.toByteArray_clear());
        }
    }
View Full Code Here

            probe(out.toByteArray_clear());
        }
    }

    public void testRand10000() throws IOException {
        FastMultiByteArrayOutputStream out = new FastMultiByteArrayOutputStream(4096);
        DataOutputStream data = new DataOutputStream(out);
        Random rand = new Random(44444);
        for(int times = 0; times < 3; times++) {
            for(int i = 0; i < 10000; i++) {
                data.writeInt(rand.nextInt());
            }
            probe(out.toByteArray_clear());
        }
    }
View Full Code Here

            probe(out.toByteArray_clear());
        }
    }

    public void testRandGaussian10000() throws IOException {
        FastMultiByteArrayOutputStream out = new FastMultiByteArrayOutputStream(4096);
        DataOutputStream data = new DataOutputStream(out);
        Random rand = new Random(3333);
        for(int times = 0; times < 3; times++) {
            for(int i = 0; i < 10000; i++) {
                data.writeDouble(rand.nextGaussian());
            }
            probe(out.toByteArray_clear());
        }
    }
View Full Code Here

    public void test2() {
        probe("asasdfdfagfffffaerawefgsgsdffffgvsdfgsgfsgfgweffvsregsrevsdfsagghhawdfd".getBytes());
    }

    public void testRand1000() throws IOException {
        FastMultiByteArrayOutputStream out = new FastMultiByteArrayOutputStream(4096);
        DataOutputStream data = new DataOutputStream(out);
        Random rand = new Random(22222);
        for(int times = 0; times < 3; times++) {
            for(int i = 0; i < 1000; i++) {
                data.writeInt(rand.nextInt());
            }
            probe(out.toByteArray_clear());
        }
    }
View Full Code Here

            probe(out.toByteArray_clear());
        }
    }

    public void testRandChars2000() throws IOException {
        FastMultiByteArrayOutputStream out = new FastMultiByteArrayOutputStream(4096);
        DataOutputStream data = new DataOutputStream(out);
        Random rand = new Random(22222);
        for(int times = 0; times < 10; times++) {
            for(int i = 0; i < 2048; i++) {
                data.writeChar(rand.nextInt());
            }
            probe(out.toByteArray_clear());
        }
    }
View Full Code Here

            probe(out.toByteArray_clear());
        }
    }

    public void testRandChars8K() throws IOException {
        FastMultiByteArrayOutputStream out = new FastMultiByteArrayOutputStream(4096);
        DataOutputStream data = new DataOutputStream(out);
        Random rand = new Random(22222);
        for(int times = 0; times < 10; times++) {
            for(int i = 0; i < 4096; i++) {
                data.writeChar(rand.nextInt());
            }
            probe(out.toByteArray_clear());
        }
    }
View Full Code Here

     */
    public static <T> T deepCopy(final Object orig) {
        final Object obj;
        try {
            // write the object
            final FastMultiByteArrayOutputStream fbos = new FastMultiByteArrayOutputStream();
            final ObjectOutputStream out = new ObjectOutputStream(fbos);
            out.writeObject(orig);
            out.flush();
            out.close();
            // read an object
            final ObjectInputStream in = new ObjectInputStream(fbos.getInputStream());
            obj = in.readObject();
        } catch (IOException e) {
            throw new IllegalStateException(e);
        } catch (ClassNotFoundException cnfe) {
            throw new IllegalStateException(cnfe);
View Full Code Here

TOP

Related Classes of xbird.util.io.FastMultiByteArrayOutputStream

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.