Package org.apache.nutch.tools
Class CommonCrawlFormatWARC
java.lang.Object
org.apache.nutch.tools.AbstractCommonCrawlFormat
org.apache.nutch.tools.CommonCrawlFormatWARC
- All Implemented Interfaces:
Closeable,AutoCloseable,CommonCrawlFormat
-
Field Summary
FieldsFields inherited from class org.apache.nutch.tools.AbstractCommonCrawlFormat
conf, content, inLinks, jsonArray, keyPrefix, LOG, metadata, reverseKey, reverseKeyValue, simpleDateFormat, url -
Constructor Summary
ConstructorsConstructorDescriptionCommonCrawlFormatWARC(String url, Content content, Metadata metadata, Configuration nutchConf, CommonCrawlConfig config, ParseData parseData) CommonCrawlFormatWARC(Configuration nutchConf, CommonCrawlConfig config) -
Method Summary
Modifier and TypeMethodDescriptionvoidclose()Optional method that could be implemented if the actual format needs some close procedure.protected voidcloseArray(String key, boolean nested, boolean newline) protected voidcloseObject(String key) protected StringGet a string representation of the JSON structure of the URL content.getJsonData(String url, Content content, Metadata metadata, ParseData parseData) Returns a string representation of the JSON structure of the URL content.protected voidstartArray(String key, boolean nested, boolean newline) protected voidstartObject(String key) protected voidwriteArrayValue(String value) protected voidwriteKeyNull(String key) protected voidwriteKeyValue(String key, String value) protected URIwriteRequest(URI id) protected URIMethods inherited from class org.apache.nutch.tools.AbstractCommonCrawlFormat
getImported, getInLinks, getJsonData, getKey, getMethod, getRequestAccept, getRequestAcceptEncoding, getRequestAcceptLanguage, getRequestContactEmail, getRequestContactName, getRequestHostAddress, getRequestHostName, getRequestRobots, getRequestSoftware, getRequestUserAgent, getResponseAddress, getResponseContent, getResponseContentEncoding, getResponseContentType, getResponseDate, getResponseHostName, getResponseServer, getResponseStatus, getTimestamp, getUrl, setInLinks
-
Field Details
-
MAX_WARC_FILE_SIZE
- See Also:
-
TEMPLATE
- See Also:
-
-
Constructor Details
-
CommonCrawlFormatWARC
- Throws:
IOException
-
CommonCrawlFormatWARC
public CommonCrawlFormatWARC(String url, Content content, Metadata metadata, Configuration nutchConf, CommonCrawlConfig config, ParseData parseData) throws IOException - Throws:
IOException
-
-
Method Details
-
getJsonData
public String getJsonData(String url, Content content, Metadata metadata, ParseData parseData) throws IOException Description copied from interface:CommonCrawlFormatReturns a string representation of the JSON structure of the URL content. Takes into consideration theContent,MetadataandParseData.- Specified by:
getJsonDatain interfaceCommonCrawlFormat- Overrides:
getJsonDatain classAbstractCommonCrawlFormat- Parameters:
url- the canonical urlcontent- urlContentmetadata- urlMetadataparseData- urlParseData- Returns:
- the JSON URL content string
- Throws:
IOException- if there is a fatal I/O error obtaining JSON data
-
getJsonData
Description copied from interface:CommonCrawlFormatGet a string representation of the JSON structure of the URL content.- Specified by:
getJsonDatain interfaceCommonCrawlFormat- Overrides:
getJsonDatain classAbstractCommonCrawlFormat- Returns:
- the JSON URL content string
- Throws:
IOException- if there is a fatal I/O error obtaining JSON data
-
writeResponse
- Throws:
IOExceptionParseException
-
writeRequest
- Throws:
IOExceptionParseException
-
generateJson
- Specified by:
generateJsonin classAbstractCommonCrawlFormat- Throws:
IOException
-
writeKeyValue
- Specified by:
writeKeyValuein classAbstractCommonCrawlFormat- Throws:
IOException
-
writeKeyNull
- Specified by:
writeKeyNullin classAbstractCommonCrawlFormat- Throws:
IOException
-
startArray
- Specified by:
startArrayin classAbstractCommonCrawlFormat- Throws:
IOException
-
closeArray
- Specified by:
closeArrayin classAbstractCommonCrawlFormat- Throws:
IOException
-
writeArrayValue
- Specified by:
writeArrayValuein classAbstractCommonCrawlFormat- Throws:
IOException
-
startObject
- Specified by:
startObjectin classAbstractCommonCrawlFormat- Throws:
IOException
-
closeObject
- Specified by:
closeObjectin classAbstractCommonCrawlFormat- Throws:
IOException
-
close
public void close()Description copied from interface:CommonCrawlFormatOptional method that could be implemented if the actual format needs some close procedure.- Specified by:
closein interfaceAutoCloseable- Specified by:
closein interfaceCloseable- Specified by:
closein interfaceCommonCrawlFormat- Overrides:
closein classAbstractCommonCrawlFormat
-