public class EepHead extends EepGet
EepHead foo = new EepHead(...); if (foo.fetch()) { String lastmod = foo.getLastModified(); if (lastmod != null) { parse the string... ... } }Other use cases (command line, listeners, etc...) lightly- or un-tested. Note that this follows redirects! This may not be what you want or expect. Writing from scratch rather than extending EepGet would maybe have been less bloated memory-wise. This way gets us redirect handling, among other benefits.
EepGet.AUTH_MODE, EepGet.AuthState, EepGet.CLIStatusListener, EepGet.Gunzipper, EepGet.StatusListener
Modifier and Type | Field and Description |
---|---|
(package private) static OutputStream |
_dummyStream
EepGet needs either a non-null file or a stream...
|
_aborted, _actualURL, _alreadyTransferred, _authState, _bytesRemaining, _bytesTransferred, _contentType, _context, _currentAttempt, _decompressException, _encodingChunked, _etag, _etagOrig, _extraHeaders, _fetchHeaderTimeout, _fetchInactivityTimeout, _headersRead, _isGzippedResponse, _keepFetching, _lastModified, _lastModifiedOrig, _listeners, _log, _notModified, _numRetries, _out, _outputFile, _outputStream, _proxy, _proxyIn, _proxyOut, _redirectLocation, _redirects, _responseCode, _responseText, _shouldProxy, _shouldWriteErrorToOutput, _transferFailed, _url, CONNECT_TIMEOUT, INACTIVITY_TIMEOUT, MAX_COMPLETE_FAILS, USER_AGENT
Constructor and Description |
---|
EepHead(I2PAppContext ctx,
String proxyHost,
int proxyPort,
int numRetries,
String url) |
Modifier and Type | Method and Description |
---|---|
protected void |
doFetch(SocketTimeout timeout)
return true if the URL was completely retrieved
|
long |
getContentLength()
We don't decrement the variable (unlike in EepGet), so this is valid
|
protected String |
getRequest() |
static void |
main(String[] args)
EepHead [-p 127.0.0.1:4444] [-n #retries] url
This doesn't really do much since it doesn't register a listener.
|
addAuthorization, addHeader, addStatusListener, fetch, fetch, fetch, getContentType, getETag, getLastModified, getNotModified, getStatusCode, getStatusText, parseAuthArgs, readChunkLength, readHeaders, sendRequest, setWriteErrorToOutput, stopFetching, suggestName
static final OutputStream _dummyStream
public EepHead(I2PAppContext ctx, String proxyHost, int proxyPort, int numRetries, String url)
public static void main(String[] args)
protected void doFetch(SocketTimeout timeout) throws IOException
doFetch
in class EepGet
timeout
- may be nullIOException
protected String getRequest() throws IOException
getRequest
in class EepGet
IOException
public long getContentLength()