Package org.cdlib.mrt.utility
Class HttpGetNew
java.lang.Object
org.cdlib.mrt.utility.HttpGetNew
- Author:
- dloy This routine is specifically designed to handle dropped connections during an http request
-
Field Summary
FieldsModifier and TypeFieldDescriptionprotected static final intprotected URLprotected longprotected HTTPGetUtilstatic final longprotected static final Stringprotected static final Stringprotected Filestatic final longprotected long -
Constructor Summary
ConstructorsConstructorDescriptionHttpGetNew(URL contentURL, File outFile, long testSize, HTTPGetUtil httpGetUtil) -
Method Summary
Modifier and TypeMethodDescriptionvoidbuild()voidbuildContentLength(HttpResponse<InputStream> response, long contentLength) This routine will perform multiple calls to fix broken connection when content-length existsprotected voidbuildNoContentLength(HttpResponse<InputStream> response) This routine is called only when Content-Length not provided on GET responsestatic voidgetFile(URL contentURL, File outFile, long testLength, HTTPGetUtil httpGetUtil) static voidgetFile(URL contentURL, File outFile, HTTPGetUtil httpGetUtil) static HttpGetNewgetHttpGet(URL contentURL, File outFile, long testSize, HTTPGetUtil httpGetUtil) static voidstream2File(InputStream inStream, File outFile, boolean append) Create a file from a streamurl2Stream(String urlS, long startByte, long endByte)
-
Field Details
-
NAME
- See Also:
-
MESSAGE
- See Also:
-
BUFSIZE
protected static final int BUFSIZE- See Also:
-
SEGMENT
public static final long SEGMENT- See Also:
-
MAX_RETRY
public static final long MAX_RETRY- See Also:
-
testLength
protected long testLength -
headerContentLength
protected long headerContentLength -
contentURL
-
outFile
-
httpGetUtil
-
-
Constructor Details
-
HttpGetNew
public HttpGetNew(URL contentURL, File outFile, long testSize, HTTPGetUtil httpGetUtil) throws TException - Throws:
TException
-
-
Method Details
-
getFile
- Throws:
TException
-
getFile
public static void getFile(URL contentURL, File outFile, long testLength, HTTPGetUtil httpGetUtil) throws TException - Throws:
TException
-
getHttpGet
public static HttpGetNew getHttpGet(URL contentURL, File outFile, long testSize, HTTPGetUtil httpGetUtil) throws TException - Throws:
TException
-
build
- Throws:
TException
-
buildContentLength
public void buildContentLength(HttpResponse<InputStream> response, long contentLength) throws TException This routine will perform multiple calls to fix broken connection when content-length exists- Parameters:
entity- response entity- Throws:
TException
-
buildNoContentLength
This routine is called only when Content-Length not provided on GET response- Parameters:
entity- response entity- Throws:
TException
-
stream2File
public static void stream2File(InputStream inStream, File outFile, boolean append) throws TException Create a file from a stream- Parameters:
inStream- stream used to create fileoutFile- file to createappend- true=append to outFile
-
url2Stream
- Throws:
TException
-