Package java.io

Examples of java.io.InputStream.available()


        line = br.readLine();
        assertEquals(ERR, line);
        assertNull(br.readLine());
        br.close();
        InputStream is = rbc.getOutput();
        assertTrue(is.available() > 0);
        is.close();
        is = rbc.getError();
        assertTrue(is.available() > 0);
        is.close();
    }
View Full Code Here


        br.close();
        InputStream is = rbc.getOutput();
        assertTrue(is.available() > 0);
        is.close();
        is = rbc.getError();
        assertTrue(is.available() > 0);
        is.close();
    }

}
View Full Code Here

    private NtlmMessage attemptNegotiation(int response) throws IOException {
        authProperty = null;
        method = null;
        InputStream errorStream = connection.getErrorStream();
        if (errorStream != null && errorStream.available() != 0) {
            int count;
            byte[] buf = new byte[1024];
            while ((count = errorStream.read(buf, 0, 1024)) != -1);
        }
        String authHeader;
View Full Code Here

    super.tearDown();
  }

  public void testExtractTextFromHtml() throws Exception{
    InputStream is = TestFormatUtil.class.getResourceAsStream("/TestFormatUtil-dummyhtml.html");
    int x = is.available();
    byte b[] = new byte[x];
    is.read(b);
    String content = new String(b);
 
    String text = FormatUtil.extractTextFromHtml(content);
View Full Code Here

    assertFalse(text.contains("<HTML>"));
  }
 
  public void testTidyHTML() throws Exception{
    InputStream is = TestFormatUtil.class.getResourceAsStream("/TestFormatUtil-badhtml.html");
    int x = is.available();
    byte b[] = new byte[x];
    is.read(b);
    String content = new String(b)
    String text = FormatUtil.tidyHTML(content, true,"utf8");
    assertFalse(text.contains("<HTML>"));
View Full Code Here

    assertTrue(text.contains("</script>"));
  }
 
  public void testRemoveAbusiveTags() throws Exception{
    InputStream is = TestFormatUtil.class.getResourceAsStream("/TestFormatUtil-badhtml.html");
    int x = is.available();
    byte b[] = new byte[x];
    is.read(b);
    String content = new String(b)
    String text = FormatUtil.tidyHTML(content, true,"utf8");
    text = FormatUtil.removeAbusiveTags(text);
View Full Code Here

            }

            FileOutputStream out = new FileOutputStream(outPutFile);

            byte data[] = new byte[1024];
            while (file.available() > 0) {
                int size = file.read(data);
                out.write(data, 0, size);
            }

            file.close();
View Full Code Here

      for (URL resource : resources) {
        URLConnection resourceConn = resource.openConnection();
        InputStream in = resourceConn.getInputStream();
        try {
          byte[] buffer = new byte[1024];
          while (in.available() > 0) {
            int len = in.read(buffer);
            out.write(buffer, 0, len);
          }
        } finally {
          in.close();
View Full Code Here

      for (URL resource : resources) {
        URLConnection resourceConn = resource.openConnection();
        InputStream in = resourceConn.getInputStream();
        try {
          byte[] buffer = new byte[1024];
          while (in.available() > 0) {
            int len = in.read(buffer);
            out.write(buffer, 0, len);
          }
        } finally {
          in.close();
View Full Code Here

    }
    String acceptValue = req.getHeader("Accept");
    if (acceptValue != null && acceptValue.contains("application/xrds+xml"))
    {
      InputStream is = context.getResourceAsStream("/WEB-INF/discovery.xml");
      byte[] buffer =  new byte[is.available()];
      is.read(buffer, 0, is.available());
      resp.setContentType("application/xrds+xml");
      resp.getOutputStream().write(buffer);
      resp.getOutputStream().flush();
      return;
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.