Package xbird.util.io

Examples of xbird.util.io.FastByteArrayInputStream


            this.encodedSequence = bufOut.toByteArray();
        }
    }

    private static Sequence decode(final byte[] b) throws IOException {
        FastByteArrayInputStream inputBuf = new FastByteArrayInputStream(b);
        ObjectInputStream objInput = new ObjectInputStream(inputBuf);
        final XQEventDecoder decoder = new XQEventDecoder(objInput);
        try {
            return decoder.decode();
        } catch (XQueryException e) {
View Full Code Here


        for(int i = 0; i < 18; i++) {
            codes.putGolombL(i, 4L, logm);
            final byte[] bi = codes.getBytes();
            System.out.print(Integer.toString(i) + " = " + StringUtils.toBitString(bi));
            System.out.print(", decoded = " + decodeGolombL(bi, 4L, logm));
            FastByteArrayInputStream is = new FastByteArrayInputStream(bi);
            try {
                System.out.println(", stream-decoded = " + decodeGolombL(is, 4L, logm));
            } catch (IOException e) {
                throw new IllegalStateException(e);
            }
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

            throw new IllegalStateException(e);
        }
    }

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

        for(int i = 0; i < 18; i++) {
            codes.putGolombL(i, 4L, logm);
            final byte[] bi = codes.getBytes();
            System.out.print(Integer.toString(i) + " = " + StringUtils.toBitString(bi));
            System.out.print(", decoded = " + decodeGolombL(bi, 4L, logm));
            FastByteArrayInputStream is = new FastByteArrayInputStream(bi);
            try {
                System.out.println(", stream-decoded = " + decodeGolombL(is, 4L, logm));
            } catch (IOException e) {
                throw new IllegalStateException(e);
            }
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

        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

            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

        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

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.