id int32 0 165k | repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 |
|---|---|---|---|---|---|---|---|---|---|---|---|
120,700 | JavaMoney/jsr354-ri | moneta-core/src/main/java/org/javamoney/moneta/function/MonetaryFunctions.java | MonetaryFunctions.groupBySummarizingMonetary | public static Collector<MonetaryAmount,GroupMonetarySummaryStatistics,GroupMonetarySummaryStatistics>
groupBySummarizingMonetary(){
return Collector.of(GroupMonetarySummaryStatistics::new, GroupMonetarySummaryStatistics::accept,
GroupMonetarySummaryStatistics::combine);
} | java | public static Collector<MonetaryAmount,GroupMonetarySummaryStatistics,GroupMonetarySummaryStatistics>
groupBySummarizingMonetary(){
return Collector.of(GroupMonetarySummaryStatistics::new, GroupMonetarySummaryStatistics::accept,
GroupMonetarySummaryStatistics::combine);
} | [
"public",
"static",
"Collector",
"<",
"MonetaryAmount",
",",
"GroupMonetarySummaryStatistics",
",",
"GroupMonetarySummaryStatistics",
">",
"groupBySummarizingMonetary",
"(",
")",
"{",
"return",
"Collector",
".",
"of",
"(",
"GroupMonetarySummaryStatistics",
"::",
"new",
",... | of MonetaryAmount group by MonetarySummary
@return the MonetarySummaryStatistics | [
"of",
"MonetaryAmount",
"group",
"by",
"MonetarySummary"
] | cf8ff2bbaf9b115acc05eb9b0c76c8397c308284 | https://github.com/JavaMoney/jsr354-ri/blob/cf8ff2bbaf9b115acc05eb9b0c76c8397c308284/moneta-core/src/main/java/org/javamoney/moneta/function/MonetaryFunctions.java#L87-L91 |
120,701 | JavaMoney/jsr354-ri | moneta-core/src/main/java/org/javamoney/moneta/function/MonetaryFunctions.java | MonetaryFunctions.isBetween | public static Predicate<MonetaryAmount> isBetween(MonetaryAmount min, MonetaryAmount max){
return isLessThanOrEqualTo(max).and(isGreaterThanOrEqualTo(min));
} | java | public static Predicate<MonetaryAmount> isBetween(MonetaryAmount min, MonetaryAmount max){
return isLessThanOrEqualTo(max).and(isGreaterThanOrEqualTo(min));
} | [
"public",
"static",
"Predicate",
"<",
"MonetaryAmount",
">",
"isBetween",
"(",
"MonetaryAmount",
"min",
",",
"MonetaryAmount",
"max",
")",
"{",
"return",
"isLessThanOrEqualTo",
"(",
"max",
")",
".",
"and",
"(",
"isGreaterThanOrEqualTo",
"(",
"min",
")",
")",
"... | Creates a filter using the isBetween predicate.
@param min min value inclusive, not null.
@param max max value inclusive, not null.
@return the Predicate between min and max. | [
"Creates",
"a",
"filter",
"using",
"the",
"isBetween",
"predicate",
"."
] | cf8ff2bbaf9b115acc05eb9b0c76c8397c308284 | https://github.com/JavaMoney/jsr354-ri/blob/cf8ff2bbaf9b115acc05eb9b0c76c8397c308284/moneta-core/src/main/java/org/javamoney/moneta/function/MonetaryFunctions.java#L261-L263 |
120,702 | JavaMoney/jsr354-ri | moneta-core/src/main/java/org/javamoney/moneta/function/MonetaryFunctions.java | MonetaryFunctions.sum | public static MonetaryAmount sum(MonetaryAmount a, MonetaryAmount b){
MoneyUtils.checkAmountParameter(Objects.requireNonNull(a), Objects.requireNonNull(b.getCurrency()));
return a.add(b);
} | java | public static MonetaryAmount sum(MonetaryAmount a, MonetaryAmount b){
MoneyUtils.checkAmountParameter(Objects.requireNonNull(a), Objects.requireNonNull(b.getCurrency()));
return a.add(b);
} | [
"public",
"static",
"MonetaryAmount",
"sum",
"(",
"MonetaryAmount",
"a",
",",
"MonetaryAmount",
"b",
")",
"{",
"MoneyUtils",
".",
"checkAmountParameter",
"(",
"Objects",
".",
"requireNonNull",
"(",
"a",
")",
",",
"Objects",
".",
"requireNonNull",
"(",
"b",
"."... | Adds two monetary together
@param a the first operand
@param b the second operand
@return the sum of {@code a} and {@code b}
@throws NullPointerException if a o b be null
@throws MonetaryException if a and b have different currency | [
"Adds",
"two",
"monetary",
"together"
] | cf8ff2bbaf9b115acc05eb9b0c76c8397c308284 | https://github.com/JavaMoney/jsr354-ri/blob/cf8ff2bbaf9b115acc05eb9b0c76c8397c308284/moneta-core/src/main/java/org/javamoney/moneta/function/MonetaryFunctions.java#L273-L276 |
120,703 | JavaMoney/jsr354-ri | moneta-core/src/main/java/org/javamoney/moneta/function/MonetaryFunctions.java | MonetaryFunctions.sum | public static BinaryOperator<MonetaryAmount> sum(
ExchangeRateProvider provider, CurrencyUnit currency) {
CurrencyConversion currencyConversion = provider
.getCurrencyConversion(currency);
return (m1, m2) -> currencyConversion.apply(m1).add(
currencyConversion.apply(m2));
} | java | public static BinaryOperator<MonetaryAmount> sum(
ExchangeRateProvider provider, CurrencyUnit currency) {
CurrencyConversion currencyConversion = provider
.getCurrencyConversion(currency);
return (m1, m2) -> currencyConversion.apply(m1).add(
currencyConversion.apply(m2));
} | [
"public",
"static",
"BinaryOperator",
"<",
"MonetaryAmount",
">",
"sum",
"(",
"ExchangeRateProvider",
"provider",
",",
"CurrencyUnit",
"currency",
")",
"{",
"CurrencyConversion",
"currencyConversion",
"=",
"provider",
".",
"getCurrencyConversion",
"(",
"currency",
")",
... | return the sum and convert all values to specific currency using the
provider, if necessary
@param provider the rate provider to be used, not null.
@param currency
currency
@return the list convert to specific currency unit | [
"return",
"the",
"sum",
"and",
"convert",
"all",
"values",
"to",
"specific",
"currency",
"using",
"the",
"provider",
"if",
"necessary"
] | cf8ff2bbaf9b115acc05eb9b0c76c8397c308284 | https://github.com/JavaMoney/jsr354-ri/blob/cf8ff2bbaf9b115acc05eb9b0c76c8397c308284/moneta-core/src/main/java/org/javamoney/moneta/function/MonetaryFunctions.java#L318-L325 |
120,704 | JavaMoney/jsr354-ri | moneta-core/src/main/java/org/javamoney/moneta/function/MonetaryFunctions.java | MonetaryFunctions.min | public static BinaryOperator<MonetaryAmount> min(
ExchangeRateProvider provider) {
return (m1, m2) -> {
CurrencyConversion conversion = provider.getCurrencyConversion(m1
.getCurrency());
if (m1.isGreaterThan(conversion.apply(m2))) {
return m2;
}
return m1;
};
} | java | public static BinaryOperator<MonetaryAmount> min(
ExchangeRateProvider provider) {
return (m1, m2) -> {
CurrencyConversion conversion = provider.getCurrencyConversion(m1
.getCurrency());
if (m1.isGreaterThan(conversion.apply(m2))) {
return m2;
}
return m1;
};
} | [
"public",
"static",
"BinaryOperator",
"<",
"MonetaryAmount",
">",
"min",
"(",
"ExchangeRateProvider",
"provider",
")",
"{",
"return",
"(",
"m1",
",",
"m2",
")",
"->",
"{",
"CurrencyConversion",
"conversion",
"=",
"provider",
".",
"getCurrencyConversion",
"(",
"m... | return the minimum value, if the monetary amounts have different
currencies, will converter first using the given ExchangeRateProvider
@param provider
the ExchangeRateProvider to convert the currencies
@return the minimum value | [
"return",
"the",
"minimum",
"value",
"if",
"the",
"monetary",
"amounts",
"have",
"different",
"currencies",
"will",
"converter",
"first",
"using",
"the",
"given",
"ExchangeRateProvider"
] | cf8ff2bbaf9b115acc05eb9b0c76c8397c308284 | https://github.com/JavaMoney/jsr354-ri/blob/cf8ff2bbaf9b115acc05eb9b0c76c8397c308284/moneta-core/src/main/java/org/javamoney/moneta/function/MonetaryFunctions.java#L342-L354 |
120,705 | JavaMoney/jsr354-ri | moneta-convert/moneta-convert-base/src/main/java/org/javamoney/moneta/convert/ConversionOperators.java | ConversionOperators.summarizingMonetary | public static Collector<MonetaryAmount, MonetarySummaryStatistics, MonetarySummaryStatistics> summarizingMonetary(
CurrencyUnit currencyUnit, ExchangeRateProvider provider) {
Supplier<MonetarySummaryStatistics> supplier = () -> new ExchangeRateMonetarySummaryStatistics(
currencyUnit, provider);
return Colle... | java | public static Collector<MonetaryAmount, MonetarySummaryStatistics, MonetarySummaryStatistics> summarizingMonetary(
CurrencyUnit currencyUnit, ExchangeRateProvider provider) {
Supplier<MonetarySummaryStatistics> supplier = () -> new ExchangeRateMonetarySummaryStatistics(
currencyUnit, provider);
return Colle... | [
"public",
"static",
"Collector",
"<",
"MonetaryAmount",
",",
"MonetarySummaryStatistics",
",",
"MonetarySummaryStatistics",
">",
"summarizingMonetary",
"(",
"CurrencyUnit",
"currencyUnit",
",",
"ExchangeRateProvider",
"provider",
")",
"{",
"Supplier",
"<",
"MonetarySummaryS... | of the summary of the MonetaryAmount
@param currencyUnit
the target {@link javax.money.CurrencyUnit}
@return the MonetarySummaryStatistics | [
"of",
"the",
"summary",
"of",
"the",
"MonetaryAmount"
] | cf8ff2bbaf9b115acc05eb9b0c76c8397c308284 | https://github.com/JavaMoney/jsr354-ri/blob/cf8ff2bbaf9b115acc05eb9b0c76c8397c308284/moneta-convert/moneta-convert-base/src/main/java/org/javamoney/moneta/convert/ConversionOperators.java#L87-L94 |
120,706 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/resourceindex/ziplines/Http11BlockLoader.java | Http11BlockLoader.getBlock | public byte[] getBlock(String url, long offset, int length)
throws IOException {
HttpMethod method = null;
try {
method = new GetMethod(url);
} catch(IllegalArgumentException e) {
LOGGER.warning("Bad URL for block fetch:" + url);
throw new IOException("Url:" + url + " does not look like an URL?");
}... | java | public byte[] getBlock(String url, long offset, int length)
throws IOException {
HttpMethod method = null;
try {
method = new GetMethod(url);
} catch(IllegalArgumentException e) {
LOGGER.warning("Bad URL for block fetch:" + url);
throw new IOException("Url:" + url + " does not look like an URL?");
}... | [
"public",
"byte",
"[",
"]",
"getBlock",
"(",
"String",
"url",
",",
"long",
"offset",
",",
"int",
"length",
")",
"throws",
"IOException",
"{",
"HttpMethod",
"method",
"=",
"null",
";",
"try",
"{",
"method",
"=",
"new",
"GetMethod",
"(",
"url",
")",
";",... | Fetch a range of bytes from a particular URL. Note that the bytes are
read into memory all at once, so care should be taken with the length
argument.
@param url String URL to fetch
@param offset byte start offset of the desired range
@param length number of octets to fetch
@return a new byte[] containing the octets fe... | [
"Fetch",
"a",
"range",
"of",
"bytes",
"from",
"a",
"particular",
"URL",
".",
"Note",
"that",
"the",
"bytes",
"are",
"read",
"into",
"memory",
"all",
"at",
"once",
"so",
"care",
"should",
"be",
"taken",
"with",
"the",
"length",
"argument",
"."
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/resourceindex/ziplines/Http11BlockLoader.java#L76-L110 |
120,707 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/util/webapp/SpringReader.java | SpringReader.readSpringConfig | public static RequestMapper readSpringConfig(String configPath,
ServletContext servletContext) {
LOGGER.info("Loading from config file " + configPath);
currentContext = new FileSystemXmlApplicationContext("file:" + configPath);
Map<String,RequestHandler> beans =
currentContext.getBeansOfType(RequestHandl... | java | public static RequestMapper readSpringConfig(String configPath,
ServletContext servletContext) {
LOGGER.info("Loading from config file " + configPath);
currentContext = new FileSystemXmlApplicationContext("file:" + configPath);
Map<String,RequestHandler> beans =
currentContext.getBeansOfType(RequestHandl... | [
"public",
"static",
"RequestMapper",
"readSpringConfig",
"(",
"String",
"configPath",
",",
"ServletContext",
"servletContext",
")",
"{",
"LOGGER",
".",
"info",
"(",
"\"Loading from config file \"",
"+",
"configPath",
")",
";",
"currentContext",
"=",
"new",
"FileSystem... | Read the single Spring XML configuration file located at the specified
path, performing PropertyPlaceHolder interpolation, extracting all beans
which implement the RequestHandler interface, and construct a
RequestMapper for those RequestHandlers, on the specified ServletContext.
@param configPath the path to the Spring... | [
"Read",
"the",
"single",
"Spring",
"XML",
"configuration",
"file",
"located",
"at",
"the",
"specified",
"path",
"performing",
"PropertyPlaceHolder",
"interpolation",
"extracting",
"all",
"beans",
"which",
"implement",
"the",
"RequestHandler",
"interface",
"and",
"cons... | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/util/webapp/SpringReader.java#L55-L64 |
120,708 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/util/graph/GraphRenderer.java | GraphRenderer.renderHTML | public static String renderHTML(Graph graph, String mapName, String imgUrl,
String targets[], String titles[]) {
StringBuilder sb = new StringBuilder();
sb.append("<map name=\"").append(mapName).append("\">");
RegionGraphElement rge[] = graph.getRegions();
int count = rge.length;
for(int i = 0; i < count... | java | public static String renderHTML(Graph graph, String mapName, String imgUrl,
String targets[], String titles[]) {
StringBuilder sb = new StringBuilder();
sb.append("<map name=\"").append(mapName).append("\">");
RegionGraphElement rge[] = graph.getRegions();
int count = rge.length;
for(int i = 0; i < count... | [
"public",
"static",
"String",
"renderHTML",
"(",
"Graph",
"graph",
",",
"String",
"mapName",
",",
"String",
"imgUrl",
",",
"String",
"targets",
"[",
"]",
",",
"String",
"titles",
"[",
"]",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
... | Create both an HTML AREA map and an HTML IMG for a graph, using provided
href targets, and titles within the AREA map.
@param graph Graph to draw
@param mapName name of HTML AREA map
@param imgUrl URL to rendered Graph, see GraphEncoder.encode()
@param targets URL href targets for the years in the Graph
@param titles t... | [
"Create",
"both",
"an",
"HTML",
"AREA",
"map",
"and",
"an",
"HTML",
"IMG",
"for",
"a",
"graph",
"using",
"provided",
"href",
"targets",
"and",
"titles",
"within",
"the",
"AREA",
"map",
"."
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/util/graph/GraphRenderer.java#L50-L78 |
120,709 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/util/graph/GraphRenderer.java | GraphRenderer.render | public void render(OutputStream target, Graph graph) throws IOException {
BufferedImage bi =
new BufferedImage(graph.width, graph.height,
GraphConfiguration.imageType);
Graphics2D g2d = bi.createGraphics();
graph.draw(g2d);
ImageIO.write(bi, "png", target);
} | java | public void render(OutputStream target, Graph graph) throws IOException {
BufferedImage bi =
new BufferedImage(graph.width, graph.height,
GraphConfiguration.imageType);
Graphics2D g2d = bi.createGraphics();
graph.draw(g2d);
ImageIO.write(bi, "png", target);
} | [
"public",
"void",
"render",
"(",
"OutputStream",
"target",
",",
"Graph",
"graph",
")",
"throws",
"IOException",
"{",
"BufferedImage",
"bi",
"=",
"new",
"BufferedImage",
"(",
"graph",
".",
"width",
",",
"graph",
".",
"height",
",",
"GraphConfiguration",
".",
... | Send a PNG format byte stream for the argument Graph to the provided
OutputStream
@param target OutputStream to write PNG format bytes
@param graph Graph to send to the target
@throws IOException for usual reasons. | [
"Send",
"a",
"PNG",
"format",
"byte",
"stream",
"for",
"the",
"argument",
"Graph",
"to",
"the",
"provided",
"OutputStream"
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/util/graph/GraphRenderer.java#L87-L95 |
120,710 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/replay/DecodingResource.java | DecodingResource.forEncoding | public static DecodingResource forEncoding(String contentEncoding, Resource source) throws IOException {
InputStream stream = decodingStream(contentEncoding, source);
if (stream == null) {
return null;
}
return new DecodingResource(source, stream);
} | java | public static DecodingResource forEncoding(String contentEncoding, Resource source) throws IOException {
InputStream stream = decodingStream(contentEncoding, source);
if (stream == null) {
return null;
}
return new DecodingResource(source, stream);
} | [
"public",
"static",
"DecodingResource",
"forEncoding",
"(",
"String",
"contentEncoding",
",",
"Resource",
"source",
")",
"throws",
"IOException",
"{",
"InputStream",
"stream",
"=",
"decodingStream",
"(",
"contentEncoding",
",",
"source",
")",
";",
"if",
"(",
"stre... | Returns a DecodingResource that wraps an existing resource with a decompressor for the given
Content-Encoding.
@param contentEncoding the value of the Content-Encoding header
@param source the resource to wrap
@return the new resource or null if the contentEncoding is not supported | [
"Returns",
"a",
"DecodingResource",
"that",
"wraps",
"an",
"existing",
"resource",
"with",
"a",
"decompressor",
"for",
"the",
"given",
"Content",
"-",
"Encoding",
"."
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/replay/DecodingResource.java#L87-L93 |
120,711 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/resourceindex/CompositeSearchResultSource.java | CompositeSearchResultSource.setCDXSources | public void setCDXSources(List<String> cdxs) {
sources = new ArrayList<SearchResultSource>();
for(int i = 0; i < cdxs.size(); i++) {
CDXIndex index = new CDXIndex();
index.setPath(cdxs.get(i));
addSource(index);
}
} | java | public void setCDXSources(List<String> cdxs) {
sources = new ArrayList<SearchResultSource>();
for(int i = 0; i < cdxs.size(); i++) {
CDXIndex index = new CDXIndex();
index.setPath(cdxs.get(i));
addSource(index);
}
} | [
"public",
"void",
"setCDXSources",
"(",
"List",
"<",
"String",
">",
"cdxs",
")",
"{",
"sources",
"=",
"new",
"ArrayList",
"<",
"SearchResultSource",
">",
"(",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"cdxs",
".",
"size",
"(",
")",... | Sets the list of files searched for queries against this
SearchResultSource to the list of paths cdxs
@param cdxs | [
"Sets",
"the",
"list",
"of",
"files",
"searched",
"for",
"queries",
"against",
"this",
"SearchResultSource",
"to",
"the",
"list",
"of",
"paths",
"cdxs"
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/resourceindex/CompositeSearchResultSource.java#L139-L146 |
120,712 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/util/graph/GraphEncoder.java | GraphEncoder.decode | public static Graph decode(String encodedGraph, boolean noMonth)
throws GraphEncodingException {
GraphConfiguration config = new GraphConfiguration();
if(noMonth) {
config.valueHighlightColor = config.valueColor;
}
return decode(encodedGraph, config);
} | java | public static Graph decode(String encodedGraph, boolean noMonth)
throws GraphEncodingException {
GraphConfiguration config = new GraphConfiguration();
if(noMonth) {
config.valueHighlightColor = config.valueColor;
}
return decode(encodedGraph, config);
} | [
"public",
"static",
"Graph",
"decode",
"(",
"String",
"encodedGraph",
",",
"boolean",
"noMonth",
")",
"throws",
"GraphEncodingException",
"{",
"GraphConfiguration",
"config",
"=",
"new",
"GraphConfiguration",
"(",
")",
";",
"if",
"(",
"noMonth",
")",
"{",
"confi... | convert a String-encoded graph into a usable Graph object, using
default GraphConfiguration
@param encodedGraph String encoded graph, as returned by getEncoded()
@param noMonth if true, disable the month highlight color
@return a Graph, ready to use
@throws GraphEncodingException if there were problems with the encoded... | [
"convert",
"a",
"String",
"-",
"encoded",
"graph",
"into",
"a",
"usable",
"Graph",
"object",
"using",
"default",
"GraphConfiguration"
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/util/graph/GraphEncoder.java#L39-L46 |
120,713 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/util/graph/GraphEncoder.java | GraphEncoder.decode | public static Graph decode(String encodedGraph, GraphConfiguration config)
throws GraphEncodingException {
// encoded = "800_35_REGIONDATA_REGIONDATA_REGIONDATA_REGIONDATA_..."
String parts[] = encodedGraph.split(DELIM);
int numRegions = parts.length - 2;
if(parts.length < 1) {
throw new GraphEncodingExcep... | java | public static Graph decode(String encodedGraph, GraphConfiguration config)
throws GraphEncodingException {
// encoded = "800_35_REGIONDATA_REGIONDATA_REGIONDATA_REGIONDATA_..."
String parts[] = encodedGraph.split(DELIM);
int numRegions = parts.length - 2;
if(parts.length < 1) {
throw new GraphEncodingExcep... | [
"public",
"static",
"Graph",
"decode",
"(",
"String",
"encodedGraph",
",",
"GraphConfiguration",
"config",
")",
"throws",
"GraphEncodingException",
"{",
"// encoded = \"800_35_REGIONDATA_REGIONDATA_REGIONDATA_REGIONDATA_...\"",
"String",
"parts",
"[",
"]",
"=",
"encodedGraph"... | convert a String-encoded graph into a usable Graph object, using
the provided GraphConfiguration.
@param encodedGraph String encoded graph, as returned by getEncoded()
@param config the GraphConfiguration to use
@return a Graph, ready to use
@throws GraphEncodingException if there were problems with the encoded
data | [
"convert",
"a",
"String",
"-",
"encoded",
"graph",
"into",
"a",
"usable",
"Graph",
"object",
"using",
"the",
"provided",
"GraphConfiguration",
"."
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/util/graph/GraphEncoder.java#L56-L90 |
120,714 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/util/graph/GraphEncoder.java | GraphEncoder.encode | public static String encode(Graph g) {
RegionGraphElement rge[] = g.getRegions();
RegionData data[] = new RegionData[rge.length];
for(int i = 0; i < data.length; i++) {
data[i] = rge[i].getData();
}
return encode(g.width, g.height, data);
} | java | public static String encode(Graph g) {
RegionGraphElement rge[] = g.getRegions();
RegionData data[] = new RegionData[rge.length];
for(int i = 0; i < data.length; i++) {
data[i] = rge[i].getData();
}
return encode(g.width, g.height, data);
} | [
"public",
"static",
"String",
"encode",
"(",
"Graph",
"g",
")",
"{",
"RegionGraphElement",
"rge",
"[",
"]",
"=",
"g",
".",
"getRegions",
"(",
")",
";",
"RegionData",
"data",
"[",
"]",
"=",
"new",
"RegionData",
"[",
"rge",
".",
"length",
"]",
";",
"fo... | Convert a complete Graph into an opaque String that can later be
re-assembled into a Graph object. Note that GraphConfiguration
information is NOT encoded into the opaque String.
@param g Graph to encode
@return opaque String which can later be used with decode() | [
"Convert",
"a",
"complete",
"Graph",
"into",
"an",
"opaque",
"String",
"that",
"can",
"later",
"be",
"re",
"-",
"assembled",
"into",
"a",
"Graph",
"object",
".",
"Note",
"that",
"GraphConfiguration",
"information",
"is",
"NOT",
"encoded",
"into",
"the",
"opa... | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/util/graph/GraphEncoder.java#L99-L106 |
120,715 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/util/graph/GraphEncoder.java | GraphEncoder.encode | public static String encode(int width, int height, RegionData data[]) {
StringBuilder sb = new StringBuilder();
sb.append(width).append(DELIM);
sb.append(height);
boolean first = false;
for(RegionData datum : data) {
if(first) {
first = false;
} else {
sb.append(DELIM);
}
sb.append(datum.g... | java | public static String encode(int width, int height, RegionData data[]) {
StringBuilder sb = new StringBuilder();
sb.append(width).append(DELIM);
sb.append(height);
boolean first = false;
for(RegionData datum : data) {
if(first) {
first = false;
} else {
sb.append(DELIM);
}
sb.append(datum.g... | [
"public",
"static",
"String",
"encode",
"(",
"int",
"width",
",",
"int",
"height",
",",
"RegionData",
"data",
"[",
"]",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"sb",
".",
"append",
"(",
"width",
")",
".",
"append",
... | Convert a Graph fields into an opaque String that can later be
re-assembled into a Graph object. Note that GraphConfiguration
information is NOT encoded into the opaque String.
@param width of the Graph
@param height of the Graph
@param data array of RegionData for the graph
@return opaque String which can later be use... | [
"Convert",
"a",
"Graph",
"fields",
"into",
"an",
"opaque",
"String",
"that",
"can",
"later",
"be",
"re",
"-",
"assembled",
"into",
"a",
"Graph",
"object",
".",
"Note",
"that",
"GraphConfiguration",
"information",
"is",
"NOT",
"encoded",
"into",
"the",
"opaqu... | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/util/graph/GraphEncoder.java#L117-L133 |
120,716 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/util/url/UriMatchRule.java | UriMatchRule.processIfMatches | public String processIfMatches(final I input) {
String uriAsString = input.getUri();
String text = input.getTextToProcess();
Matcher m = patternImpl.matcher(uriAsString);
if (!m.find()) {
if (LOGGER.isLoggable(Level.FINE)) {
LOGGER.fine("Rule " + getClass().ge... | java | public String processIfMatches(final I input) {
String uriAsString = input.getUri();
String text = input.getTextToProcess();
Matcher m = patternImpl.matcher(uriAsString);
if (!m.find()) {
if (LOGGER.isLoggable(Level.FINE)) {
LOGGER.fine("Rule " + getClass().ge... | [
"public",
"String",
"processIfMatches",
"(",
"final",
"I",
"input",
")",
"{",
"String",
"uriAsString",
"=",
"input",
".",
"getUri",
"(",
")",
";",
"String",
"text",
"=",
"input",
".",
"getTextToProcess",
"(",
")",
";",
"Matcher",
"m",
"=",
"patternImpl",
... | Processes the given URI if it matches the configured pattern.
@param uriAsString the candidate URI as string
@param context the execution context
@return the URI after processing | [
"Processes",
"the",
"given",
"URI",
"if",
"it",
"matches",
"the",
"configured",
"pattern",
"."
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/util/url/UriMatchRule.java#L83-L106 |
120,717 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/query/resultspartitioner/ResultsPartitionsFactory.java | ResultsPartitionsFactory.get | public static ArrayList<ResultsPartition> get(CaptureSearchResults results,
WaybackRequest wbRequest) {
return get(results, wbRequest, null);
} | java | public static ArrayList<ResultsPartition> get(CaptureSearchResults results,
WaybackRequest wbRequest) {
return get(results, wbRequest, null);
} | [
"public",
"static",
"ArrayList",
"<",
"ResultsPartition",
">",
"get",
"(",
"CaptureSearchResults",
"results",
",",
"WaybackRequest",
"wbRequest",
")",
"{",
"return",
"get",
"(",
"results",
",",
"wbRequest",
",",
"null",
")",
";",
"}"
] | Determine the correct ResultsPartitioner to use given the SearchResults
search range, and use that to break the SearchResults into partitions.
@param results
@param wbRequest
@return ArrayList of ResultsPartition objects | [
"Determine",
"the",
"correct",
"ResultsPartitioner",
"to",
"use",
"given",
"the",
"SearchResults",
"search",
"range",
"and",
"use",
"that",
"to",
"break",
"the",
"SearchResults",
"into",
"partitions",
"."
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/query/resultspartitioner/ResultsPartitionsFactory.java#L54-L57 |
120,718 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/util/graph/ValueGraphElements.java | ValueGraphElements.getElement | public ValueGraphElement getElement(int i) {
if((i < 0) || (i >= values.length)) {
throw new NoSuchElementException();
}
int minHeight = config.valueMinHeight;
// normalize height to value between 0 and 1:
float value = ((float) values[i]) / ((float) maxValue);
float usableHeight = height - minHeight;... | java | public ValueGraphElement getElement(int i) {
if((i < 0) || (i >= values.length)) {
throw new NoSuchElementException();
}
int minHeight = config.valueMinHeight;
// normalize height to value between 0 and 1:
float value = ((float) values[i]) / ((float) maxValue);
float usableHeight = height - minHeight;... | [
"public",
"ValueGraphElement",
"getElement",
"(",
"int",
"i",
")",
"{",
"if",
"(",
"(",
"i",
"<",
"0",
")",
"||",
"(",
"i",
">=",
"values",
".",
"length",
")",
")",
"{",
"throw",
"new",
"NoSuchElementException",
"(",
")",
";",
"}",
"int",
"minHeight"... | return the i'th ValueGraphElement
@param i the index of the element to return
@return the ValueGraphElement at index i | [
"return",
"the",
"i",
"th",
"ValueGraphElement"
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/util/graph/ValueGraphElements.java#L63-L79 |
120,719 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/resourceindex/distributed/RangeGroup.java | RangeGroup.setMembers | public synchronized void setMembers(String[] urls) {
HashMap<String,RangeMember> newMembers =
new HashMap<String,RangeMember>();
for(int i=0; i < urls.length; i++) {
if(members.containsKey(urls[i])) {
newMembers.put(urls[i],members.get(urls[i]));
} else {
RangeMember newMember = new RangeMember... | java | public synchronized void setMembers(String[] urls) {
HashMap<String,RangeMember> newMembers =
new HashMap<String,RangeMember>();
for(int i=0; i < urls.length; i++) {
if(members.containsKey(urls[i])) {
newMembers.put(urls[i],members.get(urls[i]));
} else {
RangeMember newMember = new RangeMember... | [
"public",
"synchronized",
"void",
"setMembers",
"(",
"String",
"[",
"]",
"urls",
")",
"{",
"HashMap",
"<",
"String",
",",
"RangeMember",
">",
"newMembers",
"=",
"new",
"HashMap",
"<",
"String",
",",
"RangeMember",
">",
"(",
")",
";",
"for",
"(",
"int",
... | Update the list of members of this group. Members that disappear are
lost, but members that remain across the operation retain their state.
@param urls | [
"Update",
"the",
"list",
"of",
"members",
"of",
"this",
"group",
".",
"Members",
"that",
"disappear",
"are",
"lost",
"but",
"members",
"that",
"remain",
"across",
"the",
"operation",
"retain",
"their",
"state",
"."
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/resourceindex/distributed/RangeGroup.java#L66-L80 |
120,720 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/webapp/PerfStats.java | PerfStats.getAllStats | public static String getAllStats(OutputFormat format) {
StringBuilder sb = new StringBuilder();
boolean first = true;
Collection<PerfStatEntry> stats = perfStats.get().values();
switch (format) {
case JSON:
sb.append('{');
for (PerfStatEntry entry : stats) {
if (entry.count > 0) {
if (fir... | java | public static String getAllStats(OutputFormat format) {
StringBuilder sb = new StringBuilder();
boolean first = true;
Collection<PerfStatEntry> stats = perfStats.get().values();
switch (format) {
case JSON:
sb.append('{');
for (PerfStatEntry entry : stats) {
if (entry.count > 0) {
if (fir... | [
"public",
"static",
"String",
"getAllStats",
"(",
"OutputFormat",
"format",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"boolean",
"first",
"=",
"true",
";",
"Collection",
"<",
"PerfStatEntry",
">",
"stats",
"=",
"perfStats",
... | Format all stats in the format specified.
@param format serialization format
@return serialized stats | [
"Format",
"all",
"stats",
"in",
"the",
"format",
"specified",
"."
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/webapp/PerfStats.java#L198-L239 |
120,721 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/replay/TextDocument.java | TextDocument.resolvePageUrls | public void resolvePageUrls() {
// TODO: get url from Resource instead of SearchResult?
String pageUrl = result.getOriginalUrl();
String captureDate = result.getCaptureTimestamp();
String existingBaseHref = TagMagix.getBaseHref(sb);
if (existingBaseHref == null) {
insertAtStartOfHead("<base href=\"" + pa... | java | public void resolvePageUrls() {
// TODO: get url from Resource instead of SearchResult?
String pageUrl = result.getOriginalUrl();
String captureDate = result.getCaptureTimestamp();
String existingBaseHref = TagMagix.getBaseHref(sb);
if (existingBaseHref == null) {
insertAtStartOfHead("<base href=\"" + pa... | [
"public",
"void",
"resolvePageUrls",
"(",
")",
"{",
"// TODO: get url from Resource instead of SearchResult?",
"String",
"pageUrl",
"=",
"result",
".",
"getOriginalUrl",
"(",
")",
";",
"String",
"captureDate",
"=",
"result",
".",
"getCaptureTimestamp",
"(",
")",
";",
... | Update URLs inside the page, so those URLs which must be correct at
page load time resolve correctly to absolute URLs.
This means ensuring there is a BASE HREF tag, adding one if missing,
and then resolving:
FRAME-SRC, META-URL, LINK-HREF, SCRIPT-SRC
tag-attribute pairs against either the existing BASE-HREF, or the
pa... | [
"Update",
"URLs",
"inside",
"the",
"page",
"so",
"those",
"URLs",
"which",
"must",
"be",
"correct",
"at",
"page",
"load",
"time",
"resolve",
"correctly",
"to",
"absolute",
"URLs",
"."
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/replay/TextDocument.java#L98-L126 |
120,722 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/replay/TextDocument.java | TextDocument.resolveAllPageUrls | public void resolveAllPageUrls() {
// TODO: get url from Resource instead of SearchResult?
String pageUrl = result.getOriginalUrl();
String captureDate = result.getCaptureTimestamp();
String existingBaseHref = TagMagix.getBaseHref(sb);
if (existingBaseHref != null) {
pageUrl = existingBaseHref;
}
Res... | java | public void resolveAllPageUrls() {
// TODO: get url from Resource instead of SearchResult?
String pageUrl = result.getOriginalUrl();
String captureDate = result.getCaptureTimestamp();
String existingBaseHref = TagMagix.getBaseHref(sb);
if (existingBaseHref != null) {
pageUrl = existingBaseHref;
}
Res... | [
"public",
"void",
"resolveAllPageUrls",
"(",
")",
"{",
"// TODO: get url from Resource instead of SearchResult?",
"String",
"pageUrl",
"=",
"result",
".",
"getOriginalUrl",
"(",
")",
";",
"String",
"captureDate",
"=",
"result",
".",
"getCaptureTimestamp",
"(",
")",
";... | Update all URLs inside the page, so they resolve correctly to absolute
URLs within the Wayback service. | [
"Update",
"all",
"URLs",
"inside",
"the",
"page",
"so",
"they",
"resolve",
"correctly",
"to",
"absolute",
"URLs",
"within",
"the",
"Wayback",
"service",
"."
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/replay/TextDocument.java#L132-L167 |
120,723 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/replay/TextDocument.java | TextDocument.writeToOutputStream | public void writeToOutputStream(OutputStream os) throws IOException {
if(sb == null) {
throw new IllegalStateException("No interal StringBuffer");
}
byte[] b;
try {
b = getBytes();
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
os.write(b);
} | java | public void writeToOutputStream(OutputStream os) throws IOException {
if(sb == null) {
throw new IllegalStateException("No interal StringBuffer");
}
byte[] b;
try {
b = getBytes();
} catch (UnsupportedEncodingException e) {
throw new RuntimeException(e);
}
os.write(b);
} | [
"public",
"void",
"writeToOutputStream",
"(",
"OutputStream",
"os",
")",
"throws",
"IOException",
"{",
"if",
"(",
"sb",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"No interal StringBuffer\"",
")",
";",
"}",
"byte",
"[",
"]",
"b",
... | Write the contents of the page to the client.
@param os
@throws IOException | [
"Write",
"the",
"contents",
"of",
"the",
"page",
"to",
"the",
"client",
"."
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/replay/TextDocument.java#L254-L265 |
120,724 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/util/DirMaker.java | DirMaker.ensureDir | public static File ensureDir(String path, String name) throws IOException {
if((path == null) || (path.length() == 0)) {
throw new IOException("No configuration for (" + name + ")");
}
File dir = new File(path);
if(dir.exists()) {
if(!dir.isDirectory()) {
throw new IOException("Dir(" + name + ") at ("... | java | public static File ensureDir(String path, String name) throws IOException {
if((path == null) || (path.length() == 0)) {
throw new IOException("No configuration for (" + name + ")");
}
File dir = new File(path);
if(dir.exists()) {
if(!dir.isDirectory()) {
throw new IOException("Dir(" + name + ") at ("... | [
"public",
"static",
"File",
"ensureDir",
"(",
"String",
"path",
",",
"String",
"name",
")",
"throws",
"IOException",
"{",
"if",
"(",
"(",
"path",
"==",
"null",
")",
"||",
"(",
"path",
".",
"length",
"(",
")",
"==",
"0",
")",
")",
"{",
"throw",
"new... | Ensure that the path pointed to by 'path' is a directory, if possible
@param path
@param name
@return File that is a created directory
@throws IOException | [
"Ensure",
"that",
"the",
"path",
"pointed",
"to",
"by",
"path",
"is",
"a",
"directory",
"if",
"possible"
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/util/DirMaker.java#L40-L57 |
120,725 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/util/graph/GraphConfiguration.java | GraphConfiguration.setRenderingHints | public void setRenderingHints(Graphics2D g2d) {
// g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
// RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_OFF);
g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
RenderingH... | java | public void setRenderingHints(Graphics2D g2d) {
// g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
// RenderingHints.VALUE_ANTIALIAS_ON);
g2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,
RenderingHints.VALUE_ANTIALIAS_OFF);
g2d.setRenderingHint(RenderingHints.KEY_TEXT_ANTIALIASING,
RenderingH... | [
"public",
"void",
"setRenderingHints",
"(",
"Graphics2D",
"g2d",
")",
"{",
"//\t\tg2d.setRenderingHint(RenderingHints.KEY_ANTIALIASING,",
"//\t\t\t\tRenderingHints.VALUE_ANTIALIAS_ON);",
"g2d",
".",
"setRenderingHint",
"(",
"RenderingHints",
".",
"KEY_ANTIALIASING",
",",
"Renderi... | Set whatever redneringHints are needed to properly draw the graph, ie.
AntiAliasing, etc.
@param g2d The Graphics2D objects on which the hints should be set. | [
"Set",
"whatever",
"redneringHints",
"are",
"needed",
"to",
"properly",
"draw",
"the",
"graph",
"ie",
".",
"AntiAliasing",
"etc",
"."
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/util/graph/GraphConfiguration.java#L129-L136 |
120,726 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/util/StringFormatter.java | StringFormatter.getLocalized | public String getLocalized(String key) {
if (bundle != null) {
try {
return bundle.getString(key);
// String localized = bundle.getString(key);
// if((localized != null) && (localized.length() > 0)) {
// return localized;
// }
} catch (Exception e) {
}
}
return key;
} | java | public String getLocalized(String key) {
if (bundle != null) {
try {
return bundle.getString(key);
// String localized = bundle.getString(key);
// if((localized != null) && (localized.length() > 0)) {
// return localized;
// }
} catch (Exception e) {
}
}
return key;
} | [
"public",
"String",
"getLocalized",
"(",
"String",
"key",
")",
"{",
"if",
"(",
"bundle",
"!=",
"null",
")",
"{",
"try",
"{",
"return",
"bundle",
".",
"getString",
"(",
"key",
")",
";",
"//\t\t\tString localized = bundle.getString(key);",
"//\t\t\tif((localized != ... | Access a localized string associated with key from the ResourceBundle,
likely the UI.properties file.
@param key to lookup in the ResourceBundle
@return localized String version of key argument, or key itself if
something goes wrong... | [
"Access",
"a",
"localized",
"string",
"associated",
"with",
"key",
"from",
"the",
"ResourceBundle",
"likely",
"the",
"UI",
".",
"properties",
"file",
"."
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/util/StringFormatter.java#L106-L119 |
120,727 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/resourceindex/updater/LocalResourceIndexUpdater.java | LocalResourceIndexUpdater.init | public void init() throws ConfigurationException {
if(index == null) {
throw new ConfigurationException("No index target");
}
if(!index.isUpdatable()) {
throw new ConfigurationException("ResourceIndex is not updatable");
}
if(incoming == null) {
throw new ConfigurationException("No incoming");
}... | java | public void init() throws ConfigurationException {
if(index == null) {
throw new ConfigurationException("No index target");
}
if(!index.isUpdatable()) {
throw new ConfigurationException("ResourceIndex is not updatable");
}
if(incoming == null) {
throw new ConfigurationException("No incoming");
}... | [
"public",
"void",
"init",
"(",
")",
"throws",
"ConfigurationException",
"{",
"if",
"(",
"index",
"==",
"null",
")",
"{",
"throw",
"new",
"ConfigurationException",
"(",
"\"No index target\"",
")",
";",
"}",
"if",
"(",
"!",
"index",
".",
"isUpdatable",
"(",
... | start the background index merging thread
@throws ConfigurationException | [
"start",
"the",
"background",
"index",
"merging",
"thread"
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/resourceindex/updater/LocalResourceIndexUpdater.java#L76-L90 |
120,728 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/resourcestore/resourcefile/ArcResource.java | ArcResource.parseHeaders | public void parseHeaders () throws IOException {
if(!parsedHeader) {
arcRecord.skipHttpHeader();
// copy all HTTP headers to metaData, prefixing with
// HTTP_HEADER_PREFIX
Header[] headers = arcRecord.getHttpHeaders();
if (headers != null) {
for (int i = 0; i < headers.length; i++) {
String v... | java | public void parseHeaders () throws IOException {
if(!parsedHeader) {
arcRecord.skipHttpHeader();
// copy all HTTP headers to metaData, prefixing with
// HTTP_HEADER_PREFIX
Header[] headers = arcRecord.getHttpHeaders();
if (headers != null) {
for (int i = 0; i < headers.length; i++) {
String v... | [
"public",
"void",
"parseHeaders",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"parsedHeader",
")",
"{",
"arcRecord",
".",
"skipHttpHeader",
"(",
")",
";",
"// copy all HTTP headers to metaData, prefixing with ",
"// HTTP_HEADER_PREFIX",
"Header",
"[",
"]",... | parse the headers on the underlying ARC record, and extract all
@throws IOException | [
"parse",
"the",
"headers",
"on",
"the",
"underlying",
"ARC",
"record",
"and",
"extract",
"all"
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/resourcestore/resourcefile/ArcResource.java#L84-L122 |
120,729 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/core/UIResults.java | UIResults.resultToReplayUrl | public String resultToReplayUrl(CaptureSearchResult result) {
if(uriConverter == null) {
return null;
}
String url = result.getOriginalUrl();
String captureDate = result.getCaptureTimestamp();
return uriConverter.makeReplayURI(captureDate,url);
} | java | public String resultToReplayUrl(CaptureSearchResult result) {
if(uriConverter == null) {
return null;
}
String url = result.getOriginalUrl();
String captureDate = result.getCaptureTimestamp();
return uriConverter.makeReplayURI(captureDate,url);
} | [
"public",
"String",
"resultToReplayUrl",
"(",
"CaptureSearchResult",
"result",
")",
"{",
"if",
"(",
"uriConverter",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"String",
"url",
"=",
"result",
".",
"getOriginalUrl",
"(",
")",
";",
"String",
"captureDa... | Create a replay URL for the given CaptureSearchResult
@param result CaptureSearchResult to replay
@return URL string that will replay the specified Resource Result. | [
"Create",
"a",
"replay",
"URL",
"for",
"the",
"given",
"CaptureSearchResult"
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/core/UIResults.java#L319-L326 |
120,730 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/core/UIResults.java | UIResults.urlForPage | public String urlForPage(int pageNum) {
WaybackRequest wbRequest = getWbRequest();
return wbRequest.getAccessPoint().getQueryPrefix() + "query?" +
wbRequest.getQueryArguments(pageNum);
} | java | public String urlForPage(int pageNum) {
WaybackRequest wbRequest = getWbRequest();
return wbRequest.getAccessPoint().getQueryPrefix() + "query?" +
wbRequest.getQueryArguments(pageNum);
} | [
"public",
"String",
"urlForPage",
"(",
"int",
"pageNum",
")",
"{",
"WaybackRequest",
"wbRequest",
"=",
"getWbRequest",
"(",
")",
";",
"return",
"wbRequest",
".",
"getAccessPoint",
"(",
")",
".",
"getQueryPrefix",
"(",
")",
"+",
"\"query?\"",
"+",
"wbRequest",
... | Create a self-referencing URL that will drive to the given page,
simplifying rendering pagination
@param pageNum page number of results to link to.
@return String URL which will drive browser to search results for a
different page of results for the same query | [
"Create",
"a",
"self",
"-",
"referencing",
"URL",
"that",
"will",
"drive",
"to",
"the",
"given",
"page",
"simplifying",
"rendering",
"pagination"
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/core/UIResults.java#L335-L339 |
120,731 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/core/UIResults.java | UIResults.forward | public void forward(HttpServletRequest request,
HttpServletResponse response, final String target)
throws ServletException, IOException {
if (target.startsWith("/WEB-INF/classes")
|| target.startsWith("/WEB-INF/lib")
|| target.matches("^/WEB-INF/.+\\.xml")) {
throw new IOException("Not allowed");
}... | java | public void forward(HttpServletRequest request,
HttpServletResponse response, final String target)
throws ServletException, IOException {
if (target.startsWith("/WEB-INF/classes")
|| target.startsWith("/WEB-INF/lib")
|| target.matches("^/WEB-INF/.+\\.xml")) {
throw new IOException("Not allowed");
}... | [
"public",
"void",
"forward",
"(",
"HttpServletRequest",
"request",
",",
"HttpServletResponse",
"response",
",",
"final",
"String",
"target",
")",
"throws",
"ServletException",
",",
"IOException",
"{",
"if",
"(",
"target",
".",
"startsWith",
"(",
"\"/WEB-INF/classes\... | Store this UIResults object in the given HttpServletRequest, then
forward the request to target, in this case, an image, html file, .jsp,
any file which can return a complete document. Specifically, this means
that if target is a .jsp, it must render it's own header and footer.
@param request the HttpServletRequest
@pa... | [
"Store",
"this",
"UIResults",
"object",
"in",
"the",
"given",
"HttpServletRequest",
"then",
"forward",
"the",
"request",
"to",
"target",
"in",
"this",
"case",
"an",
"image",
"html",
"file",
".",
"jsp",
"any",
"file",
"which",
"can",
"return",
"a",
"complete"... | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/core/UIResults.java#L405-L422 |
120,732 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/core/UIResults.java | UIResults.extractException | public static UIResults extractException(HttpServletRequest httpRequest)
throws ServletException {
UIResults results = (UIResults) httpRequest.getAttribute(FERRET_NAME);
if (results == null) {
throw new ServletException("No attribute..");
}
if (results.exception == null) {
throw new ServletException(... | java | public static UIResults extractException(HttpServletRequest httpRequest)
throws ServletException {
UIResults results = (UIResults) httpRequest.getAttribute(FERRET_NAME);
if (results == null) {
throw new ServletException("No attribute..");
}
if (results.exception == null) {
throw new ServletException(... | [
"public",
"static",
"UIResults",
"extractException",
"(",
"HttpServletRequest",
"httpRequest",
")",
"throws",
"ServletException",
"{",
"UIResults",
"results",
"=",
"(",
"UIResults",
")",
"httpRequest",
".",
"getAttribute",
"(",
"FERRET_NAME",
")",
";",
"if",
"(",
... | Extract an Exception UIResults from the HttpServletRequest. Probably used
by a .jsp responsible for actual drawing errors for the user.private
@param httpRequest the HttpServletRequest where the UIResults was
ferreted away
@return Exception UIResult with info from httpRequest applied.
@throws ServletException if expect... | [
"Extract",
"an",
"Exception",
"UIResults",
"from",
"the",
"HttpServletRequest",
".",
"Probably",
"used",
"by",
"a",
".",
"jsp",
"responsible",
"for",
"actual",
"drawing",
"errors",
"for",
"the",
"user",
".",
"private"
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/core/UIResults.java#L480-L497 |
120,733 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/core/UIResults.java | UIResults.extractCaptureQuery | public static UIResults extractCaptureQuery(HttpServletRequest httpRequest)
throws ServletException {
UIResults results = (UIResults) httpRequest.getAttribute(FERRET_NAME);
if (results == null) {
throw new ServletException("No attribute..");
}
if (results.wbRequest == null) {
throw new ServletExcepti... | java | public static UIResults extractCaptureQuery(HttpServletRequest httpRequest)
throws ServletException {
UIResults results = (UIResults) httpRequest.getAttribute(FERRET_NAME);
if (results == null) {
throw new ServletException("No attribute..");
}
if (results.wbRequest == null) {
throw new ServletExcepti... | [
"public",
"static",
"UIResults",
"extractCaptureQuery",
"(",
"HttpServletRequest",
"httpRequest",
")",
"throws",
"ServletException",
"{",
"UIResults",
"results",
"=",
"(",
"UIResults",
")",
"httpRequest",
".",
"getAttribute",
"(",
"FERRET_NAME",
")",
";",
"if",
"(",... | Extract a CaptureQuery UIResults from the HttpServletRequest. Probably
used by a .jsp responsible for actually drawing search results for the
user.
@param httpRequest the HttpServletRequest where the UIResults was
ferreted away
@return CaptureQuery UIResult with info from httpRequest applied.
@throws ServletException i... | [
"Extract",
"a",
"CaptureQuery",
"UIResults",
"from",
"the",
"HttpServletRequest",
".",
"Probably",
"used",
"by",
"a",
".",
"jsp",
"responsible",
"for",
"actually",
"drawing",
"search",
"results",
"for",
"the",
"user",
"."
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/core/UIResults.java#L508-L525 |
120,734 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/core/UIResults.java | UIResults.extractUrlQuery | public static UIResults extractUrlQuery(HttpServletRequest httpRequest)
throws ServletException {
UIResults results = (UIResults) httpRequest.getAttribute(FERRET_NAME);
if (results == null) {
throw new ServletException("No attribute..");
}
if (results.wbRequest == null) {
throw new ServletException("... | java | public static UIResults extractUrlQuery(HttpServletRequest httpRequest)
throws ServletException {
UIResults results = (UIResults) httpRequest.getAttribute(FERRET_NAME);
if (results == null) {
throw new ServletException("No attribute..");
}
if (results.wbRequest == null) {
throw new ServletException("... | [
"public",
"static",
"UIResults",
"extractUrlQuery",
"(",
"HttpServletRequest",
"httpRequest",
")",
"throws",
"ServletException",
"{",
"UIResults",
"results",
"=",
"(",
"UIResults",
")",
"httpRequest",
".",
"getAttribute",
"(",
"FERRET_NAME",
")",
";",
"if",
"(",
"... | Extract a UrlQuery UIResults from the HttpServletRequest. Probably
used by a .jsp responsible for actually drawing search results for the
user.
@param httpRequest the HttpServletRequest where the UIResults was
ferreted away
@return UrlQuery UIResult with info from httpRequest applied.
@throws ServletException if expect... | [
"Extract",
"a",
"UrlQuery",
"UIResults",
"from",
"the",
"HttpServletRequest",
".",
"Probably",
"used",
"by",
"a",
".",
"jsp",
"responsible",
"for",
"actually",
"drawing",
"search",
"results",
"for",
"the",
"user",
"."
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/core/UIResults.java#L536-L553 |
120,735 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/core/UIResults.java | UIResults.extractReplay | public static UIResults extractReplay(HttpServletRequest httpRequest)
throws ServletException {
UIResults results = (UIResults) httpRequest.getAttribute(FERRET_NAME);
if (results == null) {
throw new ServletException("No attribute..");
}
if (results.wbRequest == null) {
throw new ServletException("No... | java | public static UIResults extractReplay(HttpServletRequest httpRequest)
throws ServletException {
UIResults results = (UIResults) httpRequest.getAttribute(FERRET_NAME);
if (results == null) {
throw new ServletException("No attribute..");
}
if (results.wbRequest == null) {
throw new ServletException("No... | [
"public",
"static",
"UIResults",
"extractReplay",
"(",
"HttpServletRequest",
"httpRequest",
")",
"throws",
"ServletException",
"{",
"UIResults",
"results",
"=",
"(",
"UIResults",
")",
"httpRequest",
".",
"getAttribute",
"(",
"FERRET_NAME",
")",
";",
"if",
"(",
"re... | Extract a Replay UIResults from the HttpServletRequest. Probably
used by a .jsp insert, responsible for rendering content into replayed
Resources to enhance the Replay experience.
@param httpRequest the HttpServletRequest where the UIResults was
ferreted away
@return Replay UIResult with info from httpRequest applied.
... | [
"Extract",
"a",
"Replay",
"UIResults",
"from",
"the",
"HttpServletRequest",
".",
"Probably",
"used",
"by",
"a",
".",
"jsp",
"insert",
"responsible",
"for",
"rendering",
"content",
"into",
"replayed",
"Resources",
"to",
"enhance",
"the",
"Replay",
"experience",
"... | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/core/UIResults.java#L564-L587 |
120,736 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/core/UIResults.java | UIResults.getTargetSite | public String getTargetSite() {
try {
String urlstr = wbRequest.getRequestUrl();
if (urlstr == null) return null;
URL url = new URL(urlstr);
return url.getHost();
} catch (MalformedURLException ex) {
return null;
}
} | java | public String getTargetSite() {
try {
String urlstr = wbRequest.getRequestUrl();
if (urlstr == null) return null;
URL url = new URL(urlstr);
return url.getHost();
} catch (MalformedURLException ex) {
return null;
}
} | [
"public",
"String",
"getTargetSite",
"(",
")",
"{",
"try",
"{",
"String",
"urlstr",
"=",
"wbRequest",
".",
"getRequestUrl",
"(",
")",
";",
"if",
"(",
"urlstr",
"==",
"null",
")",
"return",
"null",
";",
"URL",
"url",
"=",
"new",
"URL",
"(",
"urlstr",
... | return hostname portion of request URL.
@return String | [
"return",
"hostname",
"portion",
"of",
"request",
"URL",
"."
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/core/UIResults.java#L746-L755 |
120,737 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/resourcestore/resourcefile/DirectoryResourceFileSource.java | DirectoryResourceFileSource.populateFileList | private void populateFileList(ResourceFileList list, File root, boolean recurse)
throws IOException {
if(root.isDirectory()) {
File[] files = root.listFiles();
if(files != null) {
for(File file : files) {
if(file.isFile() && filter.accept(root, file.getName())) {
ResourceFileLocation location =... | java | private void populateFileList(ResourceFileList list, File root, boolean recurse)
throws IOException {
if(root.isDirectory()) {
File[] files = root.listFiles();
if(files != null) {
for(File file : files) {
if(file.isFile() && filter.accept(root, file.getName())) {
ResourceFileLocation location =... | [
"private",
"void",
"populateFileList",
"(",
"ResourceFileList",
"list",
",",
"File",
"root",
",",
"boolean",
"recurse",
")",
"throws",
"IOException",
"{",
"if",
"(",
"root",
".",
"isDirectory",
"(",
")",
")",
"{",
"File",
"[",
"]",
"files",
"=",
"root",
... | add all files matching this.filter beneath root to list, recursing if
recurse is set.
@param list
@param root
@param recurse
@throws IOException | [
"add",
"all",
"files",
"matching",
"this",
".",
"filter",
"beneath",
"root",
"to",
"list",
"recursing",
"if",
"recurse",
"is",
"set",
"."
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/resourcestore/resourcefile/DirectoryResourceFileSource.java#L68-L87 |
120,738 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/util/bdb/BDBRecordSet.java | BDBRecordSet.shutdownDB | public synchronized void shutdownDB() throws DatabaseException {
if (db != null) {
db.close();
db = null;
}
if (env != null) {
env.close();
env = null;
}
} | java | public synchronized void shutdownDB() throws DatabaseException {
if (db != null) {
db.close();
db = null;
}
if (env != null) {
env.close();
env = null;
}
} | [
"public",
"synchronized",
"void",
"shutdownDB",
"(",
")",
"throws",
"DatabaseException",
"{",
"if",
"(",
"db",
"!=",
"null",
")",
"{",
"db",
".",
"close",
"(",
")",
";",
"db",
"=",
"null",
";",
"}",
"if",
"(",
"env",
"!=",
"null",
")",
"{",
"env",
... | shut down the BDB.
@throws DatabaseException | [
"shut",
"down",
"the",
"BDB",
"."
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/util/bdb/BDBRecordSet.java#L106-L117 |
120,739 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/liveweb/FileRegion.java | FileRegion.copyToOutputStream | public void copyToOutputStream(OutputStream o) throws IOException {
long left = end - start;
int BUFF_SIZE = 4096;
byte buf[] = new byte[BUFF_SIZE];
RandomAccessFile raf = new RandomAccessFile(file, "r");
try {
raf.seek(start);
while(left > 0) {
int amtToRead = (int) Math.min(left, BUFF_SIZE);
i... | java | public void copyToOutputStream(OutputStream o) throws IOException {
long left = end - start;
int BUFF_SIZE = 4096;
byte buf[] = new byte[BUFF_SIZE];
RandomAccessFile raf = new RandomAccessFile(file, "r");
try {
raf.seek(start);
while(left > 0) {
int amtToRead = (int) Math.min(left, BUFF_SIZE);
i... | [
"public",
"void",
"copyToOutputStream",
"(",
"OutputStream",
"o",
")",
"throws",
"IOException",
"{",
"long",
"left",
"=",
"end",
"-",
"start",
";",
"int",
"BUFF_SIZE",
"=",
"4096",
";",
"byte",
"buf",
"[",
"]",
"=",
"new",
"byte",
"[",
"BUFF_SIZE",
"]",
... | Copy this record to the provided OutputStream
@param o the OutputStream where the bytes should be sent.
@throws IOException for usual reasons | [
"Copy",
"this",
"record",
"to",
"the",
"provided",
"OutputStream"
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/liveweb/FileRegion.java#L49-L68 |
120,740 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/replay/PreservingHttpHeaderProcessor.java | PreservingHttpHeaderProcessor.setPrefix | public void setPrefix(String prefix) {
this.prefix = prefix;
if (this.prefix != null && this.prefix.isEmpty())
this.prefix = null;
} | java | public void setPrefix(String prefix) {
this.prefix = prefix;
if (this.prefix != null && this.prefix.isEmpty())
this.prefix = null;
} | [
"public",
"void",
"setPrefix",
"(",
"String",
"prefix",
")",
"{",
"this",
".",
"prefix",
"=",
"prefix",
";",
"if",
"(",
"this",
".",
"prefix",
"!=",
"null",
"&&",
"this",
".",
"prefix",
".",
"isEmpty",
"(",
")",
")",
"this",
".",
"prefix",
"=",
"nu... | prefix prepended to the name of headers preserved.
<p>Example: "{@code X-Archive-Orig-}".
Empty String is translated to {@code null}.
Default value is {@code null}.</p>
@param prefix header name prefix | [
"prefix",
"prepended",
"to",
"the",
"name",
"of",
"headers",
"preserved",
"."
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/replay/PreservingHttpHeaderProcessor.java#L32-L36 |
120,741 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/util/webapp/BeanNameRegistrar.java | BeanNameRegistrar.registerHandler | public static void registerHandler(RequestHandler handler,
RequestMapper mapper) {
String name = null;
int internalPort = 8080;
if (handler instanceof AbstractRequestHandler) {
name = ((AbstractRequestHandler)handler).getAccessPointPath();
internalPort = ((AbstractRequestHandler)handler).getIntern... | java | public static void registerHandler(RequestHandler handler,
RequestMapper mapper) {
String name = null;
int internalPort = 8080;
if (handler instanceof AbstractRequestHandler) {
name = ((AbstractRequestHandler)handler).getAccessPointPath();
internalPort = ((AbstractRequestHandler)handler).getIntern... | [
"public",
"static",
"void",
"registerHandler",
"(",
"RequestHandler",
"handler",
",",
"RequestMapper",
"mapper",
")",
"{",
"String",
"name",
"=",
"null",
";",
"int",
"internalPort",
"=",
"8080",
";",
"if",
"(",
"handler",
"instanceof",
"AbstractRequestHandler",
... | Extract the RequestHandler objects beanName, parse it, and register the
RequestHandler with the RequestMapper according to the beanNames
semantics.
@param handler The RequestHandler to register
@param mapper the RequestMapper where the RequestHandler should be
registered. | [
"Extract",
"the",
"RequestHandler",
"objects",
"beanName",
"parse",
"it",
"and",
"register",
"the",
"RequestHandler",
"with",
"the",
"RequestMapper",
"according",
"to",
"the",
"beanNames",
"semantics",
"."
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/util/webapp/BeanNameRegistrar.java#L161-L219 |
120,742 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/resourceindex/cdx/format/CDXFlexFormat.java | CDXFlexFormat.parseCDXLineFlex | public static CaptureSearchResult parseCDXLineFlex(String line) {
CaptureSearchResult result = new CaptureSearchResult();
return parseCDXLineFlex(line, result);
} | java | public static CaptureSearchResult parseCDXLineFlex(String line) {
CaptureSearchResult result = new CaptureSearchResult();
return parseCDXLineFlex(line, result);
} | [
"public",
"static",
"CaptureSearchResult",
"parseCDXLineFlex",
"(",
"String",
"line",
")",
"{",
"CaptureSearchResult",
"result",
"=",
"new",
"CaptureSearchResult",
"(",
")",
";",
"return",
"parseCDXLineFlex",
"(",
"line",
",",
"result",
")",
";",
"}"
] | Single place to do the flex cdx-line parsing logic | [
"Single",
"place",
"to",
"do",
"the",
"flex",
"cdx",
"-",
"line",
"parsing",
"logic"
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/resourceindex/cdx/format/CDXFlexFormat.java#L39-L42 |
120,743 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/resourceindex/cdx/format/CDXFlexFormat.java | CDXFlexFormat.parseCDXLineFlexFast | public static CaptureSearchResult parseCDXLineFlexFast(String line) {
CaptureSearchResult result = new FastCaptureSearchResult();
return parseCDXLineFlex(line, result);
} | java | public static CaptureSearchResult parseCDXLineFlexFast(String line) {
CaptureSearchResult result = new FastCaptureSearchResult();
return parseCDXLineFlex(line, result);
} | [
"public",
"static",
"CaptureSearchResult",
"parseCDXLineFlexFast",
"(",
"String",
"line",
")",
"{",
"CaptureSearchResult",
"result",
"=",
"new",
"FastCaptureSearchResult",
"(",
")",
";",
"return",
"parseCDXLineFlex",
"(",
"line",
",",
"result",
")",
";",
"}"
] | Use FastCaptureSearchResult to | [
"Use",
"FastCaptureSearchResult",
"to"
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/resourceindex/cdx/format/CDXFlexFormat.java#L45-L48 |
120,744 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/surt/SURTTokenizer.java | SURTTokenizer.nextSearch | public String nextSearch() {
if(!triedExact) {
triedExact = true;
return remainder + EXACT_SUFFIX;
}
if(!triedFull) {
triedFull = true;
if(remainder.endsWith(")/")) {
choppedPath = true;
}
return remainder;
}
if(!choppedArgs) {
choppedArgs = true;
int argStart = remainder.indexOf('... | java | public String nextSearch() {
if(!triedExact) {
triedExact = true;
return remainder + EXACT_SUFFIX;
}
if(!triedFull) {
triedFull = true;
if(remainder.endsWith(")/")) {
choppedPath = true;
}
return remainder;
}
if(!choppedArgs) {
choppedArgs = true;
int argStart = remainder.indexOf('... | [
"public",
"String",
"nextSearch",
"(",
")",
"{",
"if",
"(",
"!",
"triedExact",
")",
"{",
"triedExact",
"=",
"true",
";",
"return",
"remainder",
"+",
"EXACT_SUFFIX",
";",
"}",
"if",
"(",
"!",
"triedFull",
")",
"{",
"triedFull",
"=",
"true",
";",
"if",
... | update internal state and return the next smaller search string
for the url
@return string to lookup for prefix match for relevant information. | [
"update",
"internal",
"state",
"and",
"return",
"the",
"next",
"smaller",
"search",
"string",
"for",
"the",
"url"
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/surt/SURTTokenizer.java#L73-L148 |
120,745 | iipc/openwayback | wayback-cdx-server-core/src/main/java/org/archive/cdxserver/CDXServer.java | CDXServer.afterPropertiesSet | @Override
public void afterPropertiesSet() throws Exception {
if (cdxSource == null) {
cdxSource = zipnumSource;
}
cdxLineFactory = new StandardCDXLineFactory(cdxFormat);
// defaultCdxFormat = cdxLineFactory.getParseFormat();
// if (authChecker != null && authChecker.getPublicCdxFields() != null)
// {... | java | @Override
public void afterPropertiesSet() throws Exception {
if (cdxSource == null) {
cdxSource = zipnumSource;
}
cdxLineFactory = new StandardCDXLineFactory(cdxFormat);
// defaultCdxFormat = cdxLineFactory.getParseFormat();
// if (authChecker != null && authChecker.getPublicCdxFields() != null)
// {... | [
"@",
"Override",
"public",
"void",
"afterPropertiesSet",
"(",
")",
"throws",
"Exception",
"{",
"if",
"(",
"cdxSource",
"==",
"null",
")",
"{",
"cdxSource",
"=",
"zipnumSource",
";",
"}",
"cdxLineFactory",
"=",
"new",
"StandardCDXLineFactory",
"(",
"cdxFormat",
... | protected FieldSplitFormat publicCdxFields; | [
"protected",
"FieldSplitFormat",
"publicCdxFields",
";"
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-cdx-server-core/src/main/java/org/archive/cdxserver/CDXServer.java#L59-L79 |
120,746 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/util/Timestamp.java | Timestamp.setDate | public final void setDate(final Date date) {
this.date = (Date) date.clone();
dateStr = ArchiveUtils.get14DigitDate(date);
} | java | public final void setDate(final Date date) {
this.date = (Date) date.clone();
dateStr = ArchiveUtils.get14DigitDate(date);
} | [
"public",
"final",
"void",
"setDate",
"(",
"final",
"Date",
"date",
")",
"{",
"this",
".",
"date",
"=",
"(",
"Date",
")",
"date",
".",
"clone",
"(",
")",
";",
"dateStr",
"=",
"ArchiveUtils",
".",
"get14DigitDate",
"(",
"date",
")",
";",
"}"
] | set internal structure using Date argument
@param date from which date should be set | [
"set",
"internal",
"structure",
"using",
"Date",
"argument"
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/util/Timestamp.java#L116-L119 |
120,747 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/util/Timestamp.java | Timestamp.dateStrToDate | public static Date dateStrToDate(final String dateStr) {
String paddedDateStr = padStartDateStr(dateStr);
try {
return ArchiveUtils.parse14DigitDate(paddedDateStr);
} catch (ParseException e) {
e.printStackTrace();
// TODO: This is certainly not the right thing, but padStartDateStr
// should ensure... | java | public static Date dateStrToDate(final String dateStr) {
String paddedDateStr = padStartDateStr(dateStr);
try {
return ArchiveUtils.parse14DigitDate(paddedDateStr);
} catch (ParseException e) {
e.printStackTrace();
// TODO: This is certainly not the right thing, but padStartDateStr
// should ensure... | [
"public",
"static",
"Date",
"dateStrToDate",
"(",
"final",
"String",
"dateStr",
")",
"{",
"String",
"paddedDateStr",
"=",
"padStartDateStr",
"(",
"dateStr",
")",
";",
"try",
"{",
"return",
"ArchiveUtils",
".",
"parse14DigitDate",
"(",
"paddedDateStr",
")",
";",
... | cleanup the dateStr argument assuming earliest values, and return a
GMT calendar set to the time described by the dateStr.
@param dateStr from which to create Calendar
@return Calendar | [
"cleanup",
"the",
"dateStr",
"argument",
"assuming",
"earliest",
"values",
"and",
"return",
"a",
"GMT",
"calendar",
"set",
"to",
"the",
"time",
"described",
"by",
"the",
"dateStr",
"."
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/util/Timestamp.java#L291-L302 |
120,748 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/util/Timestamp.java | Timestamp.padEndDateStr | public static String padEndDateStr(String timestamp) {
return boundTimestamp(padDigits(timestamp,LOWER_TIMESTAMP_LIMIT,
UPPER_TIMESTAMP_LIMIT,UPPER_TIMESTAMP_LIMIT));
} | java | public static String padEndDateStr(String timestamp) {
return boundTimestamp(padDigits(timestamp,LOWER_TIMESTAMP_LIMIT,
UPPER_TIMESTAMP_LIMIT,UPPER_TIMESTAMP_LIMIT));
} | [
"public",
"static",
"String",
"padEndDateStr",
"(",
"String",
"timestamp",
")",
"{",
"return",
"boundTimestamp",
"(",
"padDigits",
"(",
"timestamp",
",",
"LOWER_TIMESTAMP_LIMIT",
",",
"UPPER_TIMESTAMP_LIMIT",
",",
"UPPER_TIMESTAMP_LIMIT",
")",
")",
";",
"}"
] | clean up timestamp argument assuming latest possible values for missing
or bogus digits.
@param timestamp String
@return String | [
"clean",
"up",
"timestamp",
"argument",
"assuming",
"latest",
"possible",
"values",
"for",
"missing",
"or",
"bogus",
"digits",
"."
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/util/Timestamp.java#L388-L391 |
120,749 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/util/Timestamp.java | Timestamp.padStartDateStr | public static String padStartDateStr(String timestamp) {
return boundTimestamp(padDigits(timestamp,LOWER_TIMESTAMP_LIMIT,
UPPER_TIMESTAMP_LIMIT,LOWER_TIMESTAMP_LIMIT));
} | java | public static String padStartDateStr(String timestamp) {
return boundTimestamp(padDigits(timestamp,LOWER_TIMESTAMP_LIMIT,
UPPER_TIMESTAMP_LIMIT,LOWER_TIMESTAMP_LIMIT));
} | [
"public",
"static",
"String",
"padStartDateStr",
"(",
"String",
"timestamp",
")",
"{",
"return",
"boundTimestamp",
"(",
"padDigits",
"(",
"timestamp",
",",
"LOWER_TIMESTAMP_LIMIT",
",",
"UPPER_TIMESTAMP_LIMIT",
",",
"LOWER_TIMESTAMP_LIMIT",
")",
")",
";",
"}"
] | clean up timestamp argument assuming earliest possible values for missing
or bogus digits.
@param timestamp String
@return String | [
"clean",
"up",
"timestamp",
"argument",
"assuming",
"earliest",
"possible",
"values",
"for",
"missing",
"or",
"bogus",
"digits",
"."
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/util/Timestamp.java#L399-L402 |
120,750 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/resourcestore/locationdb/RemoteResourceFileLocationDB.java | RemoteResourceFileLocationDB.nameToUrls | public String[] nameToUrls(final String name) throws IOException {
NameValuePair[] args = {
new NameValuePair(
ResourceFileLocationDBServlet.OPERATION_ARGUMENT,
ResourceFileLocationDBServlet.LOOKUP_OPERATION),
new NameValuePair(
ResourceFileLocationDBServlet.NAME_ARGUMENT,
name)... | java | public String[] nameToUrls(final String name) throws IOException {
NameValuePair[] args = {
new NameValuePair(
ResourceFileLocationDBServlet.OPERATION_ARGUMENT,
ResourceFileLocationDBServlet.LOOKUP_OPERATION),
new NameValuePair(
ResourceFileLocationDBServlet.NAME_ARGUMENT,
name)... | [
"public",
"String",
"[",
"]",
"nameToUrls",
"(",
"final",
"String",
"name",
")",
"throws",
"IOException",
"{",
"NameValuePair",
"[",
"]",
"args",
"=",
"{",
"new",
"NameValuePair",
"(",
"ResourceFileLocationDBServlet",
".",
"OPERATION_ARGUMENT",
",",
"ResourceFileL... | return an array of String URLs for all known locations of the file
in the DB.
@param name
@return String[] of URLs to arcName
@throws IOException | [
"return",
"an",
"array",
"of",
"String",
"URLs",
"for",
"all",
"known",
"locations",
"of",
"the",
"file",
"in",
"the",
"DB",
"."
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/resourcestore/locationdb/RemoteResourceFileLocationDB.java#L112-L128 |
120,751 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/resourcestore/locationdb/RemoteResourceFileLocationDB.java | RemoteResourceFileLocationDB.addNameUrl | public void addNameUrl(final String name, final String url)
throws IOException {
doPostMethod(ResourceFileLocationDBServlet.ADD_OPERATION, name, url);
} | java | public void addNameUrl(final String name, final String url)
throws IOException {
doPostMethod(ResourceFileLocationDBServlet.ADD_OPERATION, name, url);
} | [
"public",
"void",
"addNameUrl",
"(",
"final",
"String",
"name",
",",
"final",
"String",
"url",
")",
"throws",
"IOException",
"{",
"doPostMethod",
"(",
"ResourceFileLocationDBServlet",
".",
"ADD_OPERATION",
",",
"name",
",",
"url",
")",
";",
"}"
] | add an Url location for an arcName, unless it already exists
@param name
@param url
@throws IOException | [
"add",
"an",
"Url",
"location",
"for",
"an",
"arcName",
"unless",
"it",
"already",
"exists"
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/resourcestore/locationdb/RemoteResourceFileLocationDB.java#L137-L140 |
120,752 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/resourcestore/locationdb/RemoteResourceFileLocationDB.java | RemoteResourceFileLocationDB.removeNameUrl | public void removeNameUrl(final String name, final String url)
throws IOException {
doPostMethod(ResourceFileLocationDBServlet.REMOVE_OPERATION, name, url);
} | java | public void removeNameUrl(final String name, final String url)
throws IOException {
doPostMethod(ResourceFileLocationDBServlet.REMOVE_OPERATION, name, url);
} | [
"public",
"void",
"removeNameUrl",
"(",
"final",
"String",
"name",
",",
"final",
"String",
"url",
")",
"throws",
"IOException",
"{",
"doPostMethod",
"(",
"ResourceFileLocationDBServlet",
".",
"REMOVE_OPERATION",
",",
"name",
",",
"url",
")",
";",
"}"
] | remove a single url location for a name, if it exists
@param name
@param url
@throws IOException | [
"remove",
"a",
"single",
"url",
"location",
"for",
"a",
"name",
"if",
"it",
"exists"
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/resourcestore/locationdb/RemoteResourceFileLocationDB.java#L148-L151 |
120,753 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/replay/RangeResource.java | RangeResource.parseRange | public void parseRange() throws RangeNotSatisfiableException, IOException {
if (requestedRanges.length > 1) {
throw new RangeNotSatisfiableException(origResource, requestedRanges,
"Multiple ranges are not supported yet");
}
final long[] firstRange = requestedRanges[0];
long start = firstRange[0];
long ... | java | public void parseRange() throws RangeNotSatisfiableException, IOException {
if (requestedRanges.length > 1) {
throw new RangeNotSatisfiableException(origResource, requestedRanges,
"Multiple ranges are not supported yet");
}
final long[] firstRange = requestedRanges[0];
long start = firstRange[0];
long ... | [
"public",
"void",
"parseRange",
"(",
")",
"throws",
"RangeNotSatisfiableException",
",",
"IOException",
"{",
"if",
"(",
"requestedRanges",
".",
"length",
">",
"1",
")",
"{",
"throw",
"new",
"RangeNotSatisfiableException",
"(",
"origResource",
",",
"requestedRanges",... | Prepare response for requested range.
@throws RangeNotSatisfiableException base Resource either does not have
enough data to fulfill the request, or have invalid header field. | [
"Prepare",
"response",
"for",
"requested",
"range",
"."
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/replay/RangeResource.java#L72-L120 |
120,754 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/replay/RangeResource.java | RangeResource.availableRange | protected long[] availableRange() {
// for revisit capture, HTTP headers comes from revisiting resource.
// it should be okay to assume revisited resource has exactly the same
// Content-Range header field.
Map<String, String> respHeaders = origResource.getHttpHeaders();
long[] contentRange = HttpHeaderOperat... | java | protected long[] availableRange() {
// for revisit capture, HTTP headers comes from revisiting resource.
// it should be okay to assume revisited resource has exactly the same
// Content-Range header field.
Map<String, String> respHeaders = origResource.getHttpHeaders();
long[] contentRange = HttpHeaderOperat... | [
"protected",
"long",
"[",
"]",
"availableRange",
"(",
")",
"{",
"// for revisit capture, HTTP headers comes from revisiting resource.",
"// it should be okay to assume revisited resource has exactly the same",
"// Content-Range header field.",
"Map",
"<",
"String",
",",
"String",
">"... | Look at resource HTTP header fields and determine the byte range available.
@return array with three long values:
<ol>
<li><em>offset of first available byte</em>,
<li><em>offset of last available byte</em> + 1,
<li><em>instance-length</em>
</ol>
Note this method returns {@code null} for {@code multipart/byteranges}
re... | [
"Look",
"at",
"resource",
"HTTP",
"header",
"fields",
"and",
"determine",
"the",
"byte",
"range",
"available",
"."
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/replay/RangeResource.java#L133-L175 |
120,755 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/core/WaybackRequest.java | WaybackRequest.createUrlQueryRequest | public static WaybackRequest createUrlQueryRequest(String url, String start, String end) {
WaybackRequest r = new WaybackRequest();
r.setUrlQueryRequest();
r.setRequestUrl(url);
r.setStartTimestamp(start);
r.setEndTimestamp(end);
return r;
} | java | public static WaybackRequest createUrlQueryRequest(String url, String start, String end) {
WaybackRequest r = new WaybackRequest();
r.setUrlQueryRequest();
r.setRequestUrl(url);
r.setStartTimestamp(start);
r.setEndTimestamp(end);
return r;
} | [
"public",
"static",
"WaybackRequest",
"createUrlQueryRequest",
"(",
"String",
"url",
",",
"String",
"start",
",",
"String",
"end",
")",
"{",
"WaybackRequest",
"r",
"=",
"new",
"WaybackRequest",
"(",
")",
";",
"r",
".",
"setUrlQueryRequest",
"(",
")",
";",
"r... | create WaybackRequet for URL-Query request.
@param url target URL
@param start start timestamp (14-digit)
@param end end timestamp (14-digit)
@return WaybackRequest | [
"create",
"WaybackRequet",
"for",
"URL",
"-",
"Query",
"request",
"."
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/core/WaybackRequest.java#L469-L476 |
120,756 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/core/WaybackRequest.java | WaybackRequest.createCaptureQueryRequet | public static WaybackRequest createCaptureQueryRequet(String url, String replay, String start, String end) {
WaybackRequest r = new WaybackRequest();
r.setCaptureQueryRequest();
r.setRequestUrl(url);
r.setReplayTimestamp(replay);
r.setStartTimestamp(start);
r.setEndTimestamp(end);
return r;
} | java | public static WaybackRequest createCaptureQueryRequet(String url, String replay, String start, String end) {
WaybackRequest r = new WaybackRequest();
r.setCaptureQueryRequest();
r.setRequestUrl(url);
r.setReplayTimestamp(replay);
r.setStartTimestamp(start);
r.setEndTimestamp(end);
return r;
} | [
"public",
"static",
"WaybackRequest",
"createCaptureQueryRequet",
"(",
"String",
"url",
",",
"String",
"replay",
",",
"String",
"start",
",",
"String",
"end",
")",
"{",
"WaybackRequest",
"r",
"=",
"new",
"WaybackRequest",
"(",
")",
";",
"r",
".",
"setCaptureQu... | create WaybackRequest for Capture-Query request.
@param url target URL
@param replay highlight date
@param start start timestamp (14-digit)
@param end end timestamp (14-digit)
@return WaybackRequest | [
"create",
"WaybackRequest",
"for",
"Capture",
"-",
"Query",
"request",
"."
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/core/WaybackRequest.java#L486-L494 |
120,757 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/core/WaybackRequest.java | WaybackRequest.createReplayRequest | public static WaybackRequest createReplayRequest(String url, String replay, String start, String end) {
WaybackRequest r = new WaybackRequest();
r.setReplayRequest();
r.setRequestUrl(url);
r.setReplayTimestamp(replay);
r.setStartTimestamp(start);
r.setEndTimestamp(end);
return r;
} | java | public static WaybackRequest createReplayRequest(String url, String replay, String start, String end) {
WaybackRequest r = new WaybackRequest();
r.setReplayRequest();
r.setRequestUrl(url);
r.setReplayTimestamp(replay);
r.setStartTimestamp(start);
r.setEndTimestamp(end);
return r;
} | [
"public",
"static",
"WaybackRequest",
"createReplayRequest",
"(",
"String",
"url",
",",
"String",
"replay",
",",
"String",
"start",
",",
"String",
"end",
")",
"{",
"WaybackRequest",
"r",
"=",
"new",
"WaybackRequest",
"(",
")",
";",
"r",
".",
"setReplayRequest"... | create WaybackRequet for Replay request.
@param url target URL
@param replay requested date
@param start start timestamp (14-digit)
@param end end timestamp (14-digit)
@return WaybackRequet | [
"create",
"WaybackRequet",
"for",
"Replay",
"request",
"."
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/core/WaybackRequest.java#L503-L511 |
120,758 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/core/WaybackRequest.java | WaybackRequest.setRequestUrl | public void setRequestUrl(String urlStr) {
// This looks a little confusing: We're trying to fixup an incoming
// request URL that starts with:
// "http(s):/www.archive.org"
// so it becomes:
// "http(s)://www.archive.org"
// (note the missing second "/" in the first)
//
// if that is not... | java | public void setRequestUrl(String urlStr) {
// This looks a little confusing: We're trying to fixup an incoming
// request URL that starts with:
// "http(s):/www.archive.org"
// so it becomes:
// "http(s)://www.archive.org"
// (note the missing second "/" in the first)
//
// if that is not... | [
"public",
"void",
"setRequestUrl",
"(",
"String",
"urlStr",
")",
"{",
"// This looks a little confusing: We're trying to fixup an incoming",
"// request URL that starts with: ",
"// \"http(s):/www.archive.org\"",
"// so it becomes:",
"// \"http(s)://www.archive.org\"",
"// (not... | Set the request URL.
@param urlStr Request URL. | [
"Set",
"the",
"request",
"URL",
"."
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/core/WaybackRequest.java#L753-L803 |
120,759 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/core/WaybackRequest.java | WaybackRequest.extractHttpRequestInfo | public void extractHttpRequestInfo(HttpServletRequest httpRequest) {
putUnlessNull(REQUEST_REFERER_URL, httpRequest.getHeader("REFERER"));
String remoteAddr = httpRequest.getHeader("X-Forwarded-For");
remoteAddr = (remoteAddr == null) ?
httpRequest.getRemoteAddr() :
remoteAddr + ", " + httpRequest.ge... | java | public void extractHttpRequestInfo(HttpServletRequest httpRequest) {
putUnlessNull(REQUEST_REFERER_URL, httpRequest.getHeader("REFERER"));
String remoteAddr = httpRequest.getHeader("X-Forwarded-For");
remoteAddr = (remoteAddr == null) ?
httpRequest.getRemoteAddr() :
remoteAddr + ", " + httpRequest.ge... | [
"public",
"void",
"extractHttpRequestInfo",
"(",
"HttpServletRequest",
"httpRequest",
")",
"{",
"putUnlessNull",
"(",
"REQUEST_REFERER_URL",
",",
"httpRequest",
".",
"getHeader",
"(",
"\"REFERER\"",
")",
")",
";",
"String",
"remoteAddr",
"=",
"httpRequest",
".",
"ge... | extract REFERER, remote IP and authorization information from the
HttpServletRequest
@param httpRequest
@throws BadQueryException | [
"extract",
"REFERER",
"remote",
"IP",
"and",
"authorization",
"information",
"from",
"the",
"HttpServletRequest"
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/core/WaybackRequest.java#L1121-L1183 |
120,760 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/util/webapp/PortMapper.java | PortMapper.addRequestHandler | public void addRequestHandler(String host, String firstPath,
RequestHandler requestHandler) {
String key = hostPathToKey(host, firstPath);
if (pathMap.containsKey(key)) {
LOGGER.warning("Duplicate port:path map for " + port +
":" + key);
} else {
pathMap.put(key, requestHandler);
if (LOGGER.isLo... | java | public void addRequestHandler(String host, String firstPath,
RequestHandler requestHandler) {
String key = hostPathToKey(host, firstPath);
if (pathMap.containsKey(key)) {
LOGGER.warning("Duplicate port:path map for " + port +
":" + key);
} else {
pathMap.put(key, requestHandler);
if (LOGGER.isLo... | [
"public",
"void",
"addRequestHandler",
"(",
"String",
"host",
",",
"String",
"firstPath",
",",
"RequestHandler",
"requestHandler",
")",
"{",
"String",
"key",
"=",
"hostPathToKey",
"(",
"host",
",",
"firstPath",
")",
";",
"if",
"(",
"pathMap",
".",
"containsKey... | Register the RequestHandler to accept requests for the given host and
port.
@param host the HTTP 1.1 "Host" header which the RequestHandler should
match. If null, the RequestHandler matches any "Host" header value.
@param firstPath the first path of the GET request path which the
RequestHandler should match. This is th... | [
"Register",
"the",
"RequestHandler",
"to",
"accept",
"requests",
"for",
"the",
"given",
"host",
"and",
"port",
"."
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/util/webapp/PortMapper.java#L78-L91 |
120,761 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/resourcestore/indexer/IndexQueueUpdater.java | IndexQueueUpdater.updateQueue | public int updateQueue() throws IOException {
int added = 0;
long lastMarkPoint = lastMark.getLastMark();
long currentMarkPoint = db.getCurrentMark();
if(currentMarkPoint > lastMarkPoint) {
// TODO: touchy touchy... need transactions here to not have
// state sync problems if something goes badly in this... | java | public int updateQueue() throws IOException {
int added = 0;
long lastMarkPoint = lastMark.getLastMark();
long currentMarkPoint = db.getCurrentMark();
if(currentMarkPoint > lastMarkPoint) {
// TODO: touchy touchy... need transactions here to not have
// state sync problems if something goes badly in this... | [
"public",
"int",
"updateQueue",
"(",
")",
"throws",
"IOException",
"{",
"int",
"added",
"=",
"0",
";",
"long",
"lastMarkPoint",
"=",
"lastMark",
".",
"getLastMark",
"(",
")",
";",
"long",
"currentMarkPoint",
"=",
"db",
".",
"getCurrentMark",
"(",
")",
";",... | Add new names to the IndexQueue.
@return The number of items added to the queue.
@throws IOException | [
"Add",
"new",
"names",
"to",
"the",
"IndexQueue",
"."
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/resourcestore/indexer/IndexQueueUpdater.java#L84-L105 |
120,762 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/util/bdb/BDBMap.java | BDBMap.getTimestampForId | public static String getTimestampForId(String context, String ip) {
BDBMap bdbMap = getContextMap(context);
String dateStr = bdbMap.get(ip);
return (dateStr != null) ? dateStr : Timestamp.currentTimestamp().getDateStr();
} | java | public static String getTimestampForId(String context, String ip) {
BDBMap bdbMap = getContextMap(context);
String dateStr = bdbMap.get(ip);
return (dateStr != null) ? dateStr : Timestamp.currentTimestamp().getDateStr();
} | [
"public",
"static",
"String",
"getTimestampForId",
"(",
"String",
"context",
",",
"String",
"ip",
")",
"{",
"BDBMap",
"bdbMap",
"=",
"getContextMap",
"(",
"context",
")",
";",
"String",
"dateStr",
"=",
"bdbMap",
".",
"get",
"(",
"ip",
")",
";",
"return",
... | return the timestamp associated with the identifier argument, or now
if no value is associated or something goes wrong.
@param context
@param ip
@return timestamp string value | [
"return",
"the",
"timestamp",
"associated",
"with",
"the",
"identifier",
"argument",
"or",
"now",
"if",
"no",
"value",
"is",
"associated",
"or",
"something",
"goes",
"wrong",
"."
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/util/bdb/BDBMap.java#L155-L159 |
120,763 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/util/bdb/BDBMap.java | BDBMap.addTimestampForId | public static void addTimestampForId(String context, String ip, String time) {
BDBMap bdbMap = getContextMap(context);
bdbMap.put(ip, time);
} | java | public static void addTimestampForId(String context, String ip, String time) {
BDBMap bdbMap = getContextMap(context);
bdbMap.put(ip, time);
} | [
"public",
"static",
"void",
"addTimestampForId",
"(",
"String",
"context",
",",
"String",
"ip",
",",
"String",
"time",
")",
"{",
"BDBMap",
"bdbMap",
"=",
"getContextMap",
"(",
"context",
")",
";",
"bdbMap",
".",
"put",
"(",
"ip",
",",
"time",
")",
";",
... | associate timestamp time with idenfier ip persistantly
@param context
@param ip
@param time | [
"associate",
"timestamp",
"time",
"with",
"idenfier",
"ip",
"persistantly"
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/util/bdb/BDBMap.java#L167-L170 |
120,764 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/replay/SelectorReplayDispatcher.java | SelectorReplayDispatcher.shouldDetectMimeType | protected boolean shouldDetectMimeType(String mimeType) {
for (String prefix : untrustfulMimeTypes) {
if (mimeType.startsWith(prefix)) return true;
}
return false;
} | java | protected boolean shouldDetectMimeType(String mimeType) {
for (String prefix : untrustfulMimeTypes) {
if (mimeType.startsWith(prefix)) return true;
}
return false;
} | [
"protected",
"boolean",
"shouldDetectMimeType",
"(",
"String",
"mimeType",
")",
"{",
"for",
"(",
"String",
"prefix",
":",
"untrustfulMimeTypes",
")",
"{",
"if",
"(",
"mimeType",
".",
"startsWith",
"(",
"prefix",
")",
")",
"return",
"true",
";",
"}",
"return"... | check if mime-type detection is suggested for mimeType.
@param mimeType mime-type to test (must not be null/empty/"unk")
@return {@code true} if mime-type should be determined
by looking into Resource. | [
"check",
"if",
"mime",
"-",
"type",
"detection",
"is",
"suggested",
"for",
"mimeType",
"."
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/replay/SelectorReplayDispatcher.java#L106-L111 |
120,765 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/resourceindex/NutchResourceIndex.java | NutchResourceIndex.getNodeContent | protected String getNodeContent(Element e, String key) {
NodeList nodes = e.getElementsByTagName(key);
String result = null;
if (nodes != null && nodes.getLength() > 0) {
result = getNodeTextValue(nodes.item(0));
}
return (result == null || result.length() == 0)? null: resu... | java | protected String getNodeContent(Element e, String key) {
NodeList nodes = e.getElementsByTagName(key);
String result = null;
if (nodes != null && nodes.getLength() > 0) {
result = getNodeTextValue(nodes.item(0));
}
return (result == null || result.length() == 0)? null: resu... | [
"protected",
"String",
"getNodeContent",
"(",
"Element",
"e",
",",
"String",
"key",
")",
"{",
"NodeList",
"nodes",
"=",
"e",
".",
"getElementsByTagName",
"(",
"key",
")",
";",
"String",
"result",
"=",
"null",
";",
"if",
"(",
"nodes",
"!=",
"null",
"&&",
... | extract the text content of a single tag under a node | [
"extract",
"the",
"text",
"content",
"of",
"a",
"single",
"tag",
"under",
"a",
"node"
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/resourceindex/NutchResourceIndex.java#L318-L325 |
120,766 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/resourcestore/locationdb/BDBResourceFileLocationDB.java | BDBResourceFileLocationDB.nameToUrls | public String[] nameToUrls(final String name) throws IOException {
String[] urls = null;
String valueString = get(name);
if(valueString != null && valueString.length() > 0) {
urls = valueString.split(urlDelimiterRE);
}
return urls;
} | java | public String[] nameToUrls(final String name) throws IOException {
String[] urls = null;
String valueString = get(name);
if(valueString != null && valueString.length() > 0) {
urls = valueString.split(urlDelimiterRE);
}
return urls;
} | [
"public",
"String",
"[",
"]",
"nameToUrls",
"(",
"final",
"String",
"name",
")",
"throws",
"IOException",
"{",
"String",
"[",
"]",
"urls",
"=",
"null",
";",
"String",
"valueString",
"=",
"get",
"(",
"name",
")",
";",
"if",
"(",
"valueString",
"!=",
"nu... | return an array of String URLs for all known locations of name in the DB.
@param name
@return String[] of URLs to name
@throws IOException | [
"return",
"an",
"array",
"of",
"String",
"URLs",
"for",
"all",
"known",
"locations",
"of",
"name",
"in",
"the",
"DB",
"."
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/resourcestore/locationdb/BDBResourceFileLocationDB.java#L97-L105 |
120,767 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/resourcestore/locationdb/BDBResourceFileLocationDB.java | BDBResourceFileLocationDB.addNameUrl | public void addNameUrl(final String name, final String url)
throws IOException {
// need to first see if there is already an entry for this name.
// if not, add url as the value.
// if so, check the current url locations for name
// if url exists, do nothing
// if url does not exist, add, and set... | java | public void addNameUrl(final String name, final String url)
throws IOException {
// need to first see if there is already an entry for this name.
// if not, add url as the value.
// if so, check the current url locations for name
// if url exists, do nothing
// if url does not exist, add, and set... | [
"public",
"void",
"addNameUrl",
"(",
"final",
"String",
"name",
",",
"final",
"String",
"url",
")",
"throws",
"IOException",
"{",
"// need to first see if there is already an entry for this name.",
"// if not, add url as the value.",
"// if so, check the current url locations for n... | add an url location for a name, unless it already exists
@param name
@param url
@throws IOException | [
"add",
"an",
"url",
"location",
"for",
"a",
"name",
"unless",
"it",
"already",
"exists"
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/resourcestore/locationdb/BDBResourceFileLocationDB.java#L113-L146 |
120,768 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/resourcestore/locationdb/BDBResourceFileLocationDB.java | BDBResourceFileLocationDB.removeNameUrl | public void removeNameUrl(final String name, final String url)
throws IOException {
// need to first see if there is already an entry for this name.
// if not, do nothing
// if so, loop thru all current url locations for name
// keep any that are not url
// if any locations are left, update to the new v... | java | public void removeNameUrl(final String name, final String url)
throws IOException {
// need to first see if there is already an entry for this name.
// if not, do nothing
// if so, loop thru all current url locations for name
// keep any that are not url
// if any locations are left, update to the new v... | [
"public",
"void",
"removeNameUrl",
"(",
"final",
"String",
"name",
",",
"final",
"String",
"url",
")",
"throws",
"IOException",
"{",
"// need to first see if there is already an entry for this name.",
"// if not, do nothing",
"// if so, loop thru all current url locations for name"... | remove a single url location for an name, if it exists
@param name
@param url
@throws IOException | [
"remove",
"a",
"single",
"url",
"location",
"for",
"an",
"name",
"if",
"it",
"exists"
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/resourcestore/locationdb/BDBResourceFileLocationDB.java#L154-L188 |
120,769 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/archivalurl/ArchivalUrl.java | ArchivalUrl.getDateSpec | public static String getDateSpec(WaybackRequest wbRequest, String datespec) {
int dateLen = 0;
if(datespec != null) {
dateLen = datespec.length();
}
StringBuilder sb =
new StringBuilder(dateLen +10);
if(dateLen > 0) {
sb.append(datespec);
}
if(wbRequest.isCSSContext()) {
sb.append(ArchivalUr... | java | public static String getDateSpec(WaybackRequest wbRequest, String datespec) {
int dateLen = 0;
if(datespec != null) {
dateLen = datespec.length();
}
StringBuilder sb =
new StringBuilder(dateLen +10);
if(dateLen > 0) {
sb.append(datespec);
}
if(wbRequest.isCSSContext()) {
sb.append(ArchivalUr... | [
"public",
"static",
"String",
"getDateSpec",
"(",
"WaybackRequest",
"wbRequest",
",",
"String",
"datespec",
")",
"{",
"int",
"dateLen",
"=",
"0",
";",
"if",
"(",
"datespec",
"!=",
"null",
")",
"{",
"dateLen",
"=",
"datespec",
".",
"length",
"(",
")",
";"... | Given a date, create a new datespec + flags
which represent the same options as requested by the WaybackRequest
@param wbRequest
@param datespec The date specification prefix.
@return a String representing the flags on the WaybackRequest for the
specified date | [
"Given",
"a",
"date",
"create",
"a",
"new",
"datespec",
"+",
"flags",
"which",
"represent",
"the",
"same",
"options",
"as",
"requested",
"by",
"the",
"WaybackRequest"
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/archivalurl/ArchivalUrl.java#L115-L162 |
120,770 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/accesscontrol/staticmap/StaticMapExclusionFilter.java | StaticMapExclusionFilter.setFilterGroup | @Override
public void setFilterGroup(ExclusionCaptureFilterGroup filterGroup) {
super.setFilterGroup(filterGroup);
if ((filterGroup != null) && (filterGroup.getCaptureFilterGroupCanonicalizer() != null)) {
this.canonicalizer = filterGroup.getCaptureFilterGroupCanonicalizer();
}
} | java | @Override
public void setFilterGroup(ExclusionCaptureFilterGroup filterGroup) {
super.setFilterGroup(filterGroup);
if ((filterGroup != null) && (filterGroup.getCaptureFilterGroupCanonicalizer() != null)) {
this.canonicalizer = filterGroup.getCaptureFilterGroupCanonicalizer();
}
} | [
"@",
"Override",
"public",
"void",
"setFilterGroup",
"(",
"ExclusionCaptureFilterGroup",
"filterGroup",
")",
"{",
"super",
".",
"setFilterGroup",
"(",
"filterGroup",
")",
";",
"if",
"(",
"(",
"filterGroup",
"!=",
"null",
")",
"&&",
"(",
"filterGroup",
".",
"ge... | Set the canonicalizer from the filter, as it may be different from the default | [
"Set",
"the",
"canonicalizer",
"from",
"the",
"filter",
"as",
"it",
"may",
"be",
"different",
"from",
"the",
"default"
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/accesscontrol/staticmap/StaticMapExclusionFilter.java#L59-L65 |
120,771 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/webapp/DefaultLiveWebRedirector.java | DefaultLiveWebRedirector.handleRedirect | @Override
public LiveWebState handleRedirect(WaybackException e, WaybackRequest wbRequest, HttpServletRequest httpRequest, HttpServletResponse httpResponse) throws IOException
{
if (statusLiveWebPolicy == null) {
return LiveWebState.NOT_FOUND;
}
// Don't do any redirect for identity context or if no handl... | java | @Override
public LiveWebState handleRedirect(WaybackException e, WaybackRequest wbRequest, HttpServletRequest httpRequest, HttpServletResponse httpResponse) throws IOException
{
if (statusLiveWebPolicy == null) {
return LiveWebState.NOT_FOUND;
}
// Don't do any redirect for identity context or if no handl... | [
"@",
"Override",
"public",
"LiveWebState",
"handleRedirect",
"(",
"WaybackException",
"e",
",",
"WaybackRequest",
"wbRequest",
",",
"HttpServletRequest",
"httpRequest",
",",
"HttpServletResponse",
"httpResponse",
")",
"throws",
"IOException",
"{",
"if",
"(",
"statusLive... | Check the statusLiveWebType to see if, given the WaybackExceptions
status code, should redirect ALL, NONE or EMBEDS_ONLY
Before redirecting, will always check with liveweb to see if it returns a 200 request,
then redirect to same request, resulting in 2 checks to liveweb
"default" property is checked if no property i... | [
"Check",
"the",
"statusLiveWebType",
"to",
"see",
"if",
"given",
"the",
"WaybackExceptions",
"status",
"code",
"should",
"redirect",
"ALL",
"NONE",
"or",
"EMBEDS_ONLY"
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/webapp/DefaultLiveWebRedirector.java#L48-L116 |
120,772 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/query/resultspartitioner/ResultsPartition.java | ResultsPartition.filter | public void filter(CaptureSearchResults results) {
Iterator<CaptureSearchResult> itr = results.iterator();
while(itr.hasNext()) {
CaptureSearchResult result = itr.next();
String captureDate = result.getCaptureTimestamp();
if((captureDate.compareTo(startDateStr) >= 0)
&& (captureDate.compareTo(endDate... | java | public void filter(CaptureSearchResults results) {
Iterator<CaptureSearchResult> itr = results.iterator();
while(itr.hasNext()) {
CaptureSearchResult result = itr.next();
String captureDate = result.getCaptureTimestamp();
if((captureDate.compareTo(startDateStr) >= 0)
&& (captureDate.compareTo(endDate... | [
"public",
"void",
"filter",
"(",
"CaptureSearchResults",
"results",
")",
"{",
"Iterator",
"<",
"CaptureSearchResult",
">",
"itr",
"=",
"results",
".",
"iterator",
"(",
")",
";",
"while",
"(",
"itr",
".",
"hasNext",
"(",
")",
")",
"{",
"CaptureSearchResult",
... | add all SearchResult objects from the SearchResults which fall
within the time range of this partition into this partition.
@param results | [
"add",
"all",
"SearchResult",
"objects",
"from",
"the",
"SearchResults",
"which",
"fall",
"within",
"the",
"time",
"range",
"of",
"this",
"partition",
"into",
"this",
"partition",
"."
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/query/resultspartitioner/ResultsPartition.java#L67-L77 |
120,773 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/util/ByteOp.java | ByteOp.copy | public static byte[] copy(byte[] src, int offset, int length) {
byte[] copy = new byte[length];
System.arraycopy(src, offset, copy, 0, length);
return copy;
} | java | public static byte[] copy(byte[] src, int offset, int length) {
byte[] copy = new byte[length];
System.arraycopy(src, offset, copy, 0, length);
return copy;
} | [
"public",
"static",
"byte",
"[",
"]",
"copy",
"(",
"byte",
"[",
"]",
"src",
",",
"int",
"offset",
",",
"int",
"length",
")",
"{",
"byte",
"[",
"]",
"copy",
"=",
"new",
"byte",
"[",
"length",
"]",
";",
"System",
".",
"arraycopy",
"(",
"src",
",",
... | Create a new byte array with contents initialized to values from the
argument byte array.
@param src source byte array of initial values
@param offset start offset to copy bytes
@param length number of bytes to copy
@return a new byte array of size length, containing values from src
starting from offset in the src arra... | [
"Create",
"a",
"new",
"byte",
"array",
"with",
"contents",
"initialized",
"to",
"values",
"from",
"the",
"argument",
"byte",
"array",
"."
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/util/ByteOp.java#L48-L52 |
120,774 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/util/ByteOp.java | ByteOp.cmp | public static boolean cmp(byte[] a, byte[] b) {
if(a.length != b.length) {
return false;
}
for(int i = 0; i < a.length; i++) {
if(a[i] != b[i]) {
return false;
}
}
return true;
} | java | public static boolean cmp(byte[] a, byte[] b) {
if(a.length != b.length) {
return false;
}
for(int i = 0; i < a.length; i++) {
if(a[i] != b[i]) {
return false;
}
}
return true;
} | [
"public",
"static",
"boolean",
"cmp",
"(",
"byte",
"[",
"]",
"a",
",",
"byte",
"[",
"]",
"b",
")",
"{",
"if",
"(",
"a",
".",
"length",
"!=",
"b",
".",
"length",
")",
"{",
"return",
"false",
";",
"}",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"... | Compare two byte arrays
@param a byte array to compare
@param b byte array to compare
@return true if a and b have same length, and all the same values, false
otherwise | [
"Compare",
"two",
"byte",
"arrays"
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/util/ByteOp.java#L61-L71 |
120,775 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/util/ByteOp.java | ByteOp.discardStream | public static void discardStream(InputStream is,int size) throws IOException {
byte[] buffer = new byte[size];
while(is.read(buffer, 0, size) != -1) {
}
} | java | public static void discardStream(InputStream is,int size) throws IOException {
byte[] buffer = new byte[size];
while(is.read(buffer, 0, size) != -1) {
}
} | [
"public",
"static",
"void",
"discardStream",
"(",
"InputStream",
"is",
",",
"int",
"size",
")",
"throws",
"IOException",
"{",
"byte",
"[",
"]",
"buffer",
"=",
"new",
"byte",
"[",
"size",
"]",
";",
"while",
"(",
"is",
".",
"read",
"(",
"buffer",
",",
... | throw away all bytes from stream argument
@param is InputStream to read and discard
@param size number of bytes to read at once from the stream
@throws IOException when is throws one | [
"throw",
"away",
"all",
"bytes",
"from",
"stream",
"argument"
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/util/ByteOp.java#L88-L92 |
120,776 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/util/ByteOp.java | ByteOp.discardStreamCount | public static long discardStreamCount(InputStream is,int size) throws IOException {
long count = 0;
byte[] buffer = new byte[size];
int amt = 0;
while((amt = is.read(buffer, 0, size)) != -1) {
count += amt;
}
return count;
} | java | public static long discardStreamCount(InputStream is,int size) throws IOException {
long count = 0;
byte[] buffer = new byte[size];
int amt = 0;
while((amt = is.read(buffer, 0, size)) != -1) {
count += amt;
}
return count;
} | [
"public",
"static",
"long",
"discardStreamCount",
"(",
"InputStream",
"is",
",",
"int",
"size",
")",
"throws",
"IOException",
"{",
"long",
"count",
"=",
"0",
";",
"byte",
"[",
"]",
"buffer",
"=",
"new",
"byte",
"[",
"size",
"]",
";",
"int",
"amt",
"=",... | throw away all bytes from stream argument, and count how many bytes were
discarded before reaching the end of the stream.
@param is InputStream to read and discard
@param size number of bytes to read at once from the stream
@return the number of bytes discarded
@throws IOException when is throws one | [
"throw",
"away",
"all",
"bytes",
"from",
"stream",
"argument",
"and",
"count",
"how",
"many",
"bytes",
"were",
"discarded",
"before",
"reaching",
"the",
"end",
"of",
"the",
"stream",
"."
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/util/ByteOp.java#L113-L121 |
120,777 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/util/BitArray.java | BitArray.set | public void set(int i, boolean value) {
int idx = i / 8;
if(idx >= bb.limit()) {
throw new IndexOutOfBoundsException();
}
int bit = 7 - (i % 8);
if(value) {
bb.put(idx, (byte) (bb.get(idx) | MASKS[bit]));
} else {
bb.put(idx,(byte) (bb.get(idx) & MASKSR[bit]));
}
} | java | public void set(int i, boolean value) {
int idx = i / 8;
if(idx >= bb.limit()) {
throw new IndexOutOfBoundsException();
}
int bit = 7 - (i % 8);
if(value) {
bb.put(idx, (byte) (bb.get(idx) | MASKS[bit]));
} else {
bb.put(idx,(byte) (bb.get(idx) & MASKSR[bit]));
}
} | [
"public",
"void",
"set",
"(",
"int",
"i",
",",
"boolean",
"value",
")",
"{",
"int",
"idx",
"=",
"i",
"/",
"8",
";",
"if",
"(",
"idx",
">=",
"bb",
".",
"limit",
"(",
")",
")",
"{",
"throw",
"new",
"IndexOutOfBoundsException",
"(",
")",
";",
"}",
... | set the i'th bit to 1 or 0
@param i bit number to set
@param value if true, the bit is set to 1, otherwise it is set to 0 | [
"set",
"the",
"i",
"th",
"bit",
"to",
"1",
"or",
"0"
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/util/BitArray.java#L109-L120 |
120,778 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/replay/TagMagix.java | TagMagix.getTagAttr | public static String getTagAttr(StringBuilder page, final String tag,
final String attr) {
String found = null;
Pattern daPattern = TagMagix.getPattern(tag, attr);
Matcher matcher = daPattern.matcher(page);
int idx = 0;
if (matcher.find(idx)) {
found = matcher.group(1);
found = trimAttrValue(found)... | java | public static String getTagAttr(StringBuilder page, final String tag,
final String attr) {
String found = null;
Pattern daPattern = TagMagix.getPattern(tag, attr);
Matcher matcher = daPattern.matcher(page);
int idx = 0;
if (matcher.find(idx)) {
found = matcher.group(1);
found = trimAttrValue(found)... | [
"public",
"static",
"String",
"getTagAttr",
"(",
"StringBuilder",
"page",
",",
"final",
"String",
"tag",
",",
"final",
"String",
"attr",
")",
"{",
"String",
"found",
"=",
"null",
";",
"Pattern",
"daPattern",
"=",
"TagMagix",
".",
"getPattern",
"(",
"tag",
... | find and return the ATTR value within a TAG tag inside the HTML document
within the StringBuffer page. returns null if no TAG-ATTR is found.
@param page
@param tag
@param attr
@return URL of base-href within page, or null if none is found. | [
"find",
"and",
"return",
"the",
"ATTR",
"value",
"within",
"a",
"TAG",
"tag",
"inside",
"the",
"HTML",
"document",
"within",
"the",
"StringBuffer",
"page",
".",
"returns",
"null",
"if",
"no",
"TAG",
"-",
"ATTR",
"is",
"found",
"."
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/replay/TagMagix.java#L305-L319 |
120,779 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/replay/TagMagix.java | TagMagix.getTagAttrWhere | public static String getTagAttrWhere(StringBuilder page, final String tag,
final String findAttr, final String whereAttr, final String whereVal) {
Pattern tagPattern = getWholeTagPattern(tag);
Pattern findAttrPattern = getAttrPattern(findAttr);
Pattern whereAttrPattern = getAttrPattern(whereAttr);
Matcher t... | java | public static String getTagAttrWhere(StringBuilder page, final String tag,
final String findAttr, final String whereAttr, final String whereVal) {
Pattern tagPattern = getWholeTagPattern(tag);
Pattern findAttrPattern = getAttrPattern(findAttr);
Pattern whereAttrPattern = getAttrPattern(whereAttr);
Matcher t... | [
"public",
"static",
"String",
"getTagAttrWhere",
"(",
"StringBuilder",
"page",
",",
"final",
"String",
"tag",
",",
"final",
"String",
"findAttr",
",",
"final",
"String",
"whereAttr",
",",
"final",
"String",
"whereVal",
")",
"{",
"Pattern",
"tagPattern",
"=",
"... | Search through the HTML contained in page, returning the value of a
particular attribute. This version allows matching only tags that contain
a particular attribute-value pair, which is useful in extracting META tag
values, for example, in returning the value of the "content" attribute in
a META tag that also contains ... | [
"Search",
"through",
"the",
"HTML",
"contained",
"in",
"page",
"returning",
"the",
"value",
"of",
"a",
"particular",
"attribute",
".",
"This",
"version",
"allows",
"matching",
"only",
"tags",
"that",
"contain",
"a",
"particular",
"attribute",
"-",
"value",
"pa... | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/replay/TagMagix.java#L347-L377 |
120,780 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/util/url/UrlOperations.java | UrlOperations.isAuthority | public static boolean isAuthority(String authString) {
Matcher m = AUTHORITY_REGEX.matcher(authString);
return (m != null) && m.matches();
} | java | public static boolean isAuthority(String authString) {
Matcher m = AUTHORITY_REGEX.matcher(authString);
return (m != null) && m.matches();
} | [
"public",
"static",
"boolean",
"isAuthority",
"(",
"String",
"authString",
")",
"{",
"Matcher",
"m",
"=",
"AUTHORITY_REGEX",
".",
"matcher",
"(",
"authString",
")",
";",
"return",
"(",
"m",
"!=",
"null",
")",
"&&",
"m",
".",
"matches",
"(",
")",
";",
"... | Tests if the String argument looks like it could be a legitimate
authority fragment of a URL, that is, is it an IP address, or, are the
characters legal in an authority, and does the string end with a legal
TLD.
@param authString String representation of a fragment of a URL
@return boolean indicating whether urlPart m... | [
"Tests",
"if",
"the",
"String",
"argument",
"looks",
"like",
"it",
"could",
"be",
"a",
"legitimate",
"authority",
"fragment",
"of",
"a",
"URL",
"that",
"is",
"is",
"it",
"an",
"IP",
"address",
"or",
"are",
"the",
"characters",
"legal",
"in",
"an",
"autho... | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/util/url/UrlOperations.java#L148-L152 |
120,781 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/util/url/UrlOperations.java | UrlOperations.resolveUrl | public static String resolveUrl(String baseUrl, String url) {
String resolvedUrl = resolveUrl(baseUrl, url, null);
if (resolvedUrl == null) {
resolvedUrl = url.replace(" ", "%20");
resolvedUrl = resolvedUrl.replace("\r", "%0D");
}
return resolvedUrl;
} | java | public static String resolveUrl(String baseUrl, String url) {
String resolvedUrl = resolveUrl(baseUrl, url, null);
if (resolvedUrl == null) {
resolvedUrl = url.replace(" ", "%20");
resolvedUrl = resolvedUrl.replace("\r", "%0D");
}
return resolvedUrl;
} | [
"public",
"static",
"String",
"resolveUrl",
"(",
"String",
"baseUrl",
",",
"String",
"url",
")",
"{",
"String",
"resolvedUrl",
"=",
"resolveUrl",
"(",
"baseUrl",
",",
"url",
",",
"null",
")",
";",
"if",
"(",
"resolvedUrl",
"==",
"null",
")",
"{",
"resolv... | Resolve URL, but return a minimally escaped version in case of
error
@param baseUrl the base URL against which the url should be resolved
@param url the URL, possibly relative, to make absolute.
@return url resolved against baseUrl, unless it is absolute already, and
further transformed by whatever escaping normally ta... | [
"Resolve",
"URL",
"but",
"return",
"a",
"minimally",
"escaped",
"version",
"in",
"case",
"of",
"error"
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/util/url/UrlOperations.java#L163-L170 |
120,782 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/util/url/UrlOperations.java | UrlOperations.resolveUrl | public static String resolveUrl(String baseUrl, String url, String defaultValue) {
for(final String scheme : ALL_SCHEMES) {
if(url.startsWith(scheme)) {
try {
return UsableURIFactory.getInstance(url).getEscapedURI();
} catch (URIException e) {
LOGGER.warning(e.getLocalizedMessage() + ": " + ... | java | public static String resolveUrl(String baseUrl, String url, String defaultValue) {
for(final String scheme : ALL_SCHEMES) {
if(url.startsWith(scheme)) {
try {
return UsableURIFactory.getInstance(url).getEscapedURI();
} catch (URIException e) {
LOGGER.warning(e.getLocalizedMessage() + ": " + ... | [
"public",
"static",
"String",
"resolveUrl",
"(",
"String",
"baseUrl",
",",
"String",
"url",
",",
"String",
"defaultValue",
")",
"{",
"for",
"(",
"final",
"String",
"scheme",
":",
"ALL_SCHEMES",
")",
"{",
"if",
"(",
"url",
".",
"startsWith",
"(",
"scheme",
... | Resolve a possibly relative url argument against a base URL.
@param baseUrl the base URL against which the url should be resolved
@param url the URL, possibly relative, to make absolute.
@param defaultValue The default value to return if the supplied values can't be resolved.
@return url resolved against baseUrl, unles... | [
"Resolve",
"a",
"possibly",
"relative",
"url",
"argument",
"against",
"a",
"base",
"URL",
"."
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/util/url/UrlOperations.java#L182-L207 |
120,783 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/util/url/UrlOperations.java | UrlOperations.schemeToDefaultPort | public static int schemeToDefaultPort(final String scheme) {
if(scheme.equals(HTTP_SCHEME)) {
return 80;
}
if(scheme.equals(HTTPS_SCHEME)) {
return 443;
}
if(scheme.equals(FTP_SCHEME)) {
return 21;
}
if(scheme.equals(RTSP_SCHEME)) {
return 554;
}
if(scheme.equals(MMS_SCHEME)) {
return 1... | java | public static int schemeToDefaultPort(final String scheme) {
if(scheme.equals(HTTP_SCHEME)) {
return 80;
}
if(scheme.equals(HTTPS_SCHEME)) {
return 443;
}
if(scheme.equals(FTP_SCHEME)) {
return 21;
}
if(scheme.equals(RTSP_SCHEME)) {
return 554;
}
if(scheme.equals(MMS_SCHEME)) {
return 1... | [
"public",
"static",
"int",
"schemeToDefaultPort",
"(",
"final",
"String",
"scheme",
")",
"{",
"if",
"(",
"scheme",
".",
"equals",
"(",
"HTTP_SCHEME",
")",
")",
"{",
"return",
"80",
";",
"}",
"if",
"(",
"scheme",
".",
"equals",
"(",
"HTTPS_SCHEME",
")",
... | Return the default port for the scheme String argument, if known.
@param scheme String scheme, including '://', as in, "http://", "ftp://"
@return the default port for the scheme, or -1 if the scheme isn't known. | [
"Return",
"the",
"default",
"port",
"for",
"the",
"scheme",
"String",
"argument",
"if",
"known",
"."
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/util/url/UrlOperations.java#L228-L245 |
120,784 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/util/url/UrlOperations.java | UrlOperations.stripDefaultPortFromUrl | public static String stripDefaultPortFromUrl(String url) {
String scheme = urlToScheme(url);
if(scheme == null) {
return url;
}
int defaultPort = schemeToDefaultPort(scheme);
if(defaultPort == -1) {
return url;
}
String portStr = null;
// is there a slash after the scheme?
int slashIdx = url.in... | java | public static String stripDefaultPortFromUrl(String url) {
String scheme = urlToScheme(url);
if(scheme == null) {
return url;
}
int defaultPort = schemeToDefaultPort(scheme);
if(defaultPort == -1) {
return url;
}
String portStr = null;
// is there a slash after the scheme?
int slashIdx = url.in... | [
"public",
"static",
"String",
"stripDefaultPortFromUrl",
"(",
"String",
"url",
")",
"{",
"String",
"scheme",
"=",
"urlToScheme",
"(",
"url",
")",
";",
"if",
"(",
"scheme",
"==",
"null",
")",
"{",
"return",
"url",
";",
"}",
"int",
"defaultPort",
"=",
"sch... | Attempt to strip default ports out of URL strings.
@param url the original URL possibly including a port
@return the URL sans port, if the scheme was recognized and the default
port was supplied, otherwise, the original URL. | [
"Attempt",
"to",
"strip",
"default",
"ports",
"out",
"of",
"URL",
"strings",
"."
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/util/url/UrlOperations.java#L280-L313 |
120,785 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/util/url/UrlOperations.java | UrlOperations.urlToHost | public static String urlToHost(String url) {
String lcUrl = url.toLowerCase();
if(lcUrl.startsWith(DNS_SCHEME)) {
return lcUrl.substring(DNS_SCHEME.length());
}
for(String scheme : ALL_SCHEMES) {
if(lcUrl.startsWith(scheme)) {
int authorityIdx = scheme.length();
Matcher m =
HOST_REGEX_SIMPL... | java | public static String urlToHost(String url) {
String lcUrl = url.toLowerCase();
if(lcUrl.startsWith(DNS_SCHEME)) {
return lcUrl.substring(DNS_SCHEME.length());
}
for(String scheme : ALL_SCHEMES) {
if(lcUrl.startsWith(scheme)) {
int authorityIdx = scheme.length();
Matcher m =
HOST_REGEX_SIMPL... | [
"public",
"static",
"String",
"urlToHost",
"(",
"String",
"url",
")",
"{",
"String",
"lcUrl",
"=",
"url",
".",
"toLowerCase",
"(",
")",
";",
"if",
"(",
"lcUrl",
".",
"startsWith",
"(",
"DNS_SCHEME",
")",
")",
"{",
"return",
"lcUrl",
".",
"substring",
"... | Attempt to extract the hostname component of an absolute URL argument.
@param url the url String from which to extract the hostname
@return the hostname within the URL, or the url argument if the host
cannot be found. | [
"Attempt",
"to",
"extract",
"the",
"hostname",
"component",
"of",
"an",
"absolute",
"URL",
"argument",
"."
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/util/url/UrlOperations.java#L360-L377 |
120,786 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/util/url/UrlOperations.java | UrlOperations.urlToUserInfo | public static String urlToUserInfo(String url) {
String lcUrl = url.toLowerCase();
if(lcUrl.startsWith(DNS_SCHEME)) {
return null;
}
for(String scheme : ALL_SCHEMES) {
if(lcUrl.startsWith(scheme)) {
int authorityIdx = scheme.length();
Matcher m =
USERINFO_REGEX_SIMPLE.matcher(lcUrl.substrin... | java | public static String urlToUserInfo(String url) {
String lcUrl = url.toLowerCase();
if(lcUrl.startsWith(DNS_SCHEME)) {
return null;
}
for(String scheme : ALL_SCHEMES) {
if(lcUrl.startsWith(scheme)) {
int authorityIdx = scheme.length();
Matcher m =
USERINFO_REGEX_SIMPLE.matcher(lcUrl.substrin... | [
"public",
"static",
"String",
"urlToUserInfo",
"(",
"String",
"url",
")",
"{",
"String",
"lcUrl",
"=",
"url",
".",
"toLowerCase",
"(",
")",
";",
"if",
"(",
"lcUrl",
".",
"startsWith",
"(",
"DNS_SCHEME",
")",
")",
"{",
"return",
"null",
";",
"}",
"for",... | Extract userinfo from the absolute URL argument, that is, "username@", or
"username:password@" if present.
@param url the URL from which to extract the userinfo
@return the userinfo found, not including the "@", or null if no userinfo
is found | [
"Extract",
"userinfo",
"from",
"the",
"absolute",
"URL",
"argument",
"that",
"is",
"username"
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/util/url/UrlOperations.java#L386-L403 |
120,787 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/util/url/UrlOperations.java | UrlOperations.getUrlParentDir | public static String getUrlParentDir(String url) {
try {
UsableURI uri = UsableURIFactory.getInstance(url);
String path = uri.getPath();
if(path.length() > 1) {
int startIdx = path.length()-1;
if(path.charAt(path.length()-1) == '/') {
startIdx--;
}
int idx = path.lastIndexOf('/',startIdx... | java | public static String getUrlParentDir(String url) {
try {
UsableURI uri = UsableURIFactory.getInstance(url);
String path = uri.getPath();
if(path.length() > 1) {
int startIdx = path.length()-1;
if(path.charAt(path.length()-1) == '/') {
startIdx--;
}
int idx = path.lastIndexOf('/',startIdx... | [
"public",
"static",
"String",
"getUrlParentDir",
"(",
"String",
"url",
")",
"{",
"try",
"{",
"UsableURI",
"uri",
"=",
"UsableURIFactory",
".",
"getInstance",
"(",
"url",
")",
";",
"String",
"path",
"=",
"uri",
".",
"getPath",
"(",
")",
";",
"if",
"(",
... | Find and return the parent directory of the URL argument
@param url to find the parent directory of
@return parent directory of URL, or null, if either the url argument is
invalid, or if the url is the root of the authority. | [
"Find",
"and",
"return",
"the",
"parent",
"directory",
"of",
"the",
"URL",
"argument"
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/util/url/UrlOperations.java#L411-L431 |
120,788 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/webapp/AccessPoint.java | AccessPoint.shutdown | @Override
public void shutdown() {
if (collection != null) {
try {
collection.shutdown();
} catch (IOException e) {
LOGGER.severe("FAILED collection shutdown" + e.getMessage());
}
}
if (exclusionFactory != null) {
exclusionFactory.shutdown();
}
} | java | @Override
public void shutdown() {
if (collection != null) {
try {
collection.shutdown();
} catch (IOException e) {
LOGGER.severe("FAILED collection shutdown" + e.getMessage());
}
}
if (exclusionFactory != null) {
exclusionFactory.shutdown();
}
} | [
"@",
"Override",
"public",
"void",
"shutdown",
"(",
")",
"{",
"if",
"(",
"collection",
"!=",
"null",
")",
"{",
"try",
"{",
"collection",
".",
"shutdown",
"(",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",
"{",
"LOGGER",
".",
"severe",
"(",
... | Release any resources associated with this AccessPoint, including
stopping any background processing threads | [
"Release",
"any",
"resources",
"associated",
"with",
"this",
"AccessPoint",
"including",
"stopping",
"any",
"background",
"processing",
"threads"
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/webapp/AccessPoint.java#L1214-L1226 |
120,789 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/webapp/AccessPoint.java | AccessPoint.setLiveWebPrefix | public void setLiveWebPrefix(String liveWebPrefix) {
if (liveWebPrefix == null || liveWebPrefix.isEmpty()) {
this.liveWebRedirector = null;
}
this.liveWebRedirector = new DefaultLiveWebRedirector(liveWebPrefix);
} | java | public void setLiveWebPrefix(String liveWebPrefix) {
if (liveWebPrefix == null || liveWebPrefix.isEmpty()) {
this.liveWebRedirector = null;
}
this.liveWebRedirector = new DefaultLiveWebRedirector(liveWebPrefix);
} | [
"public",
"void",
"setLiveWebPrefix",
"(",
"String",
"liveWebPrefix",
")",
"{",
"if",
"(",
"liveWebPrefix",
"==",
"null",
"||",
"liveWebPrefix",
".",
"isEmpty",
"(",
")",
")",
"{",
"this",
".",
"liveWebRedirector",
"=",
"null",
";",
"}",
"this",
".",
"live... | Set standard liveweb redirector | [
"Set",
"standard",
"liveweb",
"redirector"
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/webapp/AccessPoint.java#L1365-L1371 |
120,790 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/util/url/AggressiveUrlCanonicalizer.java | AggressiveUrlCanonicalizer.doStripRegexMatch | protected boolean doStripRegexMatch(StringBuilder url, Matcher matcher) {
if(matcher != null && matcher.matches()) {
url.delete(matcher.start(1), matcher.end(1));
return true;
}
return false;
} | java | protected boolean doStripRegexMatch(StringBuilder url, Matcher matcher) {
if(matcher != null && matcher.matches()) {
url.delete(matcher.start(1), matcher.end(1));
return true;
}
return false;
} | [
"protected",
"boolean",
"doStripRegexMatch",
"(",
"StringBuilder",
"url",
",",
"Matcher",
"matcher",
")",
"{",
"if",
"(",
"matcher",
"!=",
"null",
"&&",
"matcher",
".",
"matches",
"(",
")",
")",
"{",
"url",
".",
"delete",
"(",
"matcher",
".",
"start",
"(... | Run a regex against a StringBuilder, removing group 1 if it matches.
Assumes the regex has a form that wants to strip elements of the passed
string. Assumes that if a match, group 1 should be removed
@param url Url to search in.
@param matcher Matcher whose form yields a group to remove
@return true if the StringBuil... | [
"Run",
"a",
"regex",
"against",
"a",
"StringBuilder",
"removing",
"group",
"1",
"if",
"it",
"matches",
"."
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/util/url/AggressiveUrlCanonicalizer.java#L199-L205 |
120,791 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/util/url/AggressiveUrlCanonicalizer.java | AggressiveUrlCanonicalizer.canonicalize | public String canonicalize(String url) {
if (url == null || url.length() <= 0) {
return url;
}
// hang on, we're about to get aggressive:
url = url.toLowerCase();
StringBuilder sb = new StringBuilder(url);
boolean changed = false;
for(int i=0; i<choosers.l... | java | public String canonicalize(String url) {
if (url == null || url.length() <= 0) {
return url;
}
// hang on, we're about to get aggressive:
url = url.toLowerCase();
StringBuilder sb = new StringBuilder(url);
boolean changed = false;
for(int i=0; i<choosers.l... | [
"public",
"String",
"canonicalize",
"(",
"String",
"url",
")",
"{",
"if",
"(",
"url",
"==",
"null",
"||",
"url",
".",
"length",
"(",
")",
"<=",
"0",
")",
"{",
"return",
"url",
";",
"}",
"// hang on, we're about to get aggressive:",
"url",
"=",
"url",
"."... | Idempotent operation that will determine the 'fuzziest'
form of the url argument. This operation is done prior to adding records
to the ResourceIndex, and prior to lookup. Current version is exactly
the default found in Heritrix. When the configuration system for
Heritrix stabilizes, hopefully this can use the system d... | [
"Idempotent",
"operation",
"that",
"will",
"determine",
"the",
"fuzziest",
"form",
"of",
"the",
"url",
"argument",
".",
"This",
"operation",
"is",
"done",
"prior",
"to",
"adding",
"records",
"to",
"the",
"ResourceIndex",
"and",
"prior",
"to",
"lookup",
".",
... | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/util/url/AggressiveUrlCanonicalizer.java#L299-L340 |
120,792 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/core/CaptureSearchResults.java | CaptureSearchResults.addSearchResult | public void addSearchResult(CaptureSearchResult result, boolean append) {
String resultDate = result.getCaptureTimestamp();
if ((firstResultTimestamp == null) ||
(firstResultTimestamp.compareTo(resultDate) > 0)) {
firstResultTimestamp = resultDate;
}
if ((lastResultTimestamp == null) ||
(lastResultTi... | java | public void addSearchResult(CaptureSearchResult result, boolean append) {
String resultDate = result.getCaptureTimestamp();
if ((firstResultTimestamp == null) ||
(firstResultTimestamp.compareTo(resultDate) > 0)) {
firstResultTimestamp = resultDate;
}
if ((lastResultTimestamp == null) ||
(lastResultTi... | [
"public",
"void",
"addSearchResult",
"(",
"CaptureSearchResult",
"result",
",",
"boolean",
"append",
")",
"{",
"String",
"resultDate",
"=",
"result",
".",
"getCaptureTimestamp",
"(",
")",
";",
"if",
"(",
"(",
"firstResultTimestamp",
"==",
"null",
")",
"||",
"(... | Add a result to this results, at either the beginning or the end,
depending on the append argument
@param result SearchResult to add to this set
@param append | [
"Add",
"a",
"result",
"to",
"this",
"results",
"at",
"either",
"the",
"beginning",
"or",
"the",
"end",
"depending",
"on",
"the",
"append",
"argument"
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/core/CaptureSearchResults.java#L98-L125 |
120,793 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/util/partition/Partitioner.java | Partitioner.getSize | public static PartitionSize getSize(String name) {
for(PartitionSize pa : sizes) {
if(pa.name().equals(name)) {
return pa;
}
}
return twoYearSize;
} | java | public static PartitionSize getSize(String name) {
for(PartitionSize pa : sizes) {
if(pa.name().equals(name)) {
return pa;
}
}
return twoYearSize;
} | [
"public",
"static",
"PartitionSize",
"getSize",
"(",
"String",
"name",
")",
"{",
"for",
"(",
"PartitionSize",
"pa",
":",
"sizes",
")",
"{",
"if",
"(",
"pa",
".",
"name",
"(",
")",
".",
"equals",
"(",
"name",
")",
")",
"{",
"return",
"pa",
";",
"}",... | Get a PartitionSize object by it's name
@param name of the PartitionSize
@return PartitionSize matching the name, or a TwoYearPartionSize if name
is unknown | [
"Get",
"a",
"PartitionSize",
"object",
"by",
"it",
"s",
"name"
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/util/partition/Partitioner.java#L117-L124 |
120,794 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/util/partition/Partitioner.java | Partitioner.getSize | public PartitionSize getSize(Date first, Date last, int maxP) {
long diffMS = last.getTime() - first.getTime();
for(PartitionSize pa : sizes) {
long maxMS = maxP * pa.intervalMS();
if(maxMS > diffMS) {
return pa;
}
}
return twoYearSize;
} | java | public PartitionSize getSize(Date first, Date last, int maxP) {
long diffMS = last.getTime() - first.getTime();
for(PartitionSize pa : sizes) {
long maxMS = maxP * pa.intervalMS();
if(maxMS > diffMS) {
return pa;
}
}
return twoYearSize;
} | [
"public",
"PartitionSize",
"getSize",
"(",
"Date",
"first",
",",
"Date",
"last",
",",
"int",
"maxP",
")",
"{",
"long",
"diffMS",
"=",
"last",
".",
"getTime",
"(",
")",
"-",
"first",
".",
"getTime",
"(",
")",
";",
"for",
"(",
"PartitionSize",
"pa",
":... | Attempt to find the smallest PartitionSize implementation which, spanning
the range first and last specified, produces at most maxP partitions.
@param first Date of beginning of time range
@param last Date of end of time range
@param maxP maximum number of Partitions to use
@return a PartitionSize object which will div... | [
"Attempt",
"to",
"find",
"the",
"smallest",
"PartitionSize",
"implementation",
"which",
"spanning",
"the",
"range",
"first",
"and",
"last",
"specified",
"produces",
"at",
"most",
"maxP",
"partitions",
"."
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/util/partition/Partitioner.java#L135-L144 |
120,795 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/util/partition/Partitioner.java | Partitioner.getRange | public List<Partition<T>> getRange(PartitionSize size, Date start,
Date end) {
// logDates("Constructing partitions Size(" + size.name() + ")",start,end);
// Date origStart = new Date(start.getTime());
List<Partition<T>> partitions = new ArrayList<Partition<T>>();
Calendar cStart = Calendar.getInstance(TZ_UTC... | java | public List<Partition<T>> getRange(PartitionSize size, Date start,
Date end) {
// logDates("Constructing partitions Size(" + size.name() + ")",start,end);
// Date origStart = new Date(start.getTime());
List<Partition<T>> partitions = new ArrayList<Partition<T>>();
Calendar cStart = Calendar.getInstance(TZ_UTC... | [
"public",
"List",
"<",
"Partition",
"<",
"T",
">",
">",
"getRange",
"(",
"PartitionSize",
"size",
",",
"Date",
"start",
",",
"Date",
"end",
")",
"{",
"//\t\tlogDates(\"Constructing partitions Size(\" + size.name() + \")\",start,end);",
"//\t\tDate origStart = new Date(start... | Create a List of Partition objects of the specified size, which span the
date range specified.
@param size of Partitions to create
@param start Date of beginning of time range to cover
@param end Date of end of time range to cover
@return List of Partitions spanning start and end, sized size, in date-
ascending order. | [
"Create",
"a",
"List",
"of",
"Partition",
"objects",
"of",
"the",
"specified",
"size",
"which",
"span",
"the",
"date",
"range",
"specified",
"."
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/util/partition/Partitioner.java#L164-L183 |
120,796 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/util/partition/Partitioner.java | Partitioner.populate | public void populate(List<Partition<T>> partitions,
Iterator<T> itr) {
int idx = 0;
int size = partitions.size();
T element = null;
while(idx < size) {
Partition<T> partition = partitions.get(idx);
if(element == null) {
if(itr.hasNext()) {
element = itr.next();
} else {
// all done
... | java | public void populate(List<Partition<T>> partitions,
Iterator<T> itr) {
int idx = 0;
int size = partitions.size();
T element = null;
while(idx < size) {
Partition<T> partition = partitions.get(idx);
if(element == null) {
if(itr.hasNext()) {
element = itr.next();
} else {
// all done
... | [
"public",
"void",
"populate",
"(",
"List",
"<",
"Partition",
"<",
"T",
">",
">",
"partitions",
",",
"Iterator",
"<",
"T",
">",
"itr",
")",
"{",
"int",
"idx",
"=",
"0",
";",
"int",
"size",
"=",
"partitions",
".",
"size",
"(",
")",
";",
"T",
"eleme... | Add elements from itr into the appropriate partitions. Assumes that
all elements fit in one of the argument Partitions, that the partitions
are in ascending order by time, and that elements returned from the
Iterator are in ascending time order.
@param partitions to populate with objects
@param itr ascending Iterator ... | [
"Add",
"elements",
"from",
"itr",
"into",
"the",
"appropriate",
"partitions",
".",
"Assumes",
"that",
"all",
"elements",
"fit",
"in",
"one",
"of",
"the",
"argument",
"Partitions",
"that",
"the",
"partitions",
"are",
"in",
"ascending",
"order",
"by",
"time",
... | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/util/partition/Partitioner.java#L194-L225 |
120,797 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/util/webapp/RequestMapper.java | RequestMapper.addRequestHandler | public void addRequestHandler(int port, String host, String path,
RequestHandler requestHandler) {
Integer portInt = Integer.valueOf(port);
PortMapper portMapper = portMap.get(portInt);
if (portMapper == null) {
portMapper = new PortMapper(portInt);
portMap.put(portInt, portMapper);
}
portMapper.add... | java | public void addRequestHandler(int port, String host, String path,
RequestHandler requestHandler) {
Integer portInt = Integer.valueOf(port);
PortMapper portMapper = portMap.get(portInt);
if (portMapper == null) {
portMapper = new PortMapper(portInt);
portMap.put(portInt, portMapper);
}
portMapper.add... | [
"public",
"void",
"addRequestHandler",
"(",
"int",
"port",
",",
"String",
"host",
",",
"String",
"path",
",",
"RequestHandler",
"requestHandler",
")",
"{",
"Integer",
"portInt",
"=",
"Integer",
".",
"valueOf",
"(",
"port",
")",
";",
"PortMapper",
"portMapper",... | Register the RequestHandler to accept requests on the given port, for the
specified host and path.
@param port the integer port on which the RequestHandler gets requests.
@param host the String Host which the RequestHandler matches, or null, if
the RequestHandler should match ALL hosts.
@param path the String path whic... | [
"Register",
"the",
"RequestHandler",
"to",
"accept",
"requests",
"on",
"the",
"given",
"port",
"for",
"the",
"specified",
"host",
"and",
"path",
"."
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/util/webapp/RequestMapper.java#L137-L150 |
120,798 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/util/webapp/RequestMapper.java | RequestMapper.handleRequest | public boolean handleRequest(HttpServletRequest request,
HttpServletResponse response) throws IOException, ServletException {
boolean handled = false;
// Internally UIResults.forward(), don't handle here
if (request.getAttribute(UIResults.FERRET_NAME) != null) {
return false;
}
if (globalPreReques... | java | public boolean handleRequest(HttpServletRequest request,
HttpServletResponse response) throws IOException, ServletException {
boolean handled = false;
// Internally UIResults.forward(), don't handle here
if (request.getAttribute(UIResults.FERRET_NAME) != null) {
return false;
}
if (globalPreReques... | [
"public",
"boolean",
"handleRequest",
"(",
"HttpServletRequest",
"request",
",",
"HttpServletResponse",
"response",
")",
"throws",
"IOException",
",",
"ServletException",
"{",
"boolean",
"handled",
"=",
"false",
";",
"// Internally UIResults.forward(), don't handle here",
"... | Map the incoming request to the appropriate RequestHandler, including
the PRE and POST RequestHandlers, if configured.
@param request the incoming HttpServletRequest
@param response the HttpServletResponse to return data to the client
@return true if a response was returned to the client.
@throws ServletException for u... | [
"Map",
"the",
"incoming",
"request",
"to",
"the",
"appropriate",
"RequestHandler",
"including",
"the",
"PRE",
"and",
"POST",
"RequestHandlers",
"if",
"configured",
"."
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/util/webapp/RequestMapper.java#L175-L209 |
120,799 | iipc/openwayback | wayback-core/src/main/java/org/archive/wayback/util/webapp/RequestMapper.java | RequestMapper.shutdown | public void shutdown() {
for (ShutdownListener shutdownListener : shutdownListeners) {
try {
shutdownListener.shutdown();
} catch(Exception e) {
LOGGER.severe("failed shutdown"+e.getMessage());
}
}
} | java | public void shutdown() {
for (ShutdownListener shutdownListener : shutdownListeners) {
try {
shutdownListener.shutdown();
} catch(Exception e) {
LOGGER.severe("failed shutdown"+e.getMessage());
}
}
} | [
"public",
"void",
"shutdown",
"(",
")",
"{",
"for",
"(",
"ShutdownListener",
"shutdownListener",
":",
"shutdownListeners",
")",
"{",
"try",
"{",
"shutdownListener",
".",
"shutdown",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"LOGGER",
".... | notify all registered ShutdownListener objects that the ServletContext is
being destroyed. | [
"notify",
"all",
"registered",
"ShutdownListener",
"objects",
"that",
"the",
"ServletContext",
"is",
"being",
"destroyed",
"."
] | da74c3a59a5b5a5c365bd4702dcb45d263535794 | https://github.com/iipc/openwayback/blob/da74c3a59a5b5a5c365bd4702dcb45d263535794/wayback-core/src/main/java/org/archive/wayback/util/webapp/RequestMapper.java#L215-L223 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.