Package java.io

Examples of java.io.ByteArrayInputStream.reset()


        descript = new GlyfDescript[numGlyphs];
        ByteArrayInputStream bais = new ByteArrayInputStream(buf);
        for (int i = 0; i < numGlyphs; i++) {
            int len = loca.getOffset((short)(i + 1)) - loca.getOffset(i);
            if (len > 0) {
                bais.reset();
                bais.skip(loca.getOffset(i));
                short numberOfContours = (short)(bais.read()<<8 | bais.read());
                if (numberOfContours >= 0) {
                    descript[i] = new GlyfSimpleDescript(this, numberOfContours, bais);
                }
View Full Code Here


        }

        for (int i = 0; i < numGlyphs; i++) {
            int len = loca.getOffset((short)(i + 1)) - loca.getOffset(i);
            if (len > 0) {
                bais.reset();
                bais.skip(loca.getOffset(i));
                short numberOfContours = (short)(bais.read()<<8 | bais.read());
                if (numberOfContours < 0) {
                    descript[i] = new GlyfCompositeDescript(this, bais);
                }
View Full Code Here

            List bookmarks = SimpleBookmark.getBookmark(pdfReader);
            ByteArrayOutputStream out = new ByteArrayOutputStream();
            SimpleBookmark.exportToXML(bookmarks, out, "UTF-8", false);
            ByteArrayInputStream input = new ByteArrayInputStream(out.toByteArray());
            int maxDepth = PdfUtility.getMaxBookmarksDepth(input);
            input.reset();
            if (bLevel <= maxDepth) {
                SAXReader reader = new SAXReader();
                org.dom4j.Document document = reader.read(input);
                // head node
                String headBookmarkXQuery = "/Bookmark/Title[@Action=\"GoTo\"]";
View Full Code Here

      try {
          ImageIcon result = new ImageIcon(bytes);
          if (result != null && result.getImage() != null && result.getIconHeight() > 0 && result.getIconWidth() > 0){
            return result;
          }
        bis.reset();
      Image i = ImageIO.read(bis);
      if (i != null) {
        return new ImageIcon(i);
      }
    } catch (IOException e) {
View Full Code Here

      try {
          ImageIcon result = new ImageIcon(bytes);
          if (result != null && result.getImage() != null && result.getIconHeight() > 0 && result.getIconWidth() > 0){
            return result;
          }
        bis.reset();
      Image i = ImageIO.read(bis);
      if (i != null) {
        return new ImageIcon(i);
      }
    } catch (IOException e) {
View Full Code Here

      try {
          ImageIcon result = new ImageIcon(bytes);
          if (result != null && result.getImage() != null && result.getIconHeight() > 0 && result.getIconWidth() > 0){
            return result;
          }
        bis.reset();
      Image i = ImageIO.read(bis);
      if (i != null) {
        return new ImageIcon(i);
      }
    } catch (IOException e) {
View Full Code Here

      try {
          ImageIcon result = new ImageIcon(bytes);
          if (result != null && result.getImage() != null && result.getIconHeight() > 0 && result.getIconWidth() > 0){
            return result;
          }
        bis.reset();
      Image i = ImageIO.read(bis);
      if (i != null) {
        return new ImageIcon(i);
      }
    } catch (IOException e) {
View Full Code Here

                ByteArrayInputStream bais = copy(bytes);

                FileOutputStream out = new FileOutputStream(targetFile);
                IOUtil.copyCompletely(bais, out);

                bais.reset();
                return bais;
            }
            catch (IOException e)
            {
                System.err.println("IO Error " + e);
View Full Code Here

    // -- Looping 100 times as a warm up --------------------------
    for (int i = 100; i != 0; --i) {
      bais.mark(baos.size());
      while (decoder.decode() != IntDecoder.EOS) {
      }
      bais.reset();
      decoder.reInit(bais);
    }
    // -----------------------------------------------------------

    decoder.reInit(bais);
View Full Code Here

    startTime = System.currentTimeMillis();
    for (int i = loopFactor; i > 0; --i) {
      bais.mark(baos.size());
      while (decoder.decode() != IntDecoder.EOS) {
      }
      bais.reset();
      decoder.reInit(bais);
    }

    endTime = System.currentTimeMillis();
    long decodeTime = endTime - startTime;
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.