public HttpRequest(HttpRequestMessage message, byte[] originalHeaders) throws IOException { this.originalHeaders = originalHeaders; this.message = message; // If we want to keep the headers - we're not using them: ByteArrayInputStream bais = new ByteArrayInputStream(originalHeaders); headers = ANVLRecord.load(bais); }
public HttpRequest(HttpRequestMessage message, byte[] originalHeaders) throws IOException { this.originalHeaders = originalHeaders; this.message = message; // If we want to keep the headers - we're not using them: ByteArrayInputStream bais = new ByteArrayInputStream(originalHeaders); headers = ANVLRecord.load(bais); }
public static HttpResponse load(InputStream in) throws BadRequestException, IOException { HttpResponseMessage message = HttpMessage.loadResponse(in); ANVLRecord headers = ANVLRecord.load(in); return new HttpResponse(message,headers,in); } }
private void writeHeaderRecord(File target, File fieldsSrc, String id) throws IOException { WARCWriter writer = null; BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(target)); FileInputStream is = new FileInputStream(fieldsSrc); ANVLRecord ar = ANVLRecord.load(is); List<String> metadata = new ArrayList<String>(1); metadata.add(ar.toString()); writer = new WARCWriter(new AtomicInteger(),bos,target,getSettings(true, null, null, metadata)); // Write a warcinfo record with description about how this WARC // was made. writer.writeWarcinfoRecord(target.getName(), "Made from " + id + " by " + this.getClass().getName()); } private WARCWriterPoolSettings getSettings(final boolean isCompressed,
public static HttpResponse load(InputStream in) throws BadRequestException, IOException { HttpResponseMessage message = HttpMessage.loadResponse(in); ANVLRecord headers = ANVLRecord.load(in); return new HttpResponse(message,headers,in); } }
private void writeHeaderRecord(File target, File fieldsSrc, String id) throws IOException { WARCWriter writer = null; BufferedOutputStream bos = new BufferedOutputStream(new FileOutputStream(target)); FileInputStream is = new FileInputStream(fieldsSrc); ANVLRecord ar = ANVLRecord.load(is); List<String> metadata = new ArrayList<String>(1); metadata.add(ar.toString()); writer = new WARCWriter(new AtomicInteger(),bos,target,getSettings(true, null, null, metadata)); // Write a warcinfo record with description about how this WARC // was made. writer.writeWarcinfoRecord(target.getName(), "Made from " + id + " by " + this.getClass().getName()); } private WARCWriterPoolSettings getSettings(final boolean isCompressed,
return load(new String(baos.toByteArray(), UTF8));
return load(new String(baos.toByteArray(), UTF8));
return load(new String(baos.toByteArray(), UTF8));