Package java.io

Examples of java.io.BufferedInputStream.reset()


        bis.close();

        // throws IOException with message "stream is closed"
        try {
            bis.reset();
            fail("should throw IOException");
        } catch (IOException e) {
            // expected
        }
    }
View Full Code Here


                os.write(lineFeed);
                os.flush();
                readAck(is, false);

                // now send the stream
                buffer.reset();
                while ((read = buffer.read(reply)) != -1) {
                    os.write(reply, 0, read);
                }
                writeAck(os);
                readAck(is, false);
View Full Code Here

                // use a buffered input stream to find out whether there actually
                // is a request body
                InputStream bin = new BufferedInputStream(in);
                bin.mark(1);
                boolean isEmpty = -1 == bin.read();
                bin.reset();
                if (!isEmpty) {
                    requestDocument = DomUtil.parseDocument(bin);
                }
            }
        } catch (IOException e) {
View Full Code Here

        in.mark(100);
        for (int i = 0; i < 10; i++) {
            assertEquals(0, in.read());
        }
        assertEquals(-1, in.read());
        in.reset();
        for (int i = 0; i < 10; i++) {
            assertEquals(0, in.read());
        }
        assertEquals(-1, in.read());
        in.close();
View Full Code Here

        if (head != 0x30)
        {
            throw new IOException("stream does not represent a PKCS12 key store");
        }

        bufIn.reset();

        ASN1InputStream bIn = new ASN1InputStream(bufIn);
        ASN1Sequence    obj = (ASN1Sequence)bIn.readObject();
        Pfx             bag = new Pfx(obj);
        ContentInfo     info = bag.getAuthSafe();
View Full Code Here

                    // is it  big-endian or little-endian?
                    in.mark(2);
                    int first = in.read();
                    if (first == 0xFF) encoding = "UnicodeLittle";
                    else encoding="UnicodeBig";
                    in.reset()
                }
                else if (encoding.equalsIgnoreCase("UnicodeBigUnmarked")) {
                    encoding = "UnicodeBig";
                }
                else if (encoding.equalsIgnoreCase("UnicodeLittleUnmarked")) {
View Full Code Here

            {
                enc = decl.substring(off + key.length(), decl.indexOf('"', off + key.length()));
            }
        }
        //Reset the bytes read
        is.reset();
        Reader rdr = new InputStreamReader(is, enc);
        return rdr;
    }   
   
    public Document getDocument(String url)
View Full Code Here

        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) {
      fail("Exception during mark test 2");
    }
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

          new ByteArrayInputStream("1234567890".getBytes()));
      bIn.mark(10);
      for (int i = 0; i < 11; i++) {
        bIn.read();
      }
      bIn.reset();

    } catch (IOException e) {
      fail("Exception during reset test");
    }
  }
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.