Package java.io

Examples of java.io.ByteArrayInputStream.reset()


            InputStream in = new ByteArrayInputStream(out.toByteArray());

            // should not cause SecurityException
            new ObjectInputStream(in);
            in.reset();

            // should not cause SecurityException
            new ObjectInputStream(in) {};
            in.reset();
View Full Code Here


            new ObjectInputStream(in);
            in.reset();

            // should not cause SecurityException
            new ObjectInputStream(in) {};
            in.reset();

            try {
                new ObjectInputStream(in) {
                    @Override
                    public Object readUnshared() throws IOException, ClassNotFoundException {
View Full Code Here

                fail("should throw SecurityException 1");
            } catch (SecurityException e) {
                // Expected
            }

            in.reset();
            try {
                new ObjectInputStream(in) {
                    @Override
                    public GetField readFields() throws IOException,
                            ClassNotFoundException, NotActiveException {
View Full Code Here

        long loop = 10000;

        long start = System.currentTimeMillis();
        for(int i=0;i<loop;i++) {
            b.recycle();
            bis.reset();
            p.parse(bis,wrapper);
        }
        long stop = System.currentTimeMillis();

        double r = 1000*loop/(stop-start);
 
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

        // the hash value of an input stream or byte array.

        ByteArrayInputStream dataIS = new ByteArrayInputStream(
            "Here is my data".getBytes(Constants.DEFAULT_ENCODING));
        byte[] md5Hash = ServiceUtils.computeMD5Hash(dataIS);
        dataIS.reset();       
               
        stringObject = new S3Object("MyData");
        stringObject.setDataInputStream(dataIS);
        stringObject.setMd5Hash(md5Hash);       
View Full Code Here

        // the hash value of an input stream or byte array.

        ByteArrayInputStream dataIS = new ByteArrayInputStream(
            "Here is my data".getBytes(Constants.DEFAULT_ENCODING));
        byte[] md5Hash = ServiceUtils.computeMD5Hash(dataIS);
        dataIS.reset();       
               
        stringObject = new S3Object("MyData");
        stringObject.setDataInputStream(dataIS);
        stringObject.setMd5Hash(md5Hash);       
View Full Code Here

      uctx.setDocument(baos, null, "UTF-8", false);
      T obj = type.cast(uctx.unmarshalElement());

      // Find out version
      XMLInputFactory factory = XMLInputFactory.newInstance();
      baos.reset();
      XMLStreamReader reader = factory.createXMLStreamReader(baos);
      Version version = Version.UNKNOWN;
      while (reader.hasNext())
      {
         int next = reader.next();
View Full Code Here

                ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
                byte[] decodedData = Predictor.decodePredictor(predictor, colors, bitsPerPixel, columns, bais);
                result.write(decodedData);
                result.flush();
                baos.reset();
                bais.reset();
            }
            else
            {
                decompress(compressedData, result);
            }
View Full Code Here

            ByteArrayInputStream bais = new ByteArrayInputStream(baos.toByteArray());
            byte[] decodedData = Predictor.decodePredictor(predictor, colors, bitsPerPixel, columns, bais);
            result.write(decodedData);
            result.flush();
            baos.reset();
            bais.reset();
        }
        else
        {
            doLZWDecode(compressedData, result);
        }
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.