Package java.io

Examples of java.io.ByteArrayInputStream.reset()


            doLZWDecode(encoded, baos, earlyChange);
            ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
            Predictor.decodePredictor(predictor, colors, bitsPerPixel, columns, bais, decoded);
            decoded.flush();
            baos.reset();
            bais.reset();
        }
        else
        {
            doLZWDecode(encoded, decoded, earlyChange);
        }
View Full Code Here


        // copy stream
        ByteArrayInputStream byteStream = new ByteArrayInputStream(IOUtils.toByteArray(stream));

        // read image
        BufferedImage awtImage = readJPEG(byteStream);
        byteStream.reset();

        // create Image XObject from stream
        PDImageXObject pdImage = new PDImageXObject(document, byteStream,
                COSName.DCT_DECODE, awtImage.getWidth(), awtImage.getHeight(),
                awtImage.getColorModel().getComponentSize(0),
View Full Code Here

      }
      if (longestNameMatch == null)
         throw new IllegalArgumentException("Cannot find entry: " + is + ", " + relative);

      // do recursion on relative
      bais.reset();
      zis = new ZipInputStream(bais);
      while((entry = zis.getNextEntry()) != null)
      {
         String entryName = entry.getName();
         if (entryName.equals(longestNameMatch))
View Full Code Here

        ByteArrayInputStream input = new ByteArrayInputStream("test".getBytes());
        responseCode = put(m_host, "repository/commit", "apache", "test", "1", input);
        assertResponseCode(HttpURLConnection.HTTP_INTERNAL_ERROR, responseCode);

        input.reset();
        responseCode = put(m_host, "repository/commit", "apache", "test", "0", input);
        assertResponseCode(HttpURLConnection.HTTP_OK, responseCode);

        out.reset();
        responseCode = get(m_host, "repository/checkout", "apache", "test", "1", out);
View Full Code Here

        ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream("test".getBytes());

        int responseCode = put(m_host, "replication/put", "apache", "test", "1", byteArrayInputStream);
        assertResponseCode(HttpURLConnection.HTTP_OK, responseCode);

        byteArrayInputStream.reset();
       
        responseCode = put(m_host, "repository/commit", "apache", "test", "0", byteArrayInputStream);
        assertResponseCode(HttpURLConnection.HTTP_INTERNAL_ERROR, responseCode);

        removeRepository("testInstance");
View Full Code Here

                    .getInputStream(manifestEntry);
            if (verifier != null) {
                byte[] buf = new byte[is.available()];
                is.mark(buf.length);
                is.read(buf, 0, buf.length);
                is.reset();
                verifier.addMetaEntry(manifestEntry.getName(), buf);
            }
            try {
                manifest = new Manifest(is, verifier != null);
            } finally {
View Full Code Here

    for(int idx = 0; idx < numRecords; idx++) {
      records[idx].write(dout);
    }
    times.write = System.nanoTime() - times.write;
   
    bin.reset();
    DataInputStream din = new DataInputStream(bin);
   
    times.readFields = System.nanoTime();
    for(int idx = 0; idx < numRecords; idx++) {
      records[idx].readFields(din);
View Full Code Here

        CertificateFactory cf = provider==null ?
                CertificateFactory.getInstance(type) :
                CertificateFactory.getInstance(type, provider);
       
        InputStream is = new ByteArrayInputStream(certificateString.getBytes("ASCII"));
        is.reset();
       
        return cf.generateCertificate(is);
    }
}
View Full Code Here

      });
      benchmark("Deserialize from memory stream", inputData.length, new Action() {
        public void execute() throws IOException {
          defaultMessage.newBuilderForType()
            .mergeFrom(CodedInputStream.newInstance(inputStream)).build();
          inputStream.reset();
        }
      });
      System.out.println();
      return true;
    } catch (Exception e) {
View Full Code Here

                    .getInputStream(manifestEntry);
            if (verifier != null) {
                byte[] buf = new byte[is.available()];
                is.mark(buf.length);
                is.read(buf, 0, buf.length);
                is.reset();
                verifier.addMetaEntry(manifestEntry.getName(), buf);
            }
            try {
                manifest = new Manifest(is, verifier != null);
            } finally {
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.