Package java.io

Examples of java.io.BufferedInputStream.skip()


       final int bigBlockSize = POIFSConstants.BIG_BLOCK_MINIMUM_DOCUMENT_SIZE;
       BufferedInputStream bis = new BufferedInputStream(stream, bigBlockSize+1);
       bis.mark(bigBlockSize);

       // Do we need to store as a mini stream or a full one?
       if(bis.skip(bigBlockSize) < bigBlockSize) {
          _stream = new NPOIFSStream(_filesystem.getMiniStore());
          _block_size = _filesystem.getMiniStore().getBlockStoreBlockSize();
       } else {
          _stream = new NPOIFSStream(_filesystem);
          _block_size = _filesystem.getBlockStoreBlockSize();
View Full Code Here


        for (int i = 0; i < 256; i++) {
            bytes[i] = (byte) i;
        }
        InputStream in = new BufferedInputStream(
                new ByteArrayInputStream(bytes), 12);
        in.skip(6);
        in.mark(14);
        in.read(new byte[14], 0, 14);
        in.reset();
        assertTrue("Wrong bytes", in.read() == 6 && in.read() == 7);
View Full Code Here

        in.read(new byte[14], 0, 14);
        in.reset();
        assertTrue("Wrong bytes", in.read() == 6 && in.read() == 7);

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

        assertTrue("Wrong bytes", in.read() == 6 && in.read() == 7);

        in = new BufferedInputStream(new ByteArrayInputStream(bytes), 12);
        in.skip(6);
        in.mark(8);
        in.skip(7);
        in.reset();
        assertTrue("Wrong bytes 2", in.read() == 6 && in.read() == 7);

        BufferedInputStream buf = new BufferedInputStream(
                new ByteArrayInputStream(new byte[] { 0, 1, 2, 3, 4 }), 2);
View Full Code Here

                buf1.length).equals(fileString.substring(1000, 1010)));

        // regression for HARMONY-667
        try {
            BufferedInputStream buf = new BufferedInputStream(null, 5);
            buf.skip(10);
            fail("Should throw IOException");
        } catch (IOException e) {
            // Expected
        }
    }
View Full Code Here

      final File file = getFileHandle();
     
      // Skip BOM header.
        final BufferedInputStream strm = new BufferedInputStream(new FileInputStream(file));
      final BOM bom = getBOM(strm);
        strm.skip(bom.pattern.length);

        final Reader reader = new BufferedReader(
                new InputStreamReader(strm, bom.charset));
        return reader;
  }
View Full Code Here

        else
            bufferedStrm = new BufferedInputStream(strm);

        // Skip BOM header.
        final BOM bom = getBOM(bufferedStrm);
        bufferedStrm.skip(bom.pattern.length);

        return new BufferedReader(new InputStreamReader(bufferedStrm, bom.charset));
    }
}
View Full Code Here

    public static BufferedInputStream getStreamAndSkipBOM(String filename) throws IOException
    {
        final File file = new File(filename);
        BufferedInputStream strm = new BufferedInputStream(new FileInputStream(file));
        final BOM bom = getBOM(strm);
        strm.skip(bom.pattern.length);

        return strm;
    }

    /**
 
View Full Code Here

            bytes[i] = (byte) i;
        }
    InputStream in = new BufferedInputStream(
        new ByteArrayInputStream(bytes), 12);
    try {
      in.skip(6);
      in.mark(14);
      in.read(new byte[14], 0, 14);
      in.reset();
      assertTrue("Wrong bytes", in.read() == 6 && in.read() == 7);
    } catch (IOException e) {
View Full Code Here

      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

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.