Examples of ReplayInputStream


Examples of com.volantis.testtools.io.ReplayInputStream

    public TestURLTestCase(String name) {
        super( name );
    }
   
    public void testURLConnection() throws Exception {
        InputStream dataIS = new ReplayInputStream(
                      new ByteArrayInputStream( "My Test Data".getBytes()) );
        TestURLRegistry.register( "replay", dataIS);
       
        URL url = new URL( "testurl:replay" );
        InputStream in = url.openStream();
View Full Code Here

Examples of com.volantis.testtools.io.ReplayInputStream

                .append( "user-agent: My little browser.\n\n" )
                .append( "<html>\n<body>\n<p>Hello World</p>\n</body>\n</html>\n" );
       
        System.out.println( "length is " + response.length() );
       
        InputStream dataIS = new ReplayInputStream(
                      new ByteArrayInputStream( response.toString().getBytes()) );
        TestURLRegistry.register( "replay", dataIS);
       
        URL url = new URL( "testurl:replay" );
        URLConnection conn = url.openConnection();
View Full Code Here

Examples of org.archive.io.ReplayInputStream

   * 3. Content - The HTTP response content, plus content-type.
   *
   * For more on this format, see '?'.
   */
  protected void writeMimeFile(CrawlURI curi) throws IOException {
      ReplayInputStream ris = null;
      OutputStream out = null;
               
      try {
          String boundary = BOUNDARY_START + stringToMD5(curi.toString());
          ris = curi.getRecorder().getRecordedInput().
              getReplayInputStream();
          out = initOutputStream(curi);
         
          // Part 1: Archive info
          writeArchiveInfoPart(boundary, curi, ris, out);

          // Part 2: Header info + HTTP header
          writeHeaderPart(boundary, ris, out);

          // Part 3: Content info + HTTP content
          writeContentPart(boundary, curi, ris, out);

          // And finally the terminator string
          String terminator = "\n--" + boundary + "--\n";
          out.write(terminator.getBytes());
      } finally {
          if (ris != null)
              ris.close();
          if (out != null)
              out.close();
      }
  }
View Full Code Here

Examples of org.archive.io.ReplayInputStream

        String ip = (String)curi.getData().get(A_DNS_SERVER_IP_LABEL);
        if (ip != null && ip.length() > 0) {
            recordInfo.addExtraHeader(HEADER_KEY_IP, ip);
        }
       
        ReplayInputStream ris =
            curi.getRecorder().getRecordedInput().getReplayInputStream();
        recordInfo.setContentStream(ris);
       
        try {
            w.writeRecord(recordInfo);
View Full Code Here

Examples of org.archive.io.ReplayInputStream

        Object whoisServerIP = curi.getData().get(CoreAttributeConstants.A_WHOIS_SERVER_IP);
        if (whoisServerIP != null) {
            recordInfo.addExtraHeader(HEADER_KEY_IP, whoisServerIP.toString());
        }
       
        ReplayInputStream ris =
            curi.getRecorder().getRecordedInput().getReplayInputStream();
        recordInfo.setContentStream(ris);
       
        try {
            w.writeRecord(recordInfo);
View Full Code Here

Examples of org.archive.io.ReplayInputStream

        recordInfo.setEnforceLength(true);
       
        final URI uid = qualifyRecordID(baseid, TYPE, WARCRecordType.request.toString());
        recordInfo.setRecordId(uid);
       
        ReplayInputStream
            ris = curi.getRecorder().getRecordedOutput().getReplayInputStream();
        recordInfo.setContentStream(ris);
       
        try {
            w.writeRecord(recordInfo);
View Full Code Here

Examples of org.archive.io.ReplayInputStream

        recordInfo.setRecordId(baseid);
        recordInfo.setExtraHeaders(namedFields);
        recordInfo.setContentLength(curi.getRecorder().getRecordedInput().getSize());
        recordInfo.setEnforceLength(true);
       
        ReplayInputStream ris =
            curi.getRecorder().getRecordedInput().getReplayInputStream();
        recordInfo.setContentStream(ris);
       
        try {
            w.writeRecord(recordInfo);
View Full Code Here

Examples of org.archive.io.ReplayInputStream

        recordInfo.setRecordId(baseid);
        recordInfo.setExtraHeaders(namedFields);
        recordInfo.setContentLength(curi.getRecorder().getRecordedInput().getSize());
        recordInfo.setEnforceLength(true);
       
        ReplayInputStream ris = curi.getRecorder().getRecordedInput().getReplayInputStream();
        recordInfo.setContentStream(ris);
        try {
            w.writeRecord(recordInfo);
        } finally {
            IOUtils.closeQuietly(ris);
View Full Code Here

Examples of org.archive.io.ReplayInputStream

          for ( String key : revisitHeaders.keySet()) {
              headers.addLabelValue(key, revisitHeaders.get(key));         
          }
        }
       
    ReplayInputStream ris = curi.getRecorder().getRecordedInput().getReplayInputStream();
    recordInfo.setContentStream(ris);

    try {
      w.writeRecord(recordInfo);
    } finally {
View Full Code Here

Examples of org.archive.io.ReplayInputStream

       the file rename fails
    */
    private void writeToPath(RecordingInputStream recis, File dest)
        throws IOException {
        File tf = new File (dest.getPath() + "N");
        ReplayInputStream replayis = null;
        FileOutputStream fos = null;
        try {
            replayis = recis.getMessageBodyReplayInputStream();
            fos = new FileOutputStream(tf);

            replayis.readFullyTo(fos);
        } finally {
            IOUtils.closeQuietly(replayis);
            IOUtils.closeQuietly(fos);
        }
        if (!tf.renameTo(dest)) {
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.