Package java.io

Examples of java.io.BufferedInputStream.mark()


  public InputCapture<? extends CapturePacket> newInput(final File file,
      final Filter<ProtocolFilterTarget> filter) throws IOException {

    final BufferedInputStream b =
        new BufferedInputStream(new FileInputStream(file));
    b.mark(1024); // Buffer first 1K of stream so we can rewind

    /*
     * Check the stream, without decompression first
     */
    if (formatType(Channels.newChannel(b)) != null) {
View Full Code Here


    InputStream inS = openStream(link, properties);
    try {

      /* Buffered Stream to support mark and reset */
      BufferedInputStream bufIns = new BufferedInputStream(inS);
      bufIns.mark(8192);

      /* Try to read Encoding out of XML Document */
      String encoding = getEncodingFromXML(new InputStreamReader(bufIns));

      /* Avoid lowercase UTF-8 notation */
 
View Full Code Here

    InputStream inS = openStream(link, null);
    try {

      /* Buffered Stream to support mark and reset */
      BufferedInputStream bufIns = new BufferedInputStream(inS);
      bufIns.mark(8192);

      /* Try to read Encoding out of XML Document */
      String encoding = getEncodingFromXML(new InputStreamReader(bufIns));

      /* Avoid lowercase UTF-8 notation */
 
View Full Code Here

            InputStream in = httpRequest.getInputStream();
            if (in != null) {
                // 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);
                }
View Full Code Here

        InputStream in = null;
        try
        {
            in = loc.toURL().openStream();
            BufferedInputStream bis = new BufferedInputStream(in);
            bis.mark(MAX_HEADER);
            readHeader(bis);
            bis.reset();

            Properties p = new Properties();
            p.load(bis);
View Full Code Here

        long nextPos = 0;
        String chunkOfLastLine = null;
        int attemptCount = 0;
        String s = "";
        while (attemptCount < MAX_ATTEMPT_COUNT) {
            in.mark(FOUR_KB + (int) nextPos);
            if (nextPos > 0) {
                long skipped = in.skip(nextPos);
                if (skipped != nextPos) {
                    break;
                }
View Full Code Here

        final Hashtable<String, Object> ht = new Hashtable<String, Object>();
        final BufferedInputStream in = new BufferedInputStream(is);
        try {
            if ( !extension.equals("config") ) {
                final Properties p = new Properties();
                in.mark(1);
                boolean isXml = in.read() == '<';
                in.reset();
                if (isXml) {
                    p.loadFromXML(in);
                } else {
View Full Code Here

                    final Object key = i.nextElement();
                    ht.put(key.toString(), p.get(key));
                }
            } else {
                // check for initial comment line
                in.mark(256);
                final int firstChar = in.read();
                if ( firstChar == '#' ) {
                    int b;
                    while ((b = in.read()) != '\n' ) {
                        if ( b == -1 ) {
View Full Code Here

    public static final int TEST_COMPRESSED_SIZE = 10 * 1024;
    private InputStream in;

    public TryInflaterInputStream(InputStream in) throws IOException {
        BufferedInputStream bufferedIn = new BufferedInputStream(in, TEST_COMPRESSED_SIZE);
        bufferedIn.mark(TEST_COMPRESSED_SIZE);
        try {
            InflaterInputStream testCompressedIn = new InflaterInputStream(bufferedIn);
            byte[] temp = new byte[TEST_COMPRESSED_SIZE / 10];
            testCompressedIn.read(temp);

View Full Code Here

            throw new NullPointerException("No password supplied for PKCS#12 KeyStore.");
        }

        BufferedInputStream bufIn = new BufferedInputStream(stream);

        bufIn.mark(10);

        int head = bufIn.read();

        if (head != 0x30)
        {
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.