Package xbird.util.io

Examples of xbird.util.io.FastByteArrayInputStream


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

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


                out.writeChar(c);
            }
        }

        public static CompressedSegment readFrom(final byte[] in) throws IOException {
            FastByteArrayInputStream bis = new FastByteArrayInputStream(in);
            DataInput dis = new DataInputStream(bis);
            int totalEntries = dis.readInt();
            int bitwidth = dis.readByte();
            int firstException = dis.readInt();
            int len = dis.readInt();
            byte[] b = new byte[len];
            dis.readFully(b, 0, len);
            FastByteArrayInputStream codesIs = new FastByteArrayInputStream(b);
            BitInputStream codesBis = new BitInputStream(codesIs);
            int[] codes = new int[totalEntries];
            unpack(codesBis, bitwidth, codes, totalEntries);
            int exceptions = dis.readShort();
            CharArrayList exceptionList = new CharArrayList(exceptions);
View Full Code Here

        }
        return bos.toByteArray();
    }

    public static MultiValue readFrom(byte[] b) throws IOException {
        final FastByteArrayInputStream bis = new FastByteArrayInputStream(b);
        final int size = IOUtils.readInt(bis);
        final Value[] valueAry = new Value[size];
        for(int i = 0; i < size; i++) {
            int len = IOUtils.readInt(bis);
            byte[] v = new byte[len];
            bis.read(v, 0, len);
            valueAry[i] = new Value(v, 0, len);
        }
        return new MultiValue(b, valueAry);
    }
View Full Code Here

        try {
            fetchedData = _proxy.fetchBytes(_fetchSize, compressed);
        } catch (RemoteException e) {
            throw new XQRemoteException(e);
        }
        final FastByteArrayInputStream fis = new FastByteArrayInputStream(fetchedData);
        final InputStream is;
        try {
            is = compressed ? new LZFInputStream(fis) : fis;
        } catch (IOException e) {
            throw new IllegalStateException(e);
View Full Code Here

        IOUtils.writeString("5", def3);
        IOUtils.writeString("6", def3);
        def3.close();

        byte[] b = out.toByteArray();
        FastByteArrayInputStream in = new FastByteArrayInputStream(b);
        ContinousInflaterInputStream inf1 = new ContinousInflaterInputStream(in, new Inflater(false), 8192);
        Assert.assertEquals("1", IOUtils.readString(inf1));
        Assert.assertEquals(2, IOUtils.readInt(inf1));
        Assert.assertEquals("3", IOUtils.readString(inf1));
        Assert.assertEquals("4", IOUtils.readString(inf1));
View Full Code Here

        IOUtils.writeString("5", def1);
        IOUtils.writeString("6", def1);
        def1.close();

        byte[] b = out.toByteArray();
        FastByteArrayInputStream in = new FastByteArrayInputStream(b);
        InflaterInputStream inf1 = new InflaterInputStream(in, new Inflater(false), 8192);
        Assert.assertEquals("1", IOUtils.readString(inf1));
        Assert.assertEquals(2, IOUtils.readInt(inf1));
        Assert.assertEquals("3", IOUtils.readString(inf1));
        Assert.assertEquals("4", IOUtils.readString(inf1));
View Full Code Here

        final byte[] buf = new byte[inputLen];
        input.readFully(buf);
        if(LOG.isDebugEnabled()) {
            LOG.debug("decoding sequence size: " + inputLen);
        }
        FastByteArrayInputStream inputBuf = new FastByteArrayInputStream(buf);
        ObjectInputStream objInput = new ObjectInputStream(inputBuf);
        XQEventDecoder decoder = new XQEventDecoder(objInput);
        return decoder;
    }
View Full Code Here

    /**
     * getInputStream returns an InputStream for the Value.
     */
    public final InputStream getInputStream() {
        return new FastByteArrayInputStream(_data, _pos, _len);
    }
View Full Code Here

        this._seq = seq;
    }

    public RemoteInputStream fetch(int size) throws RemoteException {
        final byte[] ary = fetchBytes(size, false);
        final FastByteArrayInputStream bis = new FastByteArrayInputStream(ary);
        final IRemoteInputStreamProxy proxy = new RemoteInputStreamProxy(bis);
        final RemoteInputStream remote = new RemoteInputStream(proxy);
        return remote;
    }
View Full Code Here

            final byte[] buf = bufOut.toByteArray();
            bufOut.clear();

            // Because input of decoder fully read, this section required for re-object serialization, etc.
            if(_reaccessable) {
                final FastByteArrayInputStream inputBuf = new FastByteArrayInputStream(buf);
                final ObjectInputStream objectInput = new ObjectInputStream(inputBuf);
                this._decoder = new XQEventDecoder(objectInput); // replace old Decoder with fresh Decoder
            }

            final int buflen = buf.length;
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.