Package java.io

Examples of java.io.InputStream.skip()


        in = new ContentLengthInputStream(new SessionInputBufferMockup(new byte[20]), 2L);
        in.read();
        in.read();
        assertTrue(in.skip(10) <= 0);
        assertTrue(in.skip(-1) == 0);
        assertTrue(in.read() == -1);
       
        in = new ContentLengthInputStream(new SessionInputBufferMockup(new byte[2]), 4L);
        in.read();
        assertTrue(in.skip(2) == 1);
View Full Code Here


        assertTrue(in.skip(-1) == 0);
        assertTrue(in.read() == -1);
       
        in = new ContentLengthInputStream(new SessionInputBufferMockup(new byte[2]), 4L);
        in.read();
        assertTrue(in.skip(2) == 1);
    }

    public void testClose() throws IOException {
        String correct = "1234567890123456";
        InputStream in = new ContentLengthInputStream(new SessionInputBufferMockup(
View Full Code Here

        assertEquals(10, in.skip(10));
        assertTrue(in.read() == -1);

        in = new ContentLengthInputStream(new HttpDataReceiverMockup(new byte[20]), 10L);
        in.read();
        assertEquals(9, in.skip(10));
        assertTrue(in.read() == -1);

        in = new ContentLengthInputStream(new HttpDataReceiverMockup(new byte[20]), 2L);
        in.read();
        in.read();
View Full Code Here

        assertTrue(in.read() == -1);

        in = new ContentLengthInputStream(new HttpDataReceiverMockup(new byte[20]), 2L);
        in.read();
        in.read();
        assertTrue(in.skip(10) <= 0);
        assertTrue(in.skip(-1) == 0);
        assertTrue(in.read() == -1);
       
        in = new ContentLengthInputStream(new HttpDataReceiverMockup(new byte[2]), 4L);
        in.read();
View Full Code Here

        in = new ContentLengthInputStream(new HttpDataReceiverMockup(new byte[20]), 2L);
        in.read();
        in.read();
        assertTrue(in.skip(10) <= 0);
        assertTrue(in.skip(-1) == 0);
        assertTrue(in.read() == -1);
       
        in = new ContentLengthInputStream(new HttpDataReceiverMockup(new byte[2]), 4L);
        in.read();
        assertTrue(in.skip(2) == 1);
View Full Code Here

        assertTrue(in.skip(-1) == 0);
        assertTrue(in.read() == -1);
       
        in = new ContentLengthInputStream(new HttpDataReceiverMockup(new byte[2]), 4L);
        in.read();
        assertTrue(in.skip(2) == 1);
    }

    public void testClose() throws IOException {
        String correct = "1234567890123456";
        InputStream in = new ContentLengthInputStream(new HttpDataReceiverMockup(
View Full Code Here

        assertEquals(result, "1234567890");
    }

    public void testSkip() throws IOException {
        InputStream in = new ContentLengthInputStream(new HttpDataReceiverMockup(new byte[20]), 10L);
        assertEquals(10, in.skip(10));
        assertTrue(in.read() == -1);

        in = new ContentLengthInputStream(new HttpDataReceiverMockup(new byte[20]), 10L);
        in.read();
        assertEquals(9, in.skip(10));
View Full Code Here

    public void testAvailableSkip() throws Exception {
        // this byte[] is a deflation of these bytes: { 1, 3, 4, 6 }
        byte[] deflated = { 72, -119, 99, 100, 102, 97, 3, 0, 0, 31, 0, 15, 0 };
        InputStream in = new InflaterInputStream(new ByteArrayInputStream(deflated));
        assertEquals(1, in.available());
        assertEquals(4, in.skip(4));
        assertEquals(0, in.available());
    }

    public void testAvailableEmptySource() throws Exception {
        // this byte[] is a deflation of the empty file
View Full Code Here

            OMText binaryNode =(OMText) firstElement.getFirstOMChild();
            log.debug("First Element Node Text : "+binaryNode.getText());
            DataHandler dataHandler =(DataHandler) binaryNode.getDataHandler();
            InputStream inputStream = dataHandler.getInputStream();
            byte[] searchByte = new byte[length];
            inputStream.skip(offset - 1);
            int readBytes = inputStream.read(searchByte,0,length);
            String outString = new String(searchByte,binaryEncoding);
            msgCtx.setProperty(variableName,outString);
            log.debug("Set property to MsgCtx, "+variableName+" = "+outString);
            inputStream.close();
View Full Code Here

                boolean foundCerts = false;
                Enumeration<JarEntry> e = jarFile.entries();
                while (e.hasMoreElements()) {
                    JarEntry entry = e.nextElement();
                    InputStream is = jarFile.getInputStream(entry);
                    is.skip(100000);
                    is.close();
                    Certificate[] certs = entry.getCertificates();
                    if (certs != null && certs.length > 0) {
                        foundCerts = true;
                        break;
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.