Package xbird.util.io

Examples of xbird.util.io.FastByteArrayInputStream


        final int len = s.readInt();
        final byte[] b = new byte[len];
        s.readFully(b, 0, len);

        FastByteArrayInputStream bis = new FastByteArrayInputStream(b);
        ObjectInputStream ois = new ObjectInputStream(bis);
        this._bodyExpr = (XQExpression) ois.readObject();
        this._bindingVar = (BindingVariable) ois.readObject();

        this._exprBytes = b;
View Full Code Here


        out.writeObject(student2);
        out.close();

        final byte[] b = f.toByteArray();

        FastByteArrayInputStream in = new FastByteArrayInputStream(b);
        ObjectInputStream oin = new ObjectInputStream(in);

        Assert.assertEquals(student1, oin.readObject());
        Assert.assertEquals(5, oin.readInt());
        Assert.assertEquals(student2, oin.readObject());
View Full Code Here

        byte[] b2 = out2.toByteArray();
        out.writeInt(b2.length);
        out.write(b2);

        FastByteArrayInputStream bis3 = new FastByteArrayInputStream(b2);
        ObjectInputStream ois3 = new ObjectInputStream(bis3);
        Assert.assertEquals(student2, ois3.readObject());
        Assert.assertEquals(student3, ois3.readObject());

        out.close();

        final byte[] b = f.toByteArray();
        FastByteArrayInputStream in = new FastByteArrayInputStream(b);
        ObjectInputStream oin = new ObjectInputStream(in);

        Assert.assertEquals(student1, oin.readObject());
        Assert.assertEquals(5, oin.readInt());

        int size3 = oin.readInt();
        byte[] b3 = new byte[size3];
        oin.read(b3);
        ArrayAssert.assertEquals(b2, b3);

        FastByteArrayInputStream bis4 = new FastByteArrayInputStream(b3);
        ObjectInputStream ois4 = new ObjectInputStream(bis4);
        Assert.assertEquals(student2, ois4.readObject());
        Assert.assertEquals(student3, ois4.readObject());

        oin.close();
View Full Code Here

        ObjectOutputStream out = new ObjectOutputStream(f);
        PlaceHolder holder1 = new PlaceHolder();
        out.writeObject(holder1);
        out.flush();

        FastByteArrayInputStream bis = new FastByteArrayInputStream(f.getInternalArray(), 0, f.size());
        ObjectInputStream ois = new ObjectInputStream(bis);
        Assert.assertEquals(holder1, ois.readObject());
    }
View Full Code Here

            int size = s.readInt();
            byte[] b = new byte[size];
            s.readFully(b, 0, size);
            this.ser23 = b;

            FastByteArrayInputStream bis3 = new FastByteArrayInputStream(b);
            ObjectInputStream ois3 = new ObjectInputStream(bis3);
            this.student2 = (Student) ois3.readObject();
            this.student3 = (Student) ois3.readObject();
        }
View Full Code Here

            throw new IOException(PrintUtils.prettyPrintStackTrace(e));
        }
    }

    public static <T> T readObjectQuietly(final byte[] obj) {
        return ObjectUtils.<T> readObjectQuietly(new FastByteArrayInputStream(obj));
    }
View Full Code Here

    public static <T> T readObjectQuietly(final byte[] obj) {
        return ObjectUtils.<T> readObjectQuietly(new FastByteArrayInputStream(obj));
    }

    public static <T> T readObjectQuietly(final byte[] obj, final ClassLoader cl) {
        return ObjectUtils.<T> readObjectQuietly(new FastByteArrayInputStream(obj), cl);
    }
View Full Code Here

    public static <T> T readObjectQuietly(final byte[] obj, final ClassLoader cl) {
        return ObjectUtils.<T> readObjectQuietly(new FastByteArrayInputStream(obj), cl);
    }

    public static <T> T readGzipCompressedObjectQuietly(final byte[] obj) {
        final FastByteArrayInputStream bis = new FastByteArrayInputStream(obj);
        final GZIPInputStream gis;
        try {
            gis = new GZIPInputStream(bis);
        } catch (IOException e) {
            throw new IllegalStateException(e);
View Full Code Here

        }
        return ObjectUtils.<T> readObjectQuietly(gis);
    }

    public static <T> T readObject(final byte[] obj) throws IOException, ClassNotFoundException {
        return ObjectUtils.<T> readObject(new FastByteArrayInputStream(obj));
    }
View Full Code Here

        return ObjectUtils.<T> readObject(new FastByteArrayInputStream(obj));
    }

    public static <T> T readGzipCompressedObject(final byte[] obj) throws IOException,
            ClassNotFoundException {
        FastByteArrayInputStream bis = new FastByteArrayInputStream(obj);
        GZIPInputStream gis = new GZIPInputStream(bis);
        return ObjectUtils.<T> readObject(gis);
    }
View Full Code Here

TOP

Related Classes of xbird.util.io.FastByteArrayInputStream

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.