ByteArrayOutputStream baos = new ByteArrayOutputStream((int)firstRecord.getHeader(). getLength()); firstRecord.dump(baos);
long length = r.getHeader().getLength(); int offset = r.getHeader().getContentBegin();
recordInfo.setUrl(r.getHeader().getUrl()); recordInfo.setContentStream(r); recordInfo.setContentLength(r.getHeader().getLength()); recordInfo.setEnforceLength(true);
/** * This available is not the stream's available. Its an available based on * what the stated Archive record length is minus what we've read to date. * * @return True if bytes remaining in record content. */ public int available() { long amount = getHeader().getLength() - getPosition(); return (amount > Integer.MAX_VALUE? Integer.MAX_VALUE: (int)amount); }
/** * This available is not the stream's available. Its an available based on * what the stated Archive record length is minus what we've read to date. * * @return True if bytes remaining in record content. */ public int available() { long amount = getHeader().getLength() - getPosition(); return (amount > Integer.MAX_VALUE? Integer.MAX_VALUE: (int)amount); }
/** * This available is not the stream's available. Its an available based on * what the stated Archive record length is minus what we've read to date. * * @return True if bytes remaining in record content. */ public int available() { long amount = getHeader().getLength() - getPosition(); return (amount > Integer.MAX_VALUE? Integer.MAX_VALUE: (int)amount); }
protected String outputCdx(final String strippedFileName) throws IOException { // Read the whole record so we get out a hash. Should be safe calling // close on already closed Record. close(); ArchiveRecordHeader h = getHeader(); StringBuilder buffer = new StringBuilder(ArchiveFileConstants.CDX_LINE_BUFFER_SIZE); buffer.append(h.getDate()); buffer.append(ArchiveFileConstants.SINGLE_SPACE); buffer.append(getIp4Cdx(h)); buffer.append(ArchiveFileConstants.SINGLE_SPACE); buffer.append(h.getUrl()); buffer.append(ArchiveFileConstants.SINGLE_SPACE); buffer.append(getMimetype4Cdx(h)); buffer.append(ArchiveFileConstants.SINGLE_SPACE); buffer.append(getStatusCode4Cdx(h)); buffer.append(ArchiveFileConstants.SINGLE_SPACE); buffer.append(getDigest4Cdx(h)); buffer.append(ArchiveFileConstants.SINGLE_SPACE); buffer.append(h.getOffset()); buffer.append(ArchiveFileConstants.SINGLE_SPACE); buffer.append(h.getLength()); buffer.append(ArchiveFileConstants.SINGLE_SPACE); buffer.append(strippedFileName != null? strippedFileName: '-'); return buffer.toString(); }
/** * Is it likely that this record contains headers? * This method will return true if the body is a http response that includes * http response headers or the body is a http request that includes request * headers, etc. Be aware that headers in content are distinct from * {@link ArchiveRecordHeader} 'headers'. * @return True if this Record's content has headers: */ public boolean hasContentHeaders() { final String url = getHeader().getUrl(); if (url == null) { return false; } if (!url.toLowerCase().startsWith("http")) { return false; } if (getHeader().getLength() <= MIN_HTTP_HEADER_LENGTH) { return false; } return true; }
protected String outputCdx(final String strippedFileName) throws IOException { // Read the whole record so we get out a hash. Should be safe calling // close on already closed Record. close(); ArchiveRecordHeader h = getHeader(); StringBuilder buffer = new StringBuilder(ArchiveFileConstants.CDX_LINE_BUFFER_SIZE); buffer.append(h.getDate()); buffer.append(ArchiveFileConstants.SINGLE_SPACE); buffer.append(getIp4Cdx(h)); buffer.append(ArchiveFileConstants.SINGLE_SPACE); buffer.append(h.getUrl()); buffer.append(ArchiveFileConstants.SINGLE_SPACE); buffer.append(getMimetype4Cdx(h)); buffer.append(ArchiveFileConstants.SINGLE_SPACE); buffer.append(getStatusCode4Cdx(h)); buffer.append(ArchiveFileConstants.SINGLE_SPACE); buffer.append(getDigest4Cdx(h)); buffer.append(ArchiveFileConstants.SINGLE_SPACE); buffer.append(h.getOffset()); buffer.append(ArchiveFileConstants.SINGLE_SPACE); buffer.append(h.getLength()); buffer.append(ArchiveFileConstants.SINGLE_SPACE); buffer.append(strippedFileName != null? strippedFileName: '-'); return buffer.toString(); }
/** * Is it likely that this record contains headers? * This method will return true if the body is a http response that includes * http response headers or the body is a http request that includes request * headers, etc. Be aware that headers in content are distinct from * {@link ArchiveRecordHeader} 'headers'. * @return True if this Record's content has headers: */ public boolean hasContentHeaders() { final String url = getHeader().getUrl(); if (url == null) { return false; } if (!url.toLowerCase().startsWith("http")) { return false; } if (getHeader().getLength() <= MIN_HTTP_HEADER_LENGTH) { return false; } return true; }
/** * Is it likely that this record contains headers? * This method will return true if the body is a http response that includes * http response headers or the body is a http request that includes request * headers, etc. Be aware that headers in content are distinct from * {@link ArchiveRecordHeader} 'headers'. * @return True if this Record's content has headers: */ public boolean hasContentHeaders() { final String url = getHeader().getUrl(); if (url == null) { return false; } if (!url.toLowerCase().startsWith("http")) { return false; } if (getHeader().getLength() <= MIN_HTTP_HEADER_LENGTH) { return false; } return true; }
protected String outputCdx(final String strippedFileName) throws IOException { // Read the whole record so we get out a hash. Should be safe calling // close on already closed Record. close(); ArchiveRecordHeader h = getHeader(); StringBuilder buffer = new StringBuilder(ArchiveFileConstants.CDX_LINE_BUFFER_SIZE); buffer.append(h.getDate()); buffer.append(ArchiveFileConstants.SINGLE_SPACE); buffer.append(getIp4Cdx(h)); buffer.append(ArchiveFileConstants.SINGLE_SPACE); buffer.append(h.getUrl()); buffer.append(ArchiveFileConstants.SINGLE_SPACE); buffer.append(getMimetype4Cdx(h)); buffer.append(ArchiveFileConstants.SINGLE_SPACE); buffer.append(getStatusCode4Cdx(h)); buffer.append(ArchiveFileConstants.SINGLE_SPACE); buffer.append(getDigest4Cdx(h)); buffer.append(ArchiveFileConstants.SINGLE_SPACE); buffer.append(h.getOffset()); buffer.append(ArchiveFileConstants.SINGLE_SPACE); buffer.append(h.getLength()); buffer.append(ArchiveFileConstants.SINGLE_SPACE); buffer.append(strippedFileName != null? strippedFileName: '-'); return buffer.toString(); }
recordCount++; ArchiveRecord r = i.next(); if (r.getHeader().getLength() <= 0 && r.getHeader().getMimetype(). equals(MimetypeUtils.NO_TYPE_MIMETYPE)) {
recordCount++; ArchiveRecord r = i.next(); if (r.getHeader().getLength() <= 0 && r.getHeader().getMimetype(). equals(MimetypeUtils.NO_TYPE_MIMETYPE)) {
recordCount++; ArchiveRecord r = i.next(); if (r.getHeader().getLength() <= 0 && r.getHeader().getMimetype(). equals(MimetypeUtils.NO_TYPE_MIMETYPE)) {
"+"+record.available()+","+header.getLength()+ ": "+header.getUrl()); for( String h : header.getHeaderFields().keySet()) {
"+"+record.available()+","+header.getLength()+ ": "+header.getUrl()); for( String h : header.getHeaderFields().keySet()) {
if( header.getLength() > max_size_bytes ) { return;
long length = r.getHeader().getLength(); int offset = r.getHeader().getContentBegin();
recordInfo.setUrl(r.getHeader().getUrl()); recordInfo.setContentStream(r); recordInfo.setContentLength(r.getHeader().getLength()); recordInfo.setEnforceLength(true);