Package com.fasterxml.jackson.core.io

Examples of com.fasterxml.jackson.core.io.MergedStream


                } else {
                    /* Also, if we have any read but unused input (usually true),
                     * need to merge that input in:
                     */
                    if (_inputPtr < _inputEnd) {
                        in = new MergedStream(_context, in, _inputBuffer, _inputPtr, _inputEnd);
                    }
                }
                return new InputStreamReader(in, enc.getJavaName());
            }
        }
View Full Code Here


                } else {
                    /* Also, if we have any read but unused input (usually true),
                     * need to merge that input in:
                     */
                    if (_inputPtr < _inputEnd) {
                        in = new MergedStream(_context, in, _inputBuffer, _inputPtr, _inputEnd);
                    }
                }
                return new InputStreamReader(in, enc.getJavaName());
            }
        }
View Full Code Here

        byte[] second = "FGHIJ".getBytes("UTF-8");

        assertNull(ctxt.getSourceReference());
        assertFalse(ctxt.isResourceManaged());
        ctxt.setEncoding(JsonEncoding.UTF8);
        MergedStream ms = new MergedStream(ctxt, new ByteArrayInputStream(second),
                                           first, 99, 99+5);
        // Ok, first, should have 5 bytes from first buffer:
        assertEquals(5, ms.available());
        // not supported when there's buffered stuff...
        assertFalse(ms.markSupported());
        // so this won't work, but shouldn't throw exception
        ms.mark(1);
        assertEquals((byte) 'A', ms.read());
        assertEquals(3, ms.skip(3));
        byte[] buffer = new byte[5];
        /* Ok, now, code is allowed to return anywhere between 1 and 3,
         * but we now it will return 1...
         */
        assertEquals(1, ms.read(buffer, 1, 3));
        assertEquals((byte) 'E', buffer[1]);
        // So let's read bit more
        assertEquals(3, ms.read(buffer, 0, 3));
        assertEquals((byte) 'F', buffer[0]);
        assertEquals((byte) 'G', buffer[1]);
        assertEquals((byte) 'H', buffer[2]);
        assertEquals(2, ms.available());
        // And then skip the reset
        assertEquals(2, ms.skip(200));

        ms.close();
    }
View Full Code Here

     */
    public InputStream getDataStream() {
        if (_originalStream == null) {
            return new ByteArrayInputStream(_bufferedData, 0, _bufferedLength);
        }
        return new MergedStream(null, _originalStream, _bufferedData, 0, _bufferedLength);
    }
View Full Code Here

                } else {
                    /* Also, if we have any read but unused input (usually true),
                     * need to merge that input in:
                     */
                    if (_inputPtr < _inputEnd) {
                        in = new MergedStream(_context, in, _inputBuffer, _inputPtr, _inputEnd);
                    }
                }
                return new InputStreamReader(in, enc.getJavaName());
            }
        }
View Full Code Here

                } else {
                    /* Also, if we have any read but unused input (usually true),
                     * need to merge that input in:
                     */
                    if (_inputPtr < _inputEnd) {
                        in = new MergedStream(_context, in, _inputBuffer, _inputPtr, _inputEnd);
                    }
                }
                return new InputStreamReader(in, enc.getJavaName());
            }
        default:
View Full Code Here

                } else {
                    /* Also, if we have any read but unused input (usually true),
                     * need to merge that input in:
                     */
                    if (_inputPtr < _inputEnd) {
                        in = new MergedStream(_context, in, _inputBuffer, _inputPtr, _inputEnd);
                    }
                }
                return new InputStreamReader(in, enc.getJavaName());
            }
        }
View Full Code Here

TOP

Related Classes of com.fasterxml.jackson.core.io.MergedStream

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.