Package dk.netarkivet.common.utils.cdx
Class CDXRecord
- java.lang.Object
-
- dk.netarkivet.common.utils.cdx.CDXRecord
-
public class CDXRecord extends Object
Represents a line i a CDX-file. A CDX-file is an index over arcfiles, with fields for uri, ip, date, mimetype, length, arcfile, and offset in the file.
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description String
getArcfile()
Get the given arcfile.String
getDate()
Get the given date.String
getIP()
Get the given IP.long
getLength()
Get the given length.String
getMimetype()
Get the given mimetype.long
getOffset()
Get the given offset.String
getURL()
Get the given URL.static boolean
URLsEqual(String url1, String url2)
Compare two URLs for equality; first URL-unescaping (in UTF-8) all arguments in any query part.
-
-
-
Constructor Detail
-
CDXRecord
public CDXRecord(String[] fields)
Constructor for class CDXRecord.- Parameters:
fields
- the given fields of a line i CDX-format.- Throws:
ArgumentNotValid
- if argument is null or number of fields is less than 7 or if length or offset does not contain long values.
-
CDXRecord
public CDXRecord(String line)
Constructor, which tries to parse the given string as a CDXRecord.- Parameters:
line
- a CDXline
-
-
Method Detail
-
URLsEqual
public static boolean URLsEqual(String url1, String url2)
Compare two URLs for equality; first URL-unescaping (in UTF-8) all arguments in any query part.- Parameters:
url1
- The first URLurl2
- The second URL- Returns:
- A boolean indicating whether the URLs are equal
-
getURL
public String getURL()
Get the given URL.- Returns:
- the URL
-
getIP
public String getIP()
Get the given IP.- Returns:
- the IP
-
getDate
public String getDate()
Get the given date.- Returns:
- the date
-
getMimetype
public String getMimetype()
Get the given mimetype.- Returns:
- The given mimetype
-
getLength
public long getLength()
Get the given length.- Returns:
- The given length
-
getArcfile
public String getArcfile()
Get the given arcfile.- Returns:
- The given arcfile
-
getOffset
public long getOffset()
Get the given offset.- Returns:
- The given offset
-
-