Package org.apache.derby.iapi.types

Examples of org.apache.derby.iapi.types.ClobStreamHeaderGenerator


            throws IOException {
        final int valueLen = DEFAULT_INTERNAL_BUFFER_SIZE + 5*1024;
        InputStream is = getStream(valueLen);
        is.mark(valueLen - 1024);
        // Obtain a header generator to compare with.
        ClobStreamHeaderGenerator hdrGen = new ClobStreamHeaderGenerator(false);
        byte[] hdrTmp = new byte[100];
        int headerLen = hdrGen.generateInto(hdrTmp, 0, valueLen);
        byte[] hdr1 = new byte[headerLen];
        System.arraycopy(hdrTmp, 0, hdr1, 0, headerLen);
        byte[] hdr2 = new byte[headerLen];
        // Get the first bytes from the stream being tested.
        assertEquals(headerLen, is.read(hdr2));
View Full Code Here


     */
    private InputStream getStream(int length) {
        Reader src = new LoopingAlphabetReader(length,
                                        CharAlphabet.modernLatinLowercase());
        InputStream is = new ReaderToUTF8Stream(
                src, length, 0, "CLOB", new ClobStreamHeaderGenerator(false));
        assertTrue("The stream doesn't support mark/reset", is.markSupported());
        return is;
    }
View Full Code Here

    public void testSkipUntilEOFOnLongStreamCJK()
            throws IOException {
        final int charLength = 127019;
        InputStream in = new ReaderToUTF8Stream(
                new LoopingAlphabetReader(charLength, CharAlphabet.cjkSubset()),
                charLength, 0, TYPENAME, new ClobStreamHeaderGenerator(true));
        in.skip(HEADER_LENGTH); // Skip encoded length added by ReaderToUTF8Stream.
        assertEquals(charLength, UTF8Util.skipUntilEOF(in));
    }
View Full Code Here

    public void testSkipFullyOnTooShortStreamCJK()
            throws IOException {
        final int charLength = 161019;
        InputStream in = new ReaderToUTF8Stream(
                new LoopingAlphabetReader(charLength, CharAlphabet.cjkSubset()),
                charLength, 0, TYPENAME, new ClobStreamHeaderGenerator(true));
        in.skip(HEADER_LENGTH); // Skip encoded length added by ReaderToUTF8Stream.
        try {
            UTF8Util.skipFully(in, charLength + 100);
            fail("Should have failed because of too short stream.");
        } catch (EOFException eofe) {
View Full Code Here

            throws IOException {
        final int valueLen = DEFAULT_INTERNAL_BUFFER_SIZE + 5*1024;
        InputStream is = getStream(valueLen);
        is.mark(valueLen - 1024);
        // Obtain a header generator to compare with.
        ClobStreamHeaderGenerator hdrGen = new ClobStreamHeaderGenerator(false);
        byte[] hdrTmp = new byte[100];
        int headerLen = hdrGen.generateInto(hdrTmp, 0, valueLen);
        byte[] hdr1 = new byte[headerLen];
        System.arraycopy(hdrTmp, 0, hdr1, 0, headerLen);
        byte[] hdr2 = new byte[headerLen];
        // Get the first bytes from the stream being tested.
        assertEquals(headerLen, is.read(hdr2));
View Full Code Here

     */
    private InputStream getStream(int length) {
        Reader src = new LoopingAlphabetReader(length,
                                        CharAlphabet.modernLatinLowercase());
        InputStream is = new ReaderToUTF8Stream(
                src, length, 0, "CLOB", new ClobStreamHeaderGenerator(false));
        assertTrue("The stream doesn't support mark/reset", is.markSupported());
        return is;
    }
View Full Code Here

    public void testSkipUntilEOFOnLongStreamCJK()
            throws IOException {
        final int charLength = 127019;
        InputStream in = new ReaderToUTF8Stream(
                new LoopingAlphabetReader(charLength, CharAlphabet.cjkSubset()),
                charLength, 0, TYPENAME, new ClobStreamHeaderGenerator(true));
        in.skip(HEADER_LENGTH); // Skip encoded length added by ReaderToUTF8Stream.
        assertEquals(charLength, UTF8Util.skipUntilEOF(in));
    }
View Full Code Here

    public void testSkipFullyOnTooShortStreamCJK()
            throws IOException {
        final int charLength = 161019;
        InputStream in = new ReaderToUTF8Stream(
                new LoopingAlphabetReader(charLength, CharAlphabet.cjkSubset()),
                charLength, 0, TYPENAME, new ClobStreamHeaderGenerator(true));
        in.skip(HEADER_LENGTH); // Skip encoded length added by ReaderToUTF8Stream.
        try {
            UTF8Util.skipFully(in, charLength + 100);
            fail("Should have failed because of too short stream.");
        } catch (EOFException eofe) {
View Full Code Here

TOP

Related Classes of org.apache.derby.iapi.types.ClobStreamHeaderGenerator

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.