Package java.io

Examples of java.io.InputStream.skip()


      fail("Exception during mark test 2");
    }

    in = new BufferedInputStream(new ByteArrayInputStream(bytes), 12);
    try {
      in.skip(6);
      in.mark(8);
      in.skip(7);
      in.reset();
      assertTrue("Wrong bytes 2", in.read() == 6 && in.read() == 7);
    } catch (IOException e) {
View Full Code Here


    in = new BufferedInputStream(new ByteArrayInputStream(bytes), 12);
    try {
      in.skip(6);
      in.mark(8);
      in.skip(7);
      in.reset();
      assertTrue("Wrong bytes 2", in.read() == 6 && in.read() == 7);
    } catch (IOException e) {
      fail("Exception during mark test 3");
    }
View Full Code Here

        assertEquals(result, "1234567890");
    }

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

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

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

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

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

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

        in = new ContentLengthInputStream(new ByteArrayInputStream(new byte[20]), 2L);
        in.read();
        in.read();
        assertTrue(in.skip(10) <= 0);
        assertTrue(in.read() == -1);
    }

    public void testChunkedConsitance() throws IOException {
        String input = "76126;27823abcd;:q38a-\nkjc\rk%1ad\tkh/asdui\r\njkh+?\\suweb";
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

            public int read(byte[] b, long position) throws IOException, RepositoryException {
                InputStream in = getStream();
                try {
                    long skip = position;
                    while (skip > 0) {
                        long skipped = in.skip(skip);
                        if (skipped <= 0) {
                            return -1;
                        }
                        skip -= skipped;
                    }
View Full Code Here

                }

                public int read(byte[] b, long position) throws IOException, RepositoryException {
                    InputStream in = getStream();
                    try {
                        in.skip(position);
                        return in.read(b);
                    } finally {
                        in.close();
                    }
                }
View Full Code Here

  }
 
  public synchronized InputStream getBlockInputStream(Block b, long seekOffset)
                              throws IOException {
    InputStream result = getBlockInputStream(b);
    result.skip(seekOffset);
    return result;
  }

  /** Not supported */
  public BlockInputStreams getTmpInputStreams(Block b, long blkoff, long ckoff
View Full Code Here

                }

                public int read(byte[] b, long position) throws IOException, RepositoryException {
                    InputStream in = getStream();
                    try {
                        in.skip(position);
                        return in.read(b);
                    } finally {
                        in.close();
                    }
                }
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.