Package java.io

Examples of java.io.BufferedInputStream.reset()


  public void test_reset_Exception() throws IOException {
    BufferedInputStream bis = new BufferedInputStream(null);
   
    //throws IOExcepiton with message "Mark has been invalidated"
    try {
      bis.reset();
      fail("should throw IOException");
    } catch (IOException e) {
      // expected
    }
   
View Full Code Here


      // expected
    }
   
    //does not throw IOException
    bis.mark(1);
    bis.reset();
   
    bis.close();

    //throws IOException with message "stream is closed"
    try {
View Full Code Here

   
    bis.close();

    //throws IOException with message "stream is closed"
    try {
      bis.reset();
      fail("should throw IOException");
    } catch (IOException e) {
      // expected
    }
  }
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) {
                    DocumentBuilder docBuilder = DomUtil.BUILDER_FACTORY.newDocumentBuilder();
                    requestDocument = docBuilder.parse(bin);
                }
            }
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

                            return pos - patternPos;
                        }
                        patternPos++;
                    } else {
                        if (patternPos > 0) {
                            in.reset();
                            pos -= patternPos;
                        }
                    }
                    pos++;
                }
View Full Code Here

        conn.setRequestProperty("Icy-Metadata", "1");
        BufferedInputStream bInputStream = new BufferedInputStream(conn.getInputStream());
        bInputStream.mark(toRead);
        int read = bInputStream.read(head, 0, toRead);
        if ((read > 2) && (((head[0] == 'I') | (head[0] == 'i')) && ((head[1] == 'C') | (head[1] == 'c')) && ((head[2] == 'Y') | (head[2] == 'y')))) isShout = true;
        bInputStream.reset();
        InputStream inputStream = null;
        // Is is a shoutcast server ?
        if (isShout == true)
        {
            // Yes
View Full Code Here

        byte[] headerBytes = new byte[HEADER_LEN];
        int actualRead = bufferedIn.read(headerBytes, 0, HEADER_LEN);
        if (actualRead != -1) {
          String header = new String(headerBytes);
          if (header.compareTo(HEADER) != 0) {
            bufferedIn.reset();
          }
        }
      }

      if (bufferedIn == null) {
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) {
                    DocumentBuilder docBuilder = BUILDER_FACTORY.newDocumentBuilder();
                    requestDocument = docBuilder.parse(bin);
                }
            }
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) {
                    DocumentBuilder docBuilder = DomUtil.BUILDER_FACTORY.newDocumentBuilder();
                    requestDocument = docBuilder.parse(bin);
                }
            }
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.