package org.archive.util.binsearch.impl;
import java.io.IOException;
import org.archive.util.binsearch.SeekableLineReader;
public abstract class HTTPSeekableLineReader extends SeekableLineReader {
public static class BadHttpStatusException extends IOException
{
/**
*
*/
private static final long serialVersionUID = 1L;
int status;
public BadHttpStatusException(int status, String details)
{
super("Http Status " + status + " returned: " + details);
this.status = status;
}
public int getStatus()
{
return status;
}
}
public final static String CONTENT_LENGTH = "Content-Length";
public final static String LAST_MODIFIED = "Last-Modified";
public abstract String getUrl();
public abstract long getSize() throws IOException;
public abstract void setNoKeepAlive(boolean noKeepAlive);
public abstract String getHeaderValue(String headerName);
public String makeRangeHeader(long offset, int maxLength)
{
StringBuilder builder = new StringBuilder(32);
builder.append("bytes=");
builder.append(offset);
builder.append('-');
long endOffset = -1;
if (maxLength > 0) {
endOffset = (offset + maxLength) - 1;
builder.append(endOffset);
}
return builder.toString();
}
}