Package xbird.util.io

Examples of xbird.util.io.FastByteArrayOutputStream.toByteArray()


            final ObjectOutputStream objectOut = new ObjectOutputStream(bufOut);
            final XQEventDecoder decoder = _decoder;
            decoder.redirectTo(objectOut);
            decoder.close();
            objectOut.flush();
            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);
View Full Code Here


                throw new IOException(PrintUtils.prettyPrintStackTrace(xqe));
            } catch (Throwable e) {
                LOG.fatal(e);
                throw new IOException(PrintUtils.prettyPrintStackTrace(e));
            }
            this.encodedSequence = bufOut.toByteArray();
        }
    }

    private static Sequence decode(final byte[] b) throws IOException {
        FastByteArrayInputStream inputBuf = new FastByteArrayInputStream(b);
View Full Code Here

    }

    private static void verify(int i) throws IOException {
        FastByteArrayOutputStream os = new FastByteArrayOutputStream(256);
        VariableByteCodec.encodeInt(i, os);
        byte[] b1 = os.toByteArray();
        Assert.assertEquals(i, VariableByteCodec.decodeInt(b1));
    }

}
View Full Code Here

            segment.writeTo(dos);
            dos.flush();
        } catch (IOException e) {
            throw new IllegalStateException(e);
        }
        byte[] b = bos.toByteArray();
        return b;
    }

    public static byte[] compress(final char[] input, final int bitwidth) {
        CompressedSegment segment = new CompressedSegment(bitwidth);
View Full Code Here

            segment.writeTo(dos);
            dos.flush();
        } catch (IOException e) {
            throw new IllegalStateException(e);
        }
        byte[] b = bos.toByteArray();
        return b;
    }

    public static int compress(final char[] input, final int n, final CompressedSegment segment) {
        final int[] miss = new int[n];
View Full Code Here

            final ObjectOutputStream objectOut = new ObjectOutputStream(bufOut);
            final XQEventDecoder decoder = _decoder;
            decoder.redirectTo(objectOut);
            decoder.close();
            objectOut.flush();
            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);
View Full Code Here

            LOG.fatal(e);
            throw new IllegalStateException("failed encoding", e);
        } finally {
            objOut.flush();
        }
        final byte[] buf = bufOut.toByteArray();
        bufOut.clear();
        final int buflen = buf.length;
        if(LOG.isDebugEnabled()) {
            LOG.debug("encoded sequence size: " + buflen);
        }
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.