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 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
gturri/aXMLRPC | src/main/java/de/timroes/axmlrpc/XMLUtil.java | XMLUtil.getOnlyTextContent | public static String getOnlyTextContent(NodeList list) throws XMLRPCException {
StringBuilder builder = new StringBuilder();
Node n;
for(int i = 0; i < list.getLength(); i++) {
n = list.item(i);
// Skip comments inside text tag.
if(n.getNodeType() == Node.COMMENT_NODE) {
continue;
}
if(n.ge... | java | public static String getOnlyTextContent(NodeList list) throws XMLRPCException {
StringBuilder builder = new StringBuilder();
Node n;
for(int i = 0; i < list.getLength(); i++) {
n = list.item(i);
// Skip comments inside text tag.
if(n.getNodeType() == Node.COMMENT_NODE) {
continue;
}
if(n.ge... | [
"public",
"static",
"String",
"getOnlyTextContent",
"(",
"NodeList",
"list",
")",
"throws",
"XMLRPCException",
"{",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"Node",
"n",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
... | Returns the text node from a given NodeList. If the list contains
more then just text nodes, an exception will be thrown.
@param list The given list of nodes.
@return The text of the given node list.
@throws XMLRPCException Will be thrown if there is more than just one
text node within the list. | [
"Returns",
"the",
"text",
"node",
"from",
"a",
"given",
"NodeList",
".",
"If",
"the",
"list",
"contains",
"more",
"then",
"just",
"text",
"nodes",
"an",
"exception",
"will",
"be",
"thrown",
"."
] | 8ca6f95f7eb3a28efaef3569d53adddeb32b6bda | https://github.com/gturri/aXMLRPC/blob/8ca6f95f7eb3a28efaef3569d53adddeb32b6bda/src/main/java/de/timroes/axmlrpc/XMLUtil.java#L66-L89 | train |
gturri/aXMLRPC | src/main/java/de/timroes/axmlrpc/XMLUtil.java | XMLUtil.makeXmlTag | public static XmlElement makeXmlTag(String type, String content) {
XmlElement xml = new XmlElement(type);
xml.setContent(content);
return xml;
} | java | public static XmlElement makeXmlTag(String type, String content) {
XmlElement xml = new XmlElement(type);
xml.setContent(content);
return xml;
} | [
"public",
"static",
"XmlElement",
"makeXmlTag",
"(",
"String",
"type",
",",
"String",
"content",
")",
"{",
"XmlElement",
"xml",
"=",
"new",
"XmlElement",
"(",
"type",
")",
";",
"xml",
".",
"setContent",
"(",
"content",
")",
";",
"return",
"xml",
";",
"}"... | Creates an xml tag with a given type and content.
@param type The type of the xml tag. What will be filled in the <..>.
@param content The content of the tag.
@return The xml tag with its content as a string. | [
"Creates",
"an",
"xml",
"tag",
"with",
"a",
"given",
"type",
"and",
"content",
"."
] | 8ca6f95f7eb3a28efaef3569d53adddeb32b6bda | https://github.com/gturri/aXMLRPC/blob/8ca6f95f7eb3a28efaef3569d53adddeb32b6bda/src/main/java/de/timroes/axmlrpc/XMLUtil.java#L120-L124 | train |
gturri/aXMLRPC | src/main/java/de/timroes/axmlrpc/CookieManager.java | CookieManager.readCookies | public void readCookies(HttpURLConnection http) {
// Only save cookies if FLAGS_ENABLE_COOKIES has been set.
if((flags & XMLRPCClient.FLAGS_ENABLE_COOKIES) == 0)
return;
String cookie, key;
String[] split;
// Extract every Set-Cookie field and put the cookie to the cookies map.
for(int i = 0; i < http... | java | public void readCookies(HttpURLConnection http) {
// Only save cookies if FLAGS_ENABLE_COOKIES has been set.
if((flags & XMLRPCClient.FLAGS_ENABLE_COOKIES) == 0)
return;
String cookie, key;
String[] split;
// Extract every Set-Cookie field and put the cookie to the cookies map.
for(int i = 0; i < http... | [
"public",
"void",
"readCookies",
"(",
"HttpURLConnection",
"http",
")",
"{",
"// Only save cookies if FLAGS_ENABLE_COOKIES has been set.",
"if",
"(",
"(",
"flags",
"&",
"XMLRPCClient",
".",
"FLAGS_ENABLE_COOKIES",
")",
"==",
"0",
")",
"return",
";",
"String",
"cookie"... | Read the cookies from an http response. It will look at every Set-Cookie
header and put the cookie to the map of cookies.
@param http A http connection. | [
"Read",
"the",
"cookies",
"from",
"an",
"http",
"response",
".",
"It",
"will",
"look",
"at",
"every",
"Set",
"-",
"Cookie",
"header",
"and",
"put",
"the",
"cookie",
"to",
"the",
"map",
"of",
"cookies",
"."
] | 8ca6f95f7eb3a28efaef3569d53adddeb32b6bda | https://github.com/gturri/aXMLRPC/blob/8ca6f95f7eb3a28efaef3569d53adddeb32b6bda/src/main/java/de/timroes/axmlrpc/CookieManager.java#L53-L73 | train |
gturri/aXMLRPC | src/main/java/de/timroes/axmlrpc/CookieManager.java | CookieManager.setCookies | public void setCookies(HttpURLConnection http) {
// Only save cookies if FLAGS_ENABLE_COOKIES has been set.
if((flags & XMLRPCClient.FLAGS_ENABLE_COOKIES) == 0)
return;
String concat = "";
for(Map.Entry<String,String> cookie : cookies.entrySet()) {
concat += cookie.getKey() + "=" + cookie.getValue() + "... | java | public void setCookies(HttpURLConnection http) {
// Only save cookies if FLAGS_ENABLE_COOKIES has been set.
if((flags & XMLRPCClient.FLAGS_ENABLE_COOKIES) == 0)
return;
String concat = "";
for(Map.Entry<String,String> cookie : cookies.entrySet()) {
concat += cookie.getKey() + "=" + cookie.getValue() + "... | [
"public",
"void",
"setCookies",
"(",
"HttpURLConnection",
"http",
")",
"{",
"// Only save cookies if FLAGS_ENABLE_COOKIES has been set.",
"if",
"(",
"(",
"flags",
"&",
"XMLRPCClient",
".",
"FLAGS_ENABLE_COOKIES",
")",
"==",
"0",
")",
"return",
";",
"String",
"concat",... | Write the cookies to a http connection. It will set the Cookie field
to all currently set cookies in the map.
@param http A http connection. | [
"Write",
"the",
"cookies",
"to",
"a",
"http",
"connection",
".",
"It",
"will",
"set",
"the",
"Cookie",
"field",
"to",
"all",
"currently",
"set",
"cookies",
"in",
"the",
"map",
"."
] | 8ca6f95f7eb3a28efaef3569d53adddeb32b6bda | https://github.com/gturri/aXMLRPC/blob/8ca6f95f7eb3a28efaef3569d53adddeb32b6bda/src/main/java/de/timroes/axmlrpc/CookieManager.java#L81-L93 | train |
opitzconsulting/orcas | orcas_core/build_source/orcas_diff/src/main/java/de/opitzconsulting/orcas/sql/WrapperResultSet.java | WrapperResultSet.usePreparedStatement | protected final void usePreparedStatement( PreparedStatement pPreparedStatement ) throws SQLException
{
ResultSet lResultSet = null;
pPreparedStatement.setFetchSize( 1000 );
setParameter( pPreparedStatement );
try
{
lResultSet = pPreparedStatement.executeQuery();
useResultSet( ... | java | protected final void usePreparedStatement( PreparedStatement pPreparedStatement ) throws SQLException
{
ResultSet lResultSet = null;
pPreparedStatement.setFetchSize( 1000 );
setParameter( pPreparedStatement );
try
{
lResultSet = pPreparedStatement.executeQuery();
useResultSet( ... | [
"protected",
"final",
"void",
"usePreparedStatement",
"(",
"PreparedStatement",
"pPreparedStatement",
")",
"throws",
"SQLException",
"{",
"ResultSet",
"lResultSet",
"=",
"null",
";",
"pPreparedStatement",
".",
"setFetchSize",
"(",
"1000",
")",
";",
"setParameter",
"("... | Calls setParameter first, than executeQuery on the CallableStatement is called and the resultest is passed to useResultSet. | [
"Calls",
"setParameter",
"first",
"than",
"executeQuery",
"on",
"the",
"CallableStatement",
"is",
"called",
"and",
"the",
"resultest",
"is",
"passed",
"to",
"useResultSet",
"."
] | 9b24c56a060269f90005953b2bd86b329164995b | https://github.com/opitzconsulting/orcas/blob/9b24c56a060269f90005953b2bd86b329164995b/orcas_core/build_source/orcas_diff/src/main/java/de/opitzconsulting/orcas/sql/WrapperResultSet.java#L53-L74 | train |
opitzconsulting/orcas | orcas_core/build_source/orcas_diff/src/main/java/de/opitzconsulting/orcas/sql/WrapperResultSet.java | WrapperResultSet.setParameter | protected void setParameter( PreparedStatement pPreparedStatement ) throws SQLException
{
if( _parameters != null )
{
for( int i = 0; i < _parameters.size(); i++ )
{
pPreparedStatement.setObject( i + 1, _parameters.get( i ) );
}
}
} | java | protected void setParameter( PreparedStatement pPreparedStatement ) throws SQLException
{
if( _parameters != null )
{
for( int i = 0; i < _parameters.size(); i++ )
{
pPreparedStatement.setObject( i + 1, _parameters.get( i ) );
}
}
} | [
"protected",
"void",
"setParameter",
"(",
"PreparedStatement",
"pPreparedStatement",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"_parameters",
"!=",
"null",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"_parameters",
".",
"size",
"(",
")"... | Is called before the CallabelStatement is executed. It is usually used to set parameters. The CallableStatement may not be executed. The default implementaion does nothing. | [
"Is",
"called",
"before",
"the",
"CallabelStatement",
"is",
"executed",
".",
"It",
"is",
"usually",
"used",
"to",
"set",
"parameters",
".",
"The",
"CallableStatement",
"may",
"not",
"be",
"executed",
".",
"The",
"default",
"implementaion",
"does",
"nothing",
"... | 9b24c56a060269f90005953b2bd86b329164995b | https://github.com/opitzconsulting/orcas/blob/9b24c56a060269f90005953b2bd86b329164995b/orcas_core/build_source/orcas_diff/src/main/java/de/opitzconsulting/orcas/sql/WrapperResultSet.java#L84-L93 | train |
opitzconsulting/orcas | orcas_core/build_source/orcas_dbdoc/src/main/java/de/oc/dbdoc/export/DotExport.java | DotExport.export | public void export( Graph pGraph, Schema pSchema, DotWriter pDotWriter, boolean pOutRefsOnly )
{
pDotWriter.printHeaderStart( pGraph.getStyleForGraph() );
if( pGraph.isCollapseSubgraphs() )
{
_writeSubgraphRecursiveCollapsed( pGraph, pSchema, pDotWriter, pOutRefsOnly );
List<Graph> lEndGraph... | java | public void export( Graph pGraph, Schema pSchema, DotWriter pDotWriter, boolean pOutRefsOnly )
{
pDotWriter.printHeaderStart( pGraph.getStyleForGraph() );
if( pGraph.isCollapseSubgraphs() )
{
_writeSubgraphRecursiveCollapsed( pGraph, pSchema, pDotWriter, pOutRefsOnly );
List<Graph> lEndGraph... | [
"public",
"void",
"export",
"(",
"Graph",
"pGraph",
",",
"Schema",
"pSchema",
",",
"DotWriter",
"pDotWriter",
",",
"boolean",
"pOutRefsOnly",
")",
"{",
"pDotWriter",
".",
"printHeaderStart",
"(",
"pGraph",
".",
"getStyleForGraph",
"(",
")",
")",
";",
"if",
"... | Creates a dot File for the Schema. | [
"Creates",
"a",
"dot",
"File",
"for",
"the",
"Schema",
"."
] | 9b24c56a060269f90005953b2bd86b329164995b | https://github.com/opitzconsulting/orcas/blob/9b24c56a060269f90005953b2bd86b329164995b/orcas_core/build_source/orcas_dbdoc/src/main/java/de/oc/dbdoc/export/DotExport.java#L162-L247 | train |
opitzconsulting/orcas | orcas_core/build_source/orcas_diff/src/main/java/de/opitzconsulting/orcas/sql/WrapperIteratorResultSet.java | WrapperIteratorResultSet.useResultSet | protected final void useResultSet( ResultSet pResultSet ) throws SQLException
{
boolean lFirst = true;
if( !pResultSet.next() )
{
handleEmptyResultSet();
}
else
{
while( lFirst || pResultSet.next() )
{
lFirst = false;
useResultSetRow( pResultSet );
}
... | java | protected final void useResultSet( ResultSet pResultSet ) throws SQLException
{
boolean lFirst = true;
if( !pResultSet.next() )
{
handleEmptyResultSet();
}
else
{
while( lFirst || pResultSet.next() )
{
lFirst = false;
useResultSetRow( pResultSet );
}
... | [
"protected",
"final",
"void",
"useResultSet",
"(",
"ResultSet",
"pResultSet",
")",
"throws",
"SQLException",
"{",
"boolean",
"lFirst",
"=",
"true",
";",
"if",
"(",
"!",
"pResultSet",
".",
"next",
"(",
")",
")",
"{",
"handleEmptyResultSet",
"(",
")",
";",
"... | iterates through the resultset and calls the callback methods. | [
"iterates",
"through",
"the",
"resultset",
"and",
"calls",
"the",
"callback",
"methods",
"."
] | 9b24c56a060269f90005953b2bd86b329164995b | https://github.com/opitzconsulting/orcas/blob/9b24c56a060269f90005953b2bd86b329164995b/orcas_core/build_source/orcas_diff/src/main/java/de/opitzconsulting/orcas/sql/WrapperIteratorResultSet.java#L47-L64 | train |
opitzconsulting/orcas | orcas_core/build_source/orcas_diff/src/main/java/de/opitzconsulting/orcas/sql/WrapperReturnFirstValue.java | WrapperReturnFirstValue.getValueFromResultSet | protected final Object getValueFromResultSet( ResultSet pResultSet ) throws SQLException
{
if( !pResultSet.next() )
{
if( _returnNullInsteadOfNoDataFoundException )
{
return null;
}
throw new NoDataFoundException();
}
return pResultSet.getObject( getObjectIndex() );
... | java | protected final Object getValueFromResultSet( ResultSet pResultSet ) throws SQLException
{
if( !pResultSet.next() )
{
if( _returnNullInsteadOfNoDataFoundException )
{
return null;
}
throw new NoDataFoundException();
}
return pResultSet.getObject( getObjectIndex() );
... | [
"protected",
"final",
"Object",
"getValueFromResultSet",
"(",
"ResultSet",
"pResultSet",
")",
"throws",
"SQLException",
"{",
"if",
"(",
"!",
"pResultSet",
".",
"next",
"(",
")",
")",
"{",
"if",
"(",
"_returnNullInsteadOfNoDataFoundException",
")",
"{",
"return",
... | Extracts the first value. | [
"Extracts",
"the",
"first",
"value",
"."
] | 9b24c56a060269f90005953b2bd86b329164995b | https://github.com/opitzconsulting/orcas/blob/9b24c56a060269f90005953b2bd86b329164995b/orcas_core/build_source/orcas_diff/src/main/java/de/opitzconsulting/orcas/sql/WrapperReturnFirstValue.java#L43-L56 | train |
jenkinsci/groovy-plugin | src/main/java/hudson/plugins/groovy/GroovyInstallation.java | GroovyInstallation.getExecutable | public String getExecutable(VirtualChannel channel) throws IOException, InterruptedException {
return channel.call(new MasterToSlaveCallable<String, IOException>() {
public String call() throws IOException {
File exe = getExeFile("groovy");
if (exe.exists()) {
... | java | public String getExecutable(VirtualChannel channel) throws IOException, InterruptedException {
return channel.call(new MasterToSlaveCallable<String, IOException>() {
public String call() throws IOException {
File exe = getExeFile("groovy");
if (exe.exists()) {
... | [
"public",
"String",
"getExecutable",
"(",
"VirtualChannel",
"channel",
")",
"throws",
"IOException",
",",
"InterruptedException",
"{",
"return",
"channel",
".",
"call",
"(",
"new",
"MasterToSlaveCallable",
"<",
"String",
",",
"IOException",
">",
"(",
")",
"{",
"... | Gets the executable path of this groovy installation on the given target system. | [
"Gets",
"the",
"executable",
"path",
"of",
"this",
"groovy",
"installation",
"on",
"the",
"given",
"target",
"system",
"."
] | b58605265b0c4c34d2981a2f330ffe5573dc7417 | https://github.com/jenkinsci/groovy-plugin/blob/b58605265b0c4c34d2981a2f330ffe5573dc7417/src/main/java/hudson/plugins/groovy/GroovyInstallation.java#L37-L49 | train |
jenkinsci/groovy-plugin | src/main/java/hudson/plugins/groovy/Groovy.java | Groovy.parseParams | private String[] parseParams(String line) {
//JENKINS-24870 CommandLine.getExecutable tries to fix file separators, so if the first param contains slashes, it can cause problems
//Adding some placeholder instead of executable
CommandLine cmdLine = CommandLine.parse("executable_placeholder " + li... | java | private String[] parseParams(String line) {
//JENKINS-24870 CommandLine.getExecutable tries to fix file separators, so if the first param contains slashes, it can cause problems
//Adding some placeholder instead of executable
CommandLine cmdLine = CommandLine.parse("executable_placeholder " + li... | [
"private",
"String",
"[",
"]",
"parseParams",
"(",
"String",
"line",
")",
"{",
"//JENKINS-24870 CommandLine.getExecutable tries to fix file separators, so if the first param contains slashes, it can cause problems",
"//Adding some placeholder instead of executable",
"CommandLine",
"cmdLine... | Parse parameters to be passed as arguments to the groovy binary | [
"Parse",
"parameters",
"to",
"be",
"passed",
"as",
"arguments",
"to",
"the",
"groovy",
"binary"
] | b58605265b0c4c34d2981a2f330ffe5573dc7417 | https://github.com/jenkinsci/groovy-plugin/blob/b58605265b0c4c34d2981a2f330ffe5573dc7417/src/main/java/hudson/plugins/groovy/Groovy.java#L321-L331 | train |
depsypher/pngtastic | src/main/java/com/googlecode/pngtastic/core/PngOptimizer.java | PngOptimizer.getTotalSavings | public long getTotalSavings() {
long totalSavings = 0;
for (OptimizerResult result : results) {
totalSavings += (result.getOriginalFileSize() - result.getOptimizedFileSize());
}
return totalSavings;
} | java | public long getTotalSavings() {
long totalSavings = 0;
for (OptimizerResult result : results) {
totalSavings += (result.getOriginalFileSize() - result.getOptimizedFileSize());
}
return totalSavings;
} | [
"public",
"long",
"getTotalSavings",
"(",
")",
"{",
"long",
"totalSavings",
"=",
"0",
";",
"for",
"(",
"OptimizerResult",
"result",
":",
"results",
")",
"{",
"totalSavings",
"+=",
"(",
"result",
".",
"getOriginalFileSize",
"(",
")",
"-",
"result",
".",
"ge... | Get the number of bytes saved in all images processed so far
@return The number of bytes saved | [
"Get",
"the",
"number",
"of",
"bytes",
"saved",
"in",
"all",
"images",
"processed",
"so",
"far"
] | 13fd2a63dd8b2febd7041273889a1bba4f2a6a07 | https://github.com/depsypher/pngtastic/blob/13fd2a63dd8b2febd7041273889a1bba4f2a6a07/src/main/java/com/googlecode/pngtastic/core/PngOptimizer.java#L224-L231 | train |
depsypher/pngtastic | src/main/java/com/googlecode/pngtastic/core/PngOptimizer.java | PngOptimizer.generateDataUriCss | public void generateDataUriCss(String dir) throws IOException {
final String path = (dir == null) ? "" : dir + "/";
final PrintWriter out = new PrintWriter(path + "DataUriCss.html");
try {
out.append("<html>\n<head>\n\t<style>");
for (OptimizerResult result : results) {
final String name = result.file... | java | public void generateDataUriCss(String dir) throws IOException {
final String path = (dir == null) ? "" : dir + "/";
final PrintWriter out = new PrintWriter(path + "DataUriCss.html");
try {
out.append("<html>\n<head>\n\t<style>");
for (OptimizerResult result : results) {
final String name = result.file... | [
"public",
"void",
"generateDataUriCss",
"(",
"String",
"dir",
")",
"throws",
"IOException",
"{",
"final",
"String",
"path",
"=",
"(",
"dir",
"==",
"null",
")",
"?",
"\"\"",
":",
"dir",
"+",
"\"/\"",
";",
"final",
"PrintWriter",
"out",
"=",
"new",
"PrintW... | Get the css containing data uris of the images processed by the optimizer | [
"Get",
"the",
"css",
"containing",
"data",
"uris",
"of",
"the",
"images",
"processed",
"by",
"the",
"optimizer"
] | 13fd2a63dd8b2febd7041273889a1bba4f2a6a07 | https://github.com/depsypher/pngtastic/blob/13fd2a63dd8b2febd7041273889a1bba4f2a6a07/src/main/java/com/googlecode/pngtastic/core/PngOptimizer.java#L236-L265 | train |
depsypher/pngtastic | src/main/java/com/googlecode/pngtastic/core/processing/Base64.java | Base64.decodeToFile | public static void decodeToFile(String dataToDecode, String filename) throws IOException {
Base64.OutputStream bos = null;
try {
bos = new Base64.OutputStream(new FileOutputStream(filename), Base64.DECODE);
bos.write(dataToDecode.getBytes(PREFERRED_ENCODING));
} catch (IOException e) {
throw e; // Catch ... | java | public static void decodeToFile(String dataToDecode, String filename) throws IOException {
Base64.OutputStream bos = null;
try {
bos = new Base64.OutputStream(new FileOutputStream(filename), Base64.DECODE);
bos.write(dataToDecode.getBytes(PREFERRED_ENCODING));
} catch (IOException e) {
throw e; // Catch ... | [
"public",
"static",
"void",
"decodeToFile",
"(",
"String",
"dataToDecode",
",",
"String",
"filename",
")",
"throws",
"IOException",
"{",
"Base64",
".",
"OutputStream",
"bos",
"=",
"null",
";",
"try",
"{",
"bos",
"=",
"new",
"Base64",
".",
"OutputStream",
"("... | Convenience method for decoding data to a file.
<p>As of v 2.3, if there is a error, the method will throw an IOException.
<b>This is new to v2.3!</b> In earlier versions, it just returned false, but
in retrospect that's a pretty poor way to handle it.</p>
@param dataToDecode Base64-encoded data as a string
@param fi... | [
"Convenience",
"method",
"for",
"decoding",
"data",
"to",
"a",
"file",
"."
] | 13fd2a63dd8b2febd7041273889a1bba4f2a6a07 | https://github.com/depsypher/pngtastic/blob/13fd2a63dd8b2febd7041273889a1bba4f2a6a07/src/main/java/com/googlecode/pngtastic/core/processing/Base64.java#L1321-L1336 | train |
depsypher/pngtastic | src/main/java/com/googlecode/pngtastic/core/processing/zopfli/SymbolStats.java | SymbolStats.getFreqs | void getFreqs(LzStore store) {
int[] sLitLens = this.litLens;
int[] sDists = this.dists;
System.arraycopy(Cookie.intZeroes, 0, sLitLens, 0, 288);
System.arraycopy(Cookie.intZeroes, 0, sDists, 0, 32);
int size = store.size;
char[] litLens = store.litLens;
char[] d... | java | void getFreqs(LzStore store) {
int[] sLitLens = this.litLens;
int[] sDists = this.dists;
System.arraycopy(Cookie.intZeroes, 0, sLitLens, 0, 288);
System.arraycopy(Cookie.intZeroes, 0, sDists, 0, 32);
int size = store.size;
char[] litLens = store.litLens;
char[] d... | [
"void",
"getFreqs",
"(",
"LzStore",
"store",
")",
"{",
"int",
"[",
"]",
"sLitLens",
"=",
"this",
".",
"litLens",
";",
"int",
"[",
"]",
"sDists",
"=",
"this",
".",
"dists",
";",
"System",
".",
"arraycopy",
"(",
"Cookie",
".",
"intZeroes",
",",
"0",
... | Why 32? Expect 30. | [
"Why",
"32?",
"Expect",
"30",
"."
] | 13fd2a63dd8b2febd7041273889a1bba4f2a6a07 | https://github.com/depsypher/pngtastic/blob/13fd2a63dd8b2febd7041273889a1bba4f2a6a07/src/main/java/com/googlecode/pngtastic/core/processing/zopfli/SymbolStats.java#L29-L52 | train |
depsypher/pngtastic | src/main/java/com/googlecode/pngtastic/core/processing/zopfli/Zopfli.java | Zopfli.adler32 | private static long adler32(byte[] data) {
final Adler32 checksum = new Adler32();
checksum.update(data);
return checksum.getValue();
} | java | private static long adler32(byte[] data) {
final Adler32 checksum = new Adler32();
checksum.update(data);
return checksum.getValue();
} | [
"private",
"static",
"long",
"adler32",
"(",
"byte",
"[",
"]",
"data",
")",
"{",
"final",
"Adler32",
"checksum",
"=",
"new",
"Adler32",
"(",
")",
";",
"checksum",
".",
"update",
"(",
"data",
")",
";",
"return",
"checksum",
".",
"getValue",
"(",
")",
... | Calculates the adler32 checksum of the data | [
"Calculates",
"the",
"adler32",
"checksum",
"of",
"the",
"data"
] | 13fd2a63dd8b2febd7041273889a1bba4f2a6a07 | https://github.com/depsypher/pngtastic/blob/13fd2a63dd8b2febd7041273889a1bba4f2a6a07/src/main/java/com/googlecode/pngtastic/core/processing/zopfli/Zopfli.java#L34-L38 | train |
depsypher/pngtastic | src/main/java/com/googlecode/pngtastic/core/Logger.java | Logger.info | public void info(String message, Object... args) {
if (DEBUG.equals(this.logLevel) || INFO.equals(this.logLevel)) {
System.out.println(String.format(message, args));
}
} | java | public void info(String message, Object... args) {
if (DEBUG.equals(this.logLevel) || INFO.equals(this.logLevel)) {
System.out.println(String.format(message, args));
}
} | [
"public",
"void",
"info",
"(",
"String",
"message",
",",
"Object",
"...",
"args",
")",
"{",
"if",
"(",
"DEBUG",
".",
"equals",
"(",
"this",
".",
"logLevel",
")",
"||",
"INFO",
".",
"equals",
"(",
"this",
".",
"logLevel",
")",
")",
"{",
"System",
".... | Write info messages.
Takes a varags list of args so that string concatenation only happens if the logging level applies. | [
"Write",
"info",
"messages",
".",
"Takes",
"a",
"varags",
"list",
"of",
"args",
"so",
"that",
"string",
"concatenation",
"only",
"happens",
"if",
"the",
"logging",
"level",
"applies",
"."
] | 13fd2a63dd8b2febd7041273889a1bba4f2a6a07 | https://github.com/depsypher/pngtastic/blob/13fd2a63dd8b2febd7041273889a1bba4f2a6a07/src/main/java/com/googlecode/pngtastic/core/Logger.java#L41-L45 | train |
depsypher/pngtastic | src/main/java/com/googlecode/pngtastic/core/Logger.java | Logger.error | public void error(String message, Object... args) {
if (!NONE.equals(this.logLevel)) {
System.out.println(String.format(message, args));
}
} | java | public void error(String message, Object... args) {
if (!NONE.equals(this.logLevel)) {
System.out.println(String.format(message, args));
}
} | [
"public",
"void",
"error",
"(",
"String",
"message",
",",
"Object",
"...",
"args",
")",
"{",
"if",
"(",
"!",
"NONE",
".",
"equals",
"(",
"this",
".",
"logLevel",
")",
")",
"{",
"System",
".",
"out",
".",
"println",
"(",
"String",
".",
"format",
"("... | Write error messages.
Takes a varags list of args so that string concatenation only happens if the logging level applies. | [
"Write",
"error",
"messages",
".",
"Takes",
"a",
"varags",
"list",
"of",
"args",
"so",
"that",
"string",
"concatenation",
"only",
"happens",
"if",
"the",
"logging",
"level",
"applies",
"."
] | 13fd2a63dd8b2febd7041273889a1bba4f2a6a07 | https://github.com/depsypher/pngtastic/blob/13fd2a63dd8b2febd7041273889a1bba4f2a6a07/src/main/java/com/googlecode/pngtastic/core/Logger.java#L51-L55 | train |
fleipold/jproc | src/main/java/org/buildobjects/process/ProcBuilder.java | ProcBuilder.withWorkingDirectory | public ProcBuilder withWorkingDirectory(File directory) {
if (!directory.isDirectory()) {
throw new IllegalArgumentException("File '" + directory.getPath() + "' is not a directory.");
}
this.directory = directory;
return this;
} | java | public ProcBuilder withWorkingDirectory(File directory) {
if (!directory.isDirectory()) {
throw new IllegalArgumentException("File '" + directory.getPath() + "' is not a directory.");
}
this.directory = directory;
return this;
} | [
"public",
"ProcBuilder",
"withWorkingDirectory",
"(",
"File",
"directory",
")",
"{",
"if",
"(",
"!",
"directory",
".",
"isDirectory",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"File '\"",
"+",
"directory",
".",
"getPath",
"(",
")",... | Override the wokring directory
@param directory the working directory for the process
@return this, for chaining | [
"Override",
"the",
"wokring",
"directory"
] | 617f498c63a822c6b0506a2474b3bc954ea25c9a | https://github.com/fleipold/jproc/blob/617f498c63a822c6b0506a2474b3bc954ea25c9a/src/main/java/org/buildobjects/process/ProcBuilder.java#L128-L134 | train |
fleipold/jproc | src/main/java/org/buildobjects/process/ProcBuilder.java | ProcBuilder.run | public ProcResult run() throws StartupException, TimeoutException, ExternalProcessFailureException {
if (stdout != defaultStdout && outputConsumer != null) {
throw new IllegalArgumentException("You can either ...");
}
try {
Proc proc = new Proc(command, args, env, stdin... | java | public ProcResult run() throws StartupException, TimeoutException, ExternalProcessFailureException {
if (stdout != defaultStdout && outputConsumer != null) {
throw new IllegalArgumentException("You can either ...");
}
try {
Proc proc = new Proc(command, args, env, stdin... | [
"public",
"ProcResult",
"run",
"(",
")",
"throws",
"StartupException",
",",
"TimeoutException",
",",
"ExternalProcessFailureException",
"{",
"if",
"(",
"stdout",
"!=",
"defaultStdout",
"&&",
"outputConsumer",
"!=",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentE... | Spawn the actual execution.
This will block until the process terminates.
@return the result of the successful execution
@throws StartupException if the process can't be started
@throws TimeoutException if the timeout kicked in
@throws ExternalProcessFailureException if the external process returned a non-null exit val... | [
"Spawn",
"the",
"actual",
"execution",
".",
"This",
"will",
"block",
"until",
"the",
"process",
"terminates",
"."
] | 617f498c63a822c6b0506a2474b3bc954ea25c9a | https://github.com/fleipold/jproc/blob/617f498c63a822c6b0506a2474b3bc954ea25c9a/src/main/java/org/buildobjects/process/ProcBuilder.java#L198-L212 | train |
fleipold/jproc | src/main/java/org/buildobjects/process/ProcBuilder.java | ProcBuilder.run | public static String run(String cmd, String... args) {
ProcBuilder builder= new ProcBuilder(cmd)
.withArgs(args);
return builder.run().getOutputString();
} | java | public static String run(String cmd, String... args) {
ProcBuilder builder= new ProcBuilder(cmd)
.withArgs(args);
return builder.run().getOutputString();
} | [
"public",
"static",
"String",
"run",
"(",
"String",
"cmd",
",",
"String",
"...",
"args",
")",
"{",
"ProcBuilder",
"builder",
"=",
"new",
"ProcBuilder",
"(",
"cmd",
")",
".",
"withArgs",
"(",
"args",
")",
";",
"return",
"builder",
".",
"run",
"(",
")",
... | Static helper to run a process
@param cmd the command
@param args the arguments
@return the standard output
@throws StartupException if the process can't be started
@throws TimeoutException if the timeout kicked in
@throws ExternalProcessFailureException if the external process returned a non-null exit value | [
"Static",
"helper",
"to",
"run",
"a",
"process"
] | 617f498c63a822c6b0506a2474b3bc954ea25c9a | https://github.com/fleipold/jproc/blob/617f498c63a822c6b0506a2474b3bc954ea25c9a/src/main/java/org/buildobjects/process/ProcBuilder.java#L222-L227 | train |
fleipold/jproc | src/main/java/org/buildobjects/process/ProcBuilder.java | ProcBuilder.filter | public static String filter(String input, String cmd, String... args) {
ProcBuilder builder= new ProcBuilder(cmd)
.withArgs(args)
.withInput(input);
return builder.run().getOutputString();
} | java | public static String filter(String input, String cmd, String... args) {
ProcBuilder builder= new ProcBuilder(cmd)
.withArgs(args)
.withInput(input);
return builder.run().getOutputString();
} | [
"public",
"static",
"String",
"filter",
"(",
"String",
"input",
",",
"String",
"cmd",
",",
"String",
"...",
"args",
")",
"{",
"ProcBuilder",
"builder",
"=",
"new",
"ProcBuilder",
"(",
"cmd",
")",
".",
"withArgs",
"(",
"args",
")",
".",
"withInput",
"(",
... | Static helper to filter a string through a process
@param input the input to be fed into the process
@param cmd the command
@param args the arguments
@return the standard output
@throws StartupException if the process can't be started
@throws TimeoutException if the timeout kicked in
@throws ExternalProcessFailureExcep... | [
"Static",
"helper",
"to",
"filter",
"a",
"string",
"through",
"a",
"process"
] | 617f498c63a822c6b0506a2474b3bc954ea25c9a | https://github.com/fleipold/jproc/blob/617f498c63a822c6b0506a2474b3bc954ea25c9a/src/main/java/org/buildobjects/process/ProcBuilder.java#L238-L245 | train |
epam/parso | src/main/java/com/epam/parso/impl/CSVMetadataWriterImpl.java | CSVMetadataWriterImpl.writeSasFileProperties | @Override
public void writeSasFileProperties(SasFileProperties sasFileProperties) throws IOException {
constructPropertiesString("Bitness: ", sasFileProperties.isU64() ? "x64" : "x86");
constructPropertiesString("Compressed: ", sasFileProperties.getCompressionMethod());
constructPropertiesSt... | java | @Override
public void writeSasFileProperties(SasFileProperties sasFileProperties) throws IOException {
constructPropertiesString("Bitness: ", sasFileProperties.isU64() ? "x64" : "x86");
constructPropertiesString("Compressed: ", sasFileProperties.getCompressionMethod());
constructPropertiesSt... | [
"@",
"Override",
"public",
"void",
"writeSasFileProperties",
"(",
"SasFileProperties",
"sasFileProperties",
")",
"throws",
"IOException",
"{",
"constructPropertiesString",
"(",
"\"Bitness: \"",
",",
"sasFileProperties",
".",
"isU64",
"(",
")",
"?",
"\"x64\"",
":",
"\"... | The method to output the sas7bdat file properties.
@param sasFileProperties the variable with sas file properties data.
@throws IOException appears if the output into writer is impossible. | [
"The",
"method",
"to",
"output",
"the",
"sas7bdat",
"file",
"properties",
"."
] | fb132cf943ba099a35b2f5a1490c0a59641e09dc | https://github.com/epam/parso/blob/fb132cf943ba099a35b2f5a1490c0a59641e09dc/src/main/java/com/epam/parso/impl/CSVMetadataWriterImpl.java#L165-L189 | train |
epam/parso | src/main/java/com/epam/parso/impl/CSVMetadataWriterImpl.java | CSVMetadataWriterImpl.constructPropertiesString | private void constructPropertiesString(String propertyName, Object property) throws IOException {
getWriter().write(propertyName + String.valueOf(property) + "\n");
} | java | private void constructPropertiesString(String propertyName, Object property) throws IOException {
getWriter().write(propertyName + String.valueOf(property) + "\n");
} | [
"private",
"void",
"constructPropertiesString",
"(",
"String",
"propertyName",
",",
"Object",
"property",
")",
"throws",
"IOException",
"{",
"getWriter",
"(",
")",
".",
"write",
"(",
"propertyName",
"+",
"String",
".",
"valueOf",
"(",
"property",
")",
"+",
"\"... | The method to output string containing information about passed property using writer.
@param propertyName the string containing name of a property.
@param property a property value.
@throws IOException appears if the output into writer is impossible. | [
"The",
"method",
"to",
"output",
"string",
"containing",
"information",
"about",
"passed",
"property",
"using",
"writer",
"."
] | fb132cf943ba099a35b2f5a1490c0a59641e09dc | https://github.com/epam/parso/blob/fb132cf943ba099a35b2f5a1490c0a59641e09dc/src/main/java/com/epam/parso/impl/CSVMetadataWriterImpl.java#L198-L200 | train |
epam/parso | src/main/java/com/epam/parso/DataWriterUtil.java | DataWriterUtil.processEntry | private static String processEntry(Column column, Object entry, Locale locale,
Map<Integer, Format> columnFormatters) throws IOException {
if (!String.valueOf(entry).contains(DOUBLE_INFINITY_STRING)) {
String valueToPrint;
if (entry.getClass() == Da... | java | private static String processEntry(Column column, Object entry, Locale locale,
Map<Integer, Format> columnFormatters) throws IOException {
if (!String.valueOf(entry).contains(DOUBLE_INFINITY_STRING)) {
String valueToPrint;
if (entry.getClass() == Da... | [
"private",
"static",
"String",
"processEntry",
"(",
"Column",
"column",
",",
"Object",
"entry",
",",
"Locale",
"locale",
",",
"Map",
"<",
"Integer",
",",
"Format",
">",
"columnFormatters",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"String",
".",
"... | Checks current entry type and returns its string representation.
@param column current processing column.
@param entry current processing entry.
@param locale the locale for parsing date and percent elements.
@param columnFormatters the map that stores (@link Column#id) column identifier... | [
"Checks",
"current",
"entry",
"type",
"and",
"returns",
"its",
"string",
"representation",
"."
] | fb132cf943ba099a35b2f5a1490c0a59641e09dc | https://github.com/epam/parso/blob/fb132cf943ba099a35b2f5a1490c0a59641e09dc/src/main/java/com/epam/parso/DataWriterUtil.java#L225-L251 | train |
epam/parso | src/main/java/com/epam/parso/DataWriterUtil.java | DataWriterUtil.convertDateElementToString | private static String convertDateElementToString(Date currentDate, SimpleDateFormat dateFormat) {
return currentDate.getTime() != 0 ? dateFormat.format(currentDate.getTime()) : "";
} | java | private static String convertDateElementToString(Date currentDate, SimpleDateFormat dateFormat) {
return currentDate.getTime() != 0 ? dateFormat.format(currentDate.getTime()) : "";
} | [
"private",
"static",
"String",
"convertDateElementToString",
"(",
"Date",
"currentDate",
",",
"SimpleDateFormat",
"dateFormat",
")",
"{",
"return",
"currentDate",
".",
"getTime",
"(",
")",
"!=",
"0",
"?",
"dateFormat",
".",
"format",
"(",
"currentDate",
".",
"ge... | The function to convert a date into a string according to the format used.
@param currentDate the date to convert.
@param dateFormat the formatter to convert date element into string.
@return the string that corresponds to the date in the format used. | [
"The",
"function",
"to",
"convert",
"a",
"date",
"into",
"a",
"string",
"according",
"to",
"the",
"format",
"used",
"."
] | fb132cf943ba099a35b2f5a1490c0a59641e09dc | https://github.com/epam/parso/blob/fb132cf943ba099a35b2f5a1490c0a59641e09dc/src/main/java/com/epam/parso/DataWriterUtil.java#L260-L262 | train |
epam/parso | src/main/java/com/epam/parso/DataWriterUtil.java | DataWriterUtil.convertPercentElementToString | private static String convertPercentElementToString(Object value, DecimalFormat decimalFormat) {
Double doubleValue = value instanceof Long ? ((Long) value).doubleValue() : (Double) value;
return decimalFormat.format(doubleValue);
} | java | private static String convertPercentElementToString(Object value, DecimalFormat decimalFormat) {
Double doubleValue = value instanceof Long ? ((Long) value).doubleValue() : (Double) value;
return decimalFormat.format(doubleValue);
} | [
"private",
"static",
"String",
"convertPercentElementToString",
"(",
"Object",
"value",
",",
"DecimalFormat",
"decimalFormat",
")",
"{",
"Double",
"doubleValue",
"=",
"value",
"instanceof",
"Long",
"?",
"(",
"(",
"Long",
")",
"value",
")",
".",
"doubleValue",
"(... | The function to convert a percent element into a string.
@param value the input numeric value to convert.
@param decimalFormat the formatter to convert percentage element into string.
@return the string with the text presentation of the input numeric value. | [
"The",
"function",
"to",
"convert",
"a",
"percent",
"element",
"into",
"a",
"string",
"."
] | fb132cf943ba099a35b2f5a1490c0a59641e09dc | https://github.com/epam/parso/blob/fb132cf943ba099a35b2f5a1490c0a59641e09dc/src/main/java/com/epam/parso/DataWriterUtil.java#L308-L311 | train |
epam/parso | src/main/java/com/epam/parso/DataWriterUtil.java | DataWriterUtil.trimZerosFromEnd | private static String trimZerosFromEnd(String string) {
return string.contains(".") ? string.replaceAll("0*$", "").replaceAll("\\.$", "") : string;
} | java | private static String trimZerosFromEnd(String string) {
return string.contains(".") ? string.replaceAll("0*$", "").replaceAll("\\.$", "") : string;
} | [
"private",
"static",
"String",
"trimZerosFromEnd",
"(",
"String",
"string",
")",
"{",
"return",
"string",
".",
"contains",
"(",
"\".\"",
")",
"?",
"string",
".",
"replaceAll",
"(",
"\"0*$\"",
",",
"\"\"",
")",
".",
"replaceAll",
"(",
"\"\\\\.$\"",
",",
"\"... | The function to remove trailing zeros from the decimal part of the numerals represented by a string.
If there are no digits after the point, the point is deleted as well.
@param string the input string trailing zeros.
@return the string without trailing zeros. | [
"The",
"function",
"to",
"remove",
"trailing",
"zeros",
"from",
"the",
"decimal",
"part",
"of",
"the",
"numerals",
"represented",
"by",
"a",
"string",
".",
"If",
"there",
"are",
"no",
"digits",
"after",
"the",
"point",
"the",
"point",
"is",
"deleted",
"as"... | fb132cf943ba099a35b2f5a1490c0a59641e09dc | https://github.com/epam/parso/blob/fb132cf943ba099a35b2f5a1490c0a59641e09dc/src/main/java/com/epam/parso/DataWriterUtil.java#L320-L322 | train |
epam/parso | src/main/java/com/epam/parso/DataWriterUtil.java | DataWriterUtil.getValue | public static String getValue(Column column, Object entry, Locale locale,
Map<Integer, Format> columnFormatters) throws IOException {
String value = "";
if (entry != null) {
if (entry.getClass().getName().compareTo(BYTE_ARRAY_CLASS_NAME) == 0) {
... | java | public static String getValue(Column column, Object entry, Locale locale,
Map<Integer, Format> columnFormatters) throws IOException {
String value = "";
if (entry != null) {
if (entry.getClass().getName().compareTo(BYTE_ARRAY_CLASS_NAME) == 0) {
... | [
"public",
"static",
"String",
"getValue",
"(",
"Column",
"column",
",",
"Object",
"entry",
",",
"Locale",
"locale",
",",
"Map",
"<",
"Integer",
",",
"Format",
">",
"columnFormatters",
")",
"throws",
"IOException",
"{",
"String",
"value",
"=",
"\"\"",
";",
... | The method to convert the Object that stores data from the sas7bdat file cell to string.
@param column the {@link Column} class variable that stores current processing column.
@param entry the Object that stores data from the cell of sas7bdat file.
@param locale the locale for parsing da... | [
"The",
"method",
"to",
"convert",
"the",
"Object",
"that",
"stores",
"data",
"from",
"the",
"sas7bdat",
"file",
"cell",
"to",
"string",
"."
] | fb132cf943ba099a35b2f5a1490c0a59641e09dc | https://github.com/epam/parso/blob/fb132cf943ba099a35b2f5a1490c0a59641e09dc/src/main/java/com/epam/parso/DataWriterUtil.java#L372-L383 | train |
epam/parso | src/main/java/com/epam/parso/DataWriterUtil.java | DataWriterUtil.getPercentFormatProcessor | private static Format getPercentFormatProcessor(ColumnFormat columnFormat, Locale locale) {
DecimalFormatSymbols dfs = new DecimalFormatSymbols(locale);
if (columnFormat.getPrecision() == 0) {
return new DecimalFormat("0%", dfs);
}
String pattern = "0%." + new String(new char... | java | private static Format getPercentFormatProcessor(ColumnFormat columnFormat, Locale locale) {
DecimalFormatSymbols dfs = new DecimalFormatSymbols(locale);
if (columnFormat.getPrecision() == 0) {
return new DecimalFormat("0%", dfs);
}
String pattern = "0%." + new String(new char... | [
"private",
"static",
"Format",
"getPercentFormatProcessor",
"(",
"ColumnFormat",
"columnFormat",
",",
"Locale",
"locale",
")",
"{",
"DecimalFormatSymbols",
"dfs",
"=",
"new",
"DecimalFormatSymbols",
"(",
"locale",
")",
";",
"if",
"(",
"columnFormat",
".",
"getPrecis... | The function to get a formatter to convert percentage elements into a string.
@param columnFormat the (@link ColumnFormat) class variable that stores the precision of rounding
the converted value.
@param locale locale for parsing date elements.
@return a formatter to convert percentage elements into a string. | [
"The",
"function",
"to",
"get",
"a",
"formatter",
"to",
"convert",
"percentage",
"elements",
"into",
"a",
"string",
"."
] | fb132cf943ba099a35b2f5a1490c0a59641e09dc | https://github.com/epam/parso/blob/fb132cf943ba099a35b2f5a1490c0a59641e09dc/src/main/java/com/epam/parso/DataWriterUtil.java#L393-L400 | train |
epam/parso | src/main/java/com/epam/parso/DataWriterUtil.java | DataWriterUtil.getDateFormatProcessor | private static Format getDateFormatProcessor(ColumnFormat columnFormat, Locale locale) {
if (!DATE_OUTPUT_FORMAT_STRINGS.containsKey(columnFormat.getName())) {
throw new NoSuchElementException(UNKNOWN_DATE_FORMAT_EXCEPTION);
}
SimpleDateFormat dateFormat =
new SimpleD... | java | private static Format getDateFormatProcessor(ColumnFormat columnFormat, Locale locale) {
if (!DATE_OUTPUT_FORMAT_STRINGS.containsKey(columnFormat.getName())) {
throw new NoSuchElementException(UNKNOWN_DATE_FORMAT_EXCEPTION);
}
SimpleDateFormat dateFormat =
new SimpleD... | [
"private",
"static",
"Format",
"getDateFormatProcessor",
"(",
"ColumnFormat",
"columnFormat",
",",
"Locale",
"locale",
")",
"{",
"if",
"(",
"!",
"DATE_OUTPUT_FORMAT_STRINGS",
".",
"containsKey",
"(",
"columnFormat",
".",
"getName",
"(",
")",
")",
")",
"{",
"thro... | The function to get a formatter to convert date elements into a string.
@param columnFormat the (@link ColumnFormat) class variable that stores the format name that must belong to
the set of {@link DataWriterUtil#DATE_OUTPUT_FORMAT_STRINGS} mapping keys.
@param locale locale for parsing date elements.
@return a ... | [
"The",
"function",
"to",
"get",
"a",
"formatter",
"to",
"convert",
"date",
"elements",
"into",
"a",
"string",
"."
] | fb132cf943ba099a35b2f5a1490c0a59641e09dc | https://github.com/epam/parso/blob/fb132cf943ba099a35b2f5a1490c0a59641e09dc/src/main/java/com/epam/parso/DataWriterUtil.java#L410-L418 | train |
epam/parso | src/main/java/com/epam/parso/impl/AbstractCSVWriter.java | AbstractCSVWriter.checkSurroundByQuotesAndWrite | static void checkSurroundByQuotesAndWrite(Writer writer, String delimiter, String trimmedText) throws IOException {
writer.write(checkSurroundByQuotes(delimiter, trimmedText));
} | java | static void checkSurroundByQuotesAndWrite(Writer writer, String delimiter, String trimmedText) throws IOException {
writer.write(checkSurroundByQuotes(delimiter, trimmedText));
} | [
"static",
"void",
"checkSurroundByQuotesAndWrite",
"(",
"Writer",
"writer",
",",
"String",
"delimiter",
",",
"String",
"trimmedText",
")",
"throws",
"IOException",
"{",
"writer",
".",
"write",
"(",
"checkSurroundByQuotes",
"(",
"delimiter",
",",
"trimmedText",
")",
... | The method to write a text represented by an array of bytes using writer.
If the text contains the delimiter, line breaks, tabulation characters, and double quotes, the text is stropped.
@param writer the variable to output data.
@param delimiter if trimmedText contains this delimiter it will be stropped.
@para... | [
"The",
"method",
"to",
"write",
"a",
"text",
"represented",
"by",
"an",
"array",
"of",
"bytes",
"using",
"writer",
".",
"If",
"the",
"text",
"contains",
"the",
"delimiter",
"line",
"breaks",
"tabulation",
"characters",
"and",
"double",
"quotes",
"the",
"text... | fb132cf943ba099a35b2f5a1490c0a59641e09dc | https://github.com/epam/parso/blob/fb132cf943ba099a35b2f5a1490c0a59641e09dc/src/main/java/com/epam/parso/impl/AbstractCSVWriter.java#L120-L122 | train |
epam/parso | src/main/java/com/epam/parso/impl/AbstractCSVWriter.java | AbstractCSVWriter.checkSurroundByQuotes | static String checkSurroundByQuotes(String delimiter, String trimmedText) throws IOException {
boolean containsDelimiter = stringContainsItemFromList(trimmedText, delimiter, "\n", "\t", "\r", "\"");
String trimmedTextWithoutQuotesDuplicates = trimmedText.replace("\"", "\"\"");
if (containsDelimi... | java | static String checkSurroundByQuotes(String delimiter, String trimmedText) throws IOException {
boolean containsDelimiter = stringContainsItemFromList(trimmedText, delimiter, "\n", "\t", "\r", "\"");
String trimmedTextWithoutQuotesDuplicates = trimmedText.replace("\"", "\"\"");
if (containsDelimi... | [
"static",
"String",
"checkSurroundByQuotes",
"(",
"String",
"delimiter",
",",
"String",
"trimmedText",
")",
"throws",
"IOException",
"{",
"boolean",
"containsDelimiter",
"=",
"stringContainsItemFromList",
"(",
"trimmedText",
",",
"delimiter",
",",
"\"\\n\"",
",",
"\"\... | The method to output a text represented by an array of bytes.
If the text contains the delimiter, line breaks, tabulation characters, and double quotes, the text is stropped.
@param delimiter if trimmedText contains this delimiter it will be stropped.
@param trimmedText the array of bytes that contains the text to o... | [
"The",
"method",
"to",
"output",
"a",
"text",
"represented",
"by",
"an",
"array",
"of",
"bytes",
".",
"If",
"the",
"text",
"contains",
"the",
"delimiter",
"line",
"breaks",
"tabulation",
"characters",
"and",
"double",
"quotes",
"the",
"text",
"is",
"stropped... | fb132cf943ba099a35b2f5a1490c0a59641e09dc | https://github.com/epam/parso/blob/fb132cf943ba099a35b2f5a1490c0a59641e09dc/src/main/java/com/epam/parso/impl/AbstractCSVWriter.java#L133-L140 | train |
epam/parso | src/main/java/com/epam/parso/impl/SasFileParser.java | SasFileParser.readNext | Object[] readNext(List<String> columnNames) throws IOException {
if (currentRowInFileIndex++ >= sasFileProperties.getRowCount() || eof) {
return null;
}
int bitOffset = sasFileProperties.isU64() ? PAGE_BIT_OFFSET_X64 : PAGE_BIT_OFFSET_X86;
switch (currentPageType) {
... | java | Object[] readNext(List<String> columnNames) throws IOException {
if (currentRowInFileIndex++ >= sasFileProperties.getRowCount() || eof) {
return null;
}
int bitOffset = sasFileProperties.isU64() ? PAGE_BIT_OFFSET_X64 : PAGE_BIT_OFFSET_X86;
switch (currentPageType) {
... | [
"Object",
"[",
"]",
"readNext",
"(",
"List",
"<",
"String",
">",
"columnNames",
")",
"throws",
"IOException",
"{",
"if",
"(",
"currentRowInFileIndex",
"++",
">=",
"sasFileProperties",
".",
"getRowCount",
"(",
")",
"||",
"eof",
")",
"{",
"return",
"null",
"... | The function to read next row from current sas7bdat file.
@param columnNames list of column names which should be processed.
@return the object array containing elements of current row.
@throws IOException if reading from the {@link SasFileParser#sasFileStream} stream is impossible. | [
"The",
"function",
"to",
"read",
"next",
"row",
"from",
"current",
"sas7bdat",
"file",
"."
] | fb132cf943ba099a35b2f5a1490c0a59641e09dc | https://github.com/epam/parso/blob/fb132cf943ba099a35b2f5a1490c0a59641e09dc/src/main/java/com/epam/parso/impl/SasFileParser.java#L506-L549 | train |
epam/parso | src/main/java/com/epam/parso/impl/SasFileParser.java | SasFileParser.processNextPage | private void processNextPage() throws IOException {
int bitOffset = sasFileProperties.isU64() ? PAGE_BIT_OFFSET_X64 : PAGE_BIT_OFFSET_X86;
currentPageDataSubheaderPointers.clear();
try {
sasFileStream.readFully(cachedPage, 0, sasFileProperties.getPageLength());
} catch (EOFE... | java | private void processNextPage() throws IOException {
int bitOffset = sasFileProperties.isU64() ? PAGE_BIT_OFFSET_X64 : PAGE_BIT_OFFSET_X86;
currentPageDataSubheaderPointers.clear();
try {
sasFileStream.readFully(cachedPage, 0, sasFileProperties.getPageLength());
} catch (EOFE... | [
"private",
"void",
"processNextPage",
"(",
")",
"throws",
"IOException",
"{",
"int",
"bitOffset",
"=",
"sasFileProperties",
".",
"isU64",
"(",
")",
"?",
"PAGE_BIT_OFFSET_X64",
":",
"PAGE_BIT_OFFSET_X86",
";",
"currentPageDataSubheaderPointers",
".",
"clear",
"(",
")... | Put next page to cache and read it's header.
@throws IOException if reading from the {@link SasFileParser#sasFileStream} string is impossible. | [
"Put",
"next",
"page",
"to",
"cache",
"and",
"read",
"it",
"s",
"header",
"."
] | fb132cf943ba099a35b2f5a1490c0a59641e09dc | https://github.com/epam/parso/blob/fb132cf943ba099a35b2f5a1490c0a59641e09dc/src/main/java/com/epam/parso/impl/SasFileParser.java#L576-L596 | train |
epam/parso | src/main/java/com/epam/parso/impl/SasFileParser.java | SasFileParser.processMissingColumnInfo | private void processMissingColumnInfo() throws UnsupportedEncodingException {
for (ColumnMissingInfo columnMissingInfo : columnMissingInfoList) {
String missedInfo = bytesToString(columnsNamesBytes.get(columnMissingInfo.getTextSubheaderIndex()),
columnMissingInfo.getOffset(), col... | java | private void processMissingColumnInfo() throws UnsupportedEncodingException {
for (ColumnMissingInfo columnMissingInfo : columnMissingInfoList) {
String missedInfo = bytesToString(columnsNamesBytes.get(columnMissingInfo.getTextSubheaderIndex()),
columnMissingInfo.getOffset(), col... | [
"private",
"void",
"processMissingColumnInfo",
"(",
")",
"throws",
"UnsupportedEncodingException",
"{",
"for",
"(",
"ColumnMissingInfo",
"columnMissingInfo",
":",
"columnMissingInfoList",
")",
"{",
"String",
"missedInfo",
"=",
"bytesToString",
"(",
"columnsNamesBytes",
".... | The function to process missing column information.
@throws UnsupportedEncodingException when unknown encoding. | [
"The",
"function",
"to",
"process",
"missing",
"column",
"information",
"."
] | fb132cf943ba099a35b2f5a1490c0a59641e09dc | https://github.com/epam/parso/blob/fb132cf943ba099a35b2f5a1490c0a59641e09dc/src/main/java/com/epam/parso/impl/SasFileParser.java#L603-L622 | train |
epam/parso | src/main/java/com/epam/parso/impl/SasFileParser.java | SasFileParser.processByteArrayWithData | private Object[] processByteArrayWithData(long rowOffset, long rowLength, List<String> columnNames) {
Object[] rowElements;
if (columnNames != null) {
rowElements = new Object[columnNames.size()];
} else {
rowElements = new Object[(int) sasFileProperties.getColumnsCount()... | java | private Object[] processByteArrayWithData(long rowOffset, long rowLength, List<String> columnNames) {
Object[] rowElements;
if (columnNames != null) {
rowElements = new Object[columnNames.size()];
} else {
rowElements = new Object[(int) sasFileProperties.getColumnsCount()... | [
"private",
"Object",
"[",
"]",
"processByteArrayWithData",
"(",
"long",
"rowOffset",
",",
"long",
"rowLength",
",",
"List",
"<",
"String",
">",
"columnNames",
")",
"{",
"Object",
"[",
"]",
"rowElements",
";",
"if",
"(",
"columnNames",
"!=",
"null",
")",
"{... | The function to convert the array of bytes that stores the data of a row into an array of objects.
Each object corresponds to a table cell.
@param rowOffset - the offset of the row in cachedPage.
@param rowLength - the length of the row.
@param columnNames - list of column names which should be processed.
@return ... | [
"The",
"function",
"to",
"convert",
"the",
"array",
"of",
"bytes",
"that",
"stores",
"the",
"data",
"of",
"a",
"row",
"into",
"an",
"array",
"of",
"objects",
".",
"Each",
"object",
"corresponds",
"to",
"a",
"table",
"cell",
"."
] | fb132cf943ba099a35b2f5a1490c0a59641e09dc | https://github.com/epam/parso/blob/fb132cf943ba099a35b2f5a1490c0a59641e09dc/src/main/java/com/epam/parso/impl/SasFileParser.java#L654-L686 | train |
epam/parso | src/main/java/com/epam/parso/impl/SasFileParser.java | SasFileParser.processElement | private Object processElement(byte[] source, int offset, int currentColumnIndex) {
byte[] temp;
int length = columnsDataLength.get(currentColumnIndex);
if (columns.get(currentColumnIndex).getType() == Number.class) {
temp = Arrays.copyOfRange(source, offset + (int) (long) columnsData... | java | private Object processElement(byte[] source, int offset, int currentColumnIndex) {
byte[] temp;
int length = columnsDataLength.get(currentColumnIndex);
if (columns.get(currentColumnIndex).getType() == Number.class) {
temp = Arrays.copyOfRange(source, offset + (int) (long) columnsData... | [
"private",
"Object",
"processElement",
"(",
"byte",
"[",
"]",
"source",
",",
"int",
"offset",
",",
"int",
"currentColumnIndex",
")",
"{",
"byte",
"[",
"]",
"temp",
";",
"int",
"length",
"=",
"columnsDataLength",
".",
"get",
"(",
"currentColumnIndex",
")",
... | The function to process element of row.
@param source an array of bytes containing required data.
@param offset the offset in source of required data.
@param currentColumnIndex index of the current element.
@return object storing the data of the element. | [
"The",
"function",
"to",
"process",
"element",
"of",
"row",
"."
] | fb132cf943ba099a35b2f5a1490c0a59641e09dc | https://github.com/epam/parso/blob/fb132cf943ba099a35b2f5a1490c0a59641e09dc/src/main/java/com/epam/parso/impl/SasFileParser.java#L696-L733 | train |
epam/parso | src/main/java/com/epam/parso/impl/SasFileParser.java | SasFileParser.getBytesFromFile | private List<byte[]> getBytesFromFile(Long[] offset, Integer[] length) throws IOException {
List<byte[]> vars = new ArrayList<byte[]>();
if (cachedPage == null) {
for (int i = 0; i < offset.length; i++) {
byte[] temp = new byte[length[i]];
long actuallySkipped... | java | private List<byte[]> getBytesFromFile(Long[] offset, Integer[] length) throws IOException {
List<byte[]> vars = new ArrayList<byte[]>();
if (cachedPage == null) {
for (int i = 0; i < offset.length; i++) {
byte[] temp = new byte[length[i]];
long actuallySkipped... | [
"private",
"List",
"<",
"byte",
"[",
"]",
">",
"getBytesFromFile",
"(",
"Long",
"[",
"]",
"offset",
",",
"Integer",
"[",
"]",
"length",
")",
"throws",
"IOException",
"{",
"List",
"<",
"byte",
"[",
"]",
">",
"vars",
"=",
"new",
"ArrayList",
"<",
"byte... | The function to read the list of bytes arrays from the sas7bdat file. The array of offsets and the array of
lengths serve as input data that define the location and number of bytes the function must read.
@param offset the array of offsets.
@param length the array of lengths.
@return the list of bytes arrays.
@throws ... | [
"The",
"function",
"to",
"read",
"the",
"list",
"of",
"bytes",
"arrays",
"from",
"the",
"sas7bdat",
"file",
".",
"The",
"array",
"of",
"offsets",
"and",
"the",
"array",
"of",
"lengths",
"serve",
"as",
"input",
"data",
"that",
"define",
"the",
"location",
... | fb132cf943ba099a35b2f5a1490c0a59641e09dc | https://github.com/epam/parso/blob/fb132cf943ba099a35b2f5a1490c0a59641e09dc/src/main/java/com/epam/parso/impl/SasFileParser.java#L744-L774 | train |
epam/parso | src/main/java/com/epam/parso/impl/SasFileParser.java | SasFileParser.bytesToString | private String bytesToString(byte[] bytes, int offset, int length)
throws UnsupportedEncodingException, StringIndexOutOfBoundsException {
return new String(bytes, offset, length, encoding);
} | java | private String bytesToString(byte[] bytes, int offset, int length)
throws UnsupportedEncodingException, StringIndexOutOfBoundsException {
return new String(bytes, offset, length, encoding);
} | [
"private",
"String",
"bytesToString",
"(",
"byte",
"[",
"]",
"bytes",
",",
"int",
"offset",
",",
"int",
"length",
")",
"throws",
"UnsupportedEncodingException",
",",
"StringIndexOutOfBoundsException",
"{",
"return",
"new",
"String",
"(",
"bytes",
",",
"offset",
... | The function to convert a sub-range of an array of bytes into a string.
@param bytes a string represented by an array of bytes.
@param offset the initial offset
@param length the length
@return the conversion result string.
@throws UnsupportedEncodingException when unknown encoding.
@throws StringIndexOutOfBoundsE... | [
"The",
"function",
"to",
"convert",
"a",
"sub",
"-",
"range",
"of",
"an",
"array",
"of",
"bytes",
"into",
"a",
"string",
"."
] | fb132cf943ba099a35b2f5a1490c0a59641e09dc | https://github.com/epam/parso/blob/fb132cf943ba099a35b2f5a1490c0a59641e09dc/src/main/java/com/epam/parso/impl/SasFileParser.java#L886-L889 | train |
epam/parso | src/main/java/com/epam/parso/impl/SasFileParser.java | SasFileParser.bytesToDouble | private double bytesToDouble(byte[] bytes) {
ByteBuffer original = byteArrayToByteBuffer(bytes);
if (bytes.length < BYTES_IN_DOUBLE) {
ByteBuffer byteBuffer = ByteBuffer.allocate(BYTES_IN_DOUBLE);
if (sasFileProperties.getEndianness() == 1) {
byteBuffer.position(... | java | private double bytesToDouble(byte[] bytes) {
ByteBuffer original = byteArrayToByteBuffer(bytes);
if (bytes.length < BYTES_IN_DOUBLE) {
ByteBuffer byteBuffer = ByteBuffer.allocate(BYTES_IN_DOUBLE);
if (sasFileProperties.getEndianness() == 1) {
byteBuffer.position(... | [
"private",
"double",
"bytesToDouble",
"(",
"byte",
"[",
"]",
"bytes",
")",
"{",
"ByteBuffer",
"original",
"=",
"byteArrayToByteBuffer",
"(",
"bytes",
")",
";",
"if",
"(",
"bytes",
".",
"length",
"<",
"BYTES_IN_DOUBLE",
")",
"{",
"ByteBuffer",
"byteBuffer",
"... | The function to convert an array of bytes into a double number.
@param bytes a double number represented by an array of bytes.
@return a number of the double type that is the conversion result. | [
"The",
"function",
"to",
"convert",
"an",
"array",
"of",
"bytes",
"into",
"a",
"double",
"number",
"."
] | fb132cf943ba099a35b2f5a1490c0a59641e09dc | https://github.com/epam/parso/blob/fb132cf943ba099a35b2f5a1490c0a59641e09dc/src/main/java/com/epam/parso/impl/SasFileParser.java#L925-L940 | train |
epam/parso | src/main/java/com/epam/parso/impl/SasFileParser.java | SasFileParser.trimBytesArray | private byte[] trimBytesArray(byte[] source, int offset, int length) {
int lengthFromBegin;
for (lengthFromBegin = offset + length; lengthFromBegin > offset; lengthFromBegin--) {
if (source[lengthFromBegin - 1] != ' ' && source[lengthFromBegin - 1] != '\0'
&& source[lengt... | java | private byte[] trimBytesArray(byte[] source, int offset, int length) {
int lengthFromBegin;
for (lengthFromBegin = offset + length; lengthFromBegin > offset; lengthFromBegin--) {
if (source[lengthFromBegin - 1] != ' ' && source[lengthFromBegin - 1] != '\0'
&& source[lengt... | [
"private",
"byte",
"[",
"]",
"trimBytesArray",
"(",
"byte",
"[",
"]",
"source",
",",
"int",
"offset",
",",
"int",
"length",
")",
"{",
"int",
"lengthFromBegin",
";",
"for",
"(",
"lengthFromBegin",
"=",
"offset",
"+",
"length",
";",
"lengthFromBegin",
">",
... | The function to remove excess symbols from the end of a bytes array. Excess symbols are line end characters,
tabulation characters, and spaces, which do not contain useful information.
@param source an array of bytes containing required data.
@param offset the offset in source of required data.
@param length the lengt... | [
"The",
"function",
"to",
"remove",
"excess",
"symbols",
"from",
"the",
"end",
"of",
"a",
"bytes",
"array",
".",
"Excess",
"symbols",
"are",
"line",
"end",
"characters",
"tabulation",
"characters",
"and",
"spaces",
"which",
"do",
"not",
"contain",
"useful",
"... | fb132cf943ba099a35b2f5a1490c0a59641e09dc | https://github.com/epam/parso/blob/fb132cf943ba099a35b2f5a1490c0a59641e09dc/src/main/java/com/epam/parso/impl/SasFileParser.java#L951-L965 | train |
camunda/camunda-bpm-platform-osgi | camunda-bpm-osgi/src/main/java/org/camunda/bpm/extension/osgi/el/OSGiELResolver.java | OSGiELResolver.checkRegisteredServicesByLdapFilter | private Object checkRegisteredServicesByLdapFilter(String filter) throws InvalidSyntaxException {
ServiceReference<?>[] references = getBundleContext().getServiceReferences((String) null, filter);
if (isEmptyOrNull(references)) {
return null;
}
if (references.length == 1) {
return getBundleC... | java | private Object checkRegisteredServicesByLdapFilter(String filter) throws InvalidSyntaxException {
ServiceReference<?>[] references = getBundleContext().getServiceReferences((String) null, filter);
if (isEmptyOrNull(references)) {
return null;
}
if (references.length == 1) {
return getBundleC... | [
"private",
"Object",
"checkRegisteredServicesByLdapFilter",
"(",
"String",
"filter",
")",
"throws",
"InvalidSyntaxException",
"{",
"ServiceReference",
"<",
"?",
">",
"[",
"]",
"references",
"=",
"getBundleContext",
"(",
")",
".",
"getServiceReferences",
"(",
"(",
"S... | Checks the OSGi ServiceRegistry if a service matching the given filter is
present.
@param filter
the LDAP filter
@return null if no service could be found or the service object
@throws InvalidSyntaxException
if the filter has an invalid syntax
@throws RuntimeException
if more than one service is found | [
"Checks",
"the",
"OSGi",
"ServiceRegistry",
"if",
"a",
"service",
"matching",
"the",
"given",
"filter",
"is",
"present",
"."
] | b91c6a68895947b320a7a5edf0db7158e945c4bb | https://github.com/camunda/camunda-bpm-platform-osgi/blob/b91c6a68895947b320a7a5edf0db7158e945c4bb/camunda-bpm-osgi/src/main/java/org/camunda/bpm/extension/osgi/el/OSGiELResolver.java#L75-L84 | train |
camunda/camunda-bpm-platform-osgi | camunda-bpm-osgi/src/main/java/org/camunda/bpm/extension/osgi/internal/impl/ProcessDefinitionDeployerImpl.java | ProcessDefinitionDeployerImpl.getPath | private String getPath(URL url) {
String path = url.toExternalForm();
return path.replaceAll("bundle://[^/]*/", "");
} | java | private String getPath(URL url) {
String path = url.toExternalForm();
return path.replaceAll("bundle://[^/]*/", "");
} | [
"private",
"String",
"getPath",
"(",
"URL",
"url",
")",
"{",
"String",
"path",
"=",
"url",
".",
"toExternalForm",
"(",
")",
";",
"return",
"path",
".",
"replaceAll",
"(",
"\"bundle://[^/]*/\"",
",",
"\"\"",
")",
";",
"}"
] | remove bundle protocol specific part, so that resource can be accessed by
path relative to bundle root | [
"remove",
"bundle",
"protocol",
"specific",
"part",
"so",
"that",
"resource",
"can",
"be",
"accessed",
"by",
"path",
"relative",
"to",
"bundle",
"root"
] | b91c6a68895947b320a7a5edf0db7158e945c4bb | https://github.com/camunda/camunda-bpm-platform-osgi/blob/b91c6a68895947b320a7a5edf0db7158e945c4bb/camunda-bpm-osgi/src/main/java/org/camunda/bpm/extension/osgi/internal/impl/ProcessDefinitionDeployerImpl.java#L73-L76 | train |
camunda/camunda-bpm-platform-osgi | camunda-bpm-osgi/src/main/java/org/camunda/bpm/extension/osgi/util/HeaderParser.java | HeaderParser.parseHeader | public static List<PathElement> parseHeader(String header) {
List<PathElement> elements = new ArrayList<PathElement>();
if (header == null || header.trim().length() == 0) {
return elements;
}
String[] clauses = header.split(",");
for (String clause : clauses) {
... | java | public static List<PathElement> parseHeader(String header) {
List<PathElement> elements = new ArrayList<PathElement>();
if (header == null || header.trim().length() == 0) {
return elements;
}
String[] clauses = header.split(",");
for (String clause : clauses) {
... | [
"public",
"static",
"List",
"<",
"PathElement",
">",
"parseHeader",
"(",
"String",
"header",
")",
"{",
"List",
"<",
"PathElement",
">",
"elements",
"=",
"new",
"ArrayList",
"<",
"PathElement",
">",
"(",
")",
";",
"if",
"(",
"header",
"==",
"null",
"||",
... | Parse a given OSGi header into a list of paths
@param header the OSGi header to parse
@return the list of paths extracted from this header | [
"Parse",
"a",
"given",
"OSGi",
"header",
"into",
"a",
"list",
"of",
"paths"
] | b91c6a68895947b320a7a5edf0db7158e945c4bb | https://github.com/camunda/camunda-bpm-platform-osgi/blob/b91c6a68895947b320a7a5edf0db7158e945c4bb/camunda-bpm-osgi/src/main/java/org/camunda/bpm/extension/osgi/util/HeaderParser.java#L39-L71 | train |
camunda/camunda-bpm-platform-osgi | camunda-bpm-osgi/src/main/java/org/camunda/bpm/extension/osgi/internal/ProcessDefinitionParser.java | ProcessDefinitionParser.addEntries | private static void addEntries(Bundle bundle, String path,
String filePattern, List<URL> pathList) {
Enumeration<?> e = bundle.findEntries(path, filePattern, false);
while (e != null && e.hasMoreElements()) {
URL u = (URL) e.nextElement();
pathList.add(u);
}
} | java | private static void addEntries(Bundle bundle, String path,
String filePattern, List<URL> pathList) {
Enumeration<?> e = bundle.findEntries(path, filePattern, false);
while (e != null && e.hasMoreElements()) {
URL u = (URL) e.nextElement();
pathList.add(u);
}
} | [
"private",
"static",
"void",
"addEntries",
"(",
"Bundle",
"bundle",
",",
"String",
"path",
",",
"String",
"filePattern",
",",
"List",
"<",
"URL",
">",
"pathList",
")",
"{",
"Enumeration",
"<",
"?",
">",
"e",
"=",
"bundle",
".",
"findEntries",
"(",
"path"... | Searches the bundle for files matching the path and filepattern and puts
them into the list.
@param bundle
@param path
@param filePattern
@param pathList | [
"Searches",
"the",
"bundle",
"for",
"files",
"matching",
"the",
"path",
"and",
"filepattern",
"and",
"puts",
"them",
"into",
"the",
"list",
"."
] | b91c6a68895947b320a7a5edf0db7158e945c4bb | https://github.com/camunda/camunda-bpm-platform-osgi/blob/b91c6a68895947b320a7a5edf0db7158e945c4bb/camunda-bpm-osgi/src/main/java/org/camunda/bpm/extension/osgi/internal/ProcessDefinitionParser.java#L104-L111 | train |
camunda/camunda-bpm-platform-osgi | camunda-bpm-osgi-fileinstall/src/main/java/org/camunda/bpm/extension/osgi/fileinstall/impl/BpmnURLHandler.java | BpmnURLHandler.openConnection | @Override
public URLConnection openConnection(URL url) throws IOException {
if (url.getPath() == null || url.getPath().trim().length() == 0) {
throw new MalformedURLException("Path can not be null or empty. Syntax: " + SYNTAX );
}
bpmnXmlURL = new URL(url.getPath());
log... | java | @Override
public URLConnection openConnection(URL url) throws IOException {
if (url.getPath() == null || url.getPath().trim().length() == 0) {
throw new MalformedURLException("Path can not be null or empty. Syntax: " + SYNTAX );
}
bpmnXmlURL = new URL(url.getPath());
log... | [
"@",
"Override",
"public",
"URLConnection",
"openConnection",
"(",
"URL",
"url",
")",
"throws",
"IOException",
"{",
"if",
"(",
"url",
".",
"getPath",
"(",
")",
"==",
"null",
"||",
"url",
".",
"getPath",
"(",
")",
".",
"trim",
"(",
")",
".",
"length",
... | Open the connection for the given URL.
@param url the url from which to open a connection.
@return a connection on the specified URL.
@throws IOException if an error occurs or if the URL is malformed. | [
"Open",
"the",
"connection",
"for",
"the",
"given",
"URL",
"."
] | b91c6a68895947b320a7a5edf0db7158e945c4bb | https://github.com/camunda/camunda-bpm-platform-osgi/blob/b91c6a68895947b320a7a5edf0db7158e945c4bb/camunda-bpm-osgi-fileinstall/src/main/java/org/camunda/bpm/extension/osgi/fileinstall/impl/BpmnURLHandler.java#L47-L56 | train |
camunda/camunda-bpm-platform-osgi | camunda-bpm-osgi-configadmin/src/main/java/org/camunda/bpm/extension/osgi/configadmin/impl/ManagedProcessEngineFactoryImpl.java | ManagedProcessEngineFactoryImpl.hasPropertiesConfiguration | @SuppressWarnings("unchecked")
private boolean hasPropertiesConfiguration(Dictionary properties) {
HashMap<Object, Object> mapProperties = new HashMap<Object, Object>(properties.size());
for (Object key : Collections.list(properties.keys())) {
mapProperties.put(key, properties.get(key));
}
mapPr... | java | @SuppressWarnings("unchecked")
private boolean hasPropertiesConfiguration(Dictionary properties) {
HashMap<Object, Object> mapProperties = new HashMap<Object, Object>(properties.size());
for (Object key : Collections.list(properties.keys())) {
mapProperties.put(key, properties.get(key));
}
mapPr... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"boolean",
"hasPropertiesConfiguration",
"(",
"Dictionary",
"properties",
")",
"{",
"HashMap",
"<",
"Object",
",",
"Object",
">",
"mapProperties",
"=",
"new",
"HashMap",
"<",
"Object",
",",
"Object",
... | It happends that the factory get called with properties that only contain
service.pid and service.factoryPid. If that happens we don't want to create
an engine.
@param properties
@return | [
"It",
"happends",
"that",
"the",
"factory",
"get",
"called",
"with",
"properties",
"that",
"only",
"contain",
"service",
".",
"pid",
"and",
"service",
".",
"factoryPid",
".",
"If",
"that",
"happens",
"we",
"don",
"t",
"want",
"to",
"create",
"an",
"engine"... | b91c6a68895947b320a7a5edf0db7158e945c4bb | https://github.com/camunda/camunda-bpm-platform-osgi/blob/b91c6a68895947b320a7a5edf0db7158e945c4bb/camunda-bpm-osgi-configadmin/src/main/java/org/camunda/bpm/extension/osgi/configadmin/impl/ManagedProcessEngineFactoryImpl.java#L81-L90 | train |
GoogleCloudPlatform/appengine-pipelines | java/src/main/java/com/google/appengine/tools/pipeline/impl/servlets/PipelineServlet.java | PipelineServlet.baseUrl | public static String baseUrl() {
String baseURL = System.getProperty(BASE_URL_PROPERTY, "/_ah/pipeline/");
if (!baseURL.endsWith("/")) {
baseURL += "/";
}
return baseURL;
} | java | public static String baseUrl() {
String baseURL = System.getProperty(BASE_URL_PROPERTY, "/_ah/pipeline/");
if (!baseURL.endsWith("/")) {
baseURL += "/";
}
return baseURL;
} | [
"public",
"static",
"String",
"baseUrl",
"(",
")",
"{",
"String",
"baseURL",
"=",
"System",
".",
"getProperty",
"(",
"BASE_URL_PROPERTY",
",",
"\"/_ah/pipeline/\"",
")",
";",
"if",
"(",
"!",
"baseURL",
".",
"endsWith",
"(",
"\"/\"",
")",
")",
"{",
"baseURL... | Returns the Pipeline's BASE URL.
This must match the URL in web.xml | [
"Returns",
"the",
"Pipeline",
"s",
"BASE",
"URL",
".",
"This",
"must",
"match",
"the",
"URL",
"in",
"web",
".",
"xml"
] | 277394648dac3e8214677af898935d07399ac8e1 | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/java/src/main/java/com/google/appengine/tools/pipeline/impl/servlets/PipelineServlet.java#L45-L51 | train |
GoogleCloudPlatform/appengine-pipelines | java/src/main/java/com/google/appengine/tools/pipeline/impl/util/JsonUtils.java | JsonUtils.toJson | private static String toJson(Object x) {
try {
if (x == null || x instanceof String || x instanceof Number || x instanceof Character
|| x.getClass().isArray() || x instanceof Iterable<?>) {
return new JSONObject().put("JSON", x).toString(2);
} else if (x instanceof Map<?, ?>) {
... | java | private static String toJson(Object x) {
try {
if (x == null || x instanceof String || x instanceof Number || x instanceof Character
|| x.getClass().isArray() || x instanceof Iterable<?>) {
return new JSONObject().put("JSON", x).toString(2);
} else if (x instanceof Map<?, ?>) {
... | [
"private",
"static",
"String",
"toJson",
"(",
"Object",
"x",
")",
"{",
"try",
"{",
"if",
"(",
"x",
"==",
"null",
"||",
"x",
"instanceof",
"String",
"||",
"x",
"instanceof",
"Number",
"||",
"x",
"instanceof",
"Character",
"||",
"x",
".",
"getClass",
"("... | Convert an object into its JSON representation. | [
"Convert",
"an",
"object",
"into",
"its",
"JSON",
"representation",
"."
] | 277394648dac3e8214677af898935d07399ac8e1 | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/java/src/main/java/com/google/appengine/tools/pipeline/impl/util/JsonUtils.java#L47-L62 | train |
GoogleCloudPlatform/appengine-pipelines | java/src/main/java/com/google/appengine/tools/pipeline/impl/util/JsonUtils.java | JsonUtils.fromJson | public static Object fromJson(String json) {
try {
JSONObject jsonObject = new JSONObject(json);
if (jsonObject.has("JSON")) {
return convert(jsonObject.get("JSON"));
} else {
return convert(jsonObject);
}
} catch (Exception e) {
throw new RuntimeException("json=" +... | java | public static Object fromJson(String json) {
try {
JSONObject jsonObject = new JSONObject(json);
if (jsonObject.has("JSON")) {
return convert(jsonObject.get("JSON"));
} else {
return convert(jsonObject);
}
} catch (Exception e) {
throw new RuntimeException("json=" +... | [
"public",
"static",
"Object",
"fromJson",
"(",
"String",
"json",
")",
"{",
"try",
"{",
"JSONObject",
"jsonObject",
"=",
"new",
"JSONObject",
"(",
"json",
")",
";",
"if",
"(",
"jsonObject",
".",
"has",
"(",
"\"JSON\"",
")",
")",
"{",
"return",
"convert",
... | Convert a JSON representation into an object | [
"Convert",
"a",
"JSON",
"representation",
"into",
"an",
"object"
] | 277394648dac3e8214677af898935d07399ac8e1 | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/java/src/main/java/com/google/appengine/tools/pipeline/impl/util/JsonUtils.java#L67-L78 | train |
GoogleCloudPlatform/appengine-pipelines | java/src/main/java/com/google/appengine/tools/pipeline/impl/backend/AppEngineBackEnd.java | AppEngineBackEnd.deletePipeline | @Override
public void deletePipeline(Key rootJobKey, boolean force, boolean async)
throws IllegalStateException {
if (!force) {
try {
JobRecord rootJobRecord = queryJob(rootJobKey, JobRecord.InflationType.NONE);
switch (rootJobRecord.getState()) {
case FINALIZED:
ca... | java | @Override
public void deletePipeline(Key rootJobKey, boolean force, boolean async)
throws IllegalStateException {
if (!force) {
try {
JobRecord rootJobRecord = queryJob(rootJobKey, JobRecord.InflationType.NONE);
switch (rootJobRecord.getState()) {
case FINALIZED:
ca... | [
"@",
"Override",
"public",
"void",
"deletePipeline",
"(",
"Key",
"rootJobKey",
",",
"boolean",
"force",
",",
"boolean",
"async",
")",
"throws",
"IllegalStateException",
"{",
"if",
"(",
"!",
"force",
")",
"{",
"try",
"{",
"JobRecord",
"rootJobRecord",
"=",
"q... | Delete all datastore entities corresponding to the given pipeline.
@param rootJobKey The root job key identifying the pipeline
@param force If this parameter is not {@code true} then this method will
throw an {@link IllegalStateException} if the specified pipeline is not in the
{@link com.google.appengine.tools.pipeli... | [
"Delete",
"all",
"datastore",
"entities",
"corresponding",
"to",
"the",
"given",
"pipeline",
"."
] | 277394648dac3e8214677af898935d07399ac8e1 | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/java/src/main/java/com/google/appengine/tools/pipeline/impl/backend/AppEngineBackEnd.java#L603-L633 | train |
GoogleCloudPlatform/appengine-pipelines | java/src/main/java/com/google/appengine/tools/pipeline/impl/PipelineManager.java | PipelineManager.queryFullPipeline | public static PipelineObjects queryFullPipeline(String rootJobHandle) {
Key rootJobKey = KeyFactory.createKey(JobRecord.DATA_STORE_KIND, rootJobHandle);
return backEnd.queryFullPipeline(rootJobKey);
} | java | public static PipelineObjects queryFullPipeline(String rootJobHandle) {
Key rootJobKey = KeyFactory.createKey(JobRecord.DATA_STORE_KIND, rootJobHandle);
return backEnd.queryFullPipeline(rootJobKey);
} | [
"public",
"static",
"PipelineObjects",
"queryFullPipeline",
"(",
"String",
"rootJobHandle",
")",
"{",
"Key",
"rootJobKey",
"=",
"KeyFactory",
".",
"createKey",
"(",
"JobRecord",
".",
"DATA_STORE_KIND",
",",
"rootJobHandle",
")",
";",
"return",
"backEnd",
".",
"que... | Returns all the associated PipelineModelObject for a root pipeline.
@throws IllegalArgumentException if root pipeline was not found. | [
"Returns",
"all",
"the",
"associated",
"PipelineModelObject",
"for",
"a",
"root",
"pipeline",
"."
] | 277394648dac3e8214677af898935d07399ac8e1 | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/java/src/main/java/com/google/appengine/tools/pipeline/impl/PipelineManager.java#L321-L324 | train |
GoogleCloudPlatform/appengine-pipelines | java/src/main/java/com/google/appengine/tools/pipeline/impl/PipelineManager.java | PipelineManager.getJob | public static JobRecord getJob(String jobHandle) throws NoSuchObjectException {
checkNonEmpty(jobHandle, "jobHandle");
Key key = KeyFactory.createKey(JobRecord.DATA_STORE_KIND, jobHandle);
logger.finest("getJob: " + key.getName());
return backEnd.queryJob(key, JobRecord.InflationType.FOR_OUTPUT);
} | java | public static JobRecord getJob(String jobHandle) throws NoSuchObjectException {
checkNonEmpty(jobHandle, "jobHandle");
Key key = KeyFactory.createKey(JobRecord.DATA_STORE_KIND, jobHandle);
logger.finest("getJob: " + key.getName());
return backEnd.queryJob(key, JobRecord.InflationType.FOR_OUTPUT);
} | [
"public",
"static",
"JobRecord",
"getJob",
"(",
"String",
"jobHandle",
")",
"throws",
"NoSuchObjectException",
"{",
"checkNonEmpty",
"(",
"jobHandle",
",",
"\"jobHandle\"",
")",
";",
"Key",
"key",
"=",
"KeyFactory",
".",
"createKey",
"(",
"JobRecord",
".",
"DATA... | Retrieves a JobRecord for the specified job handle. The returned instance
will be only partially inflated. The run and finalize barriers will not be
available but the output slot will be.
@param jobHandle The handle of a job.
@return The corresponding JobRecord
@throws NoSuchObjectException If a JobRecord with the giv... | [
"Retrieves",
"a",
"JobRecord",
"for",
"the",
"specified",
"job",
"handle",
".",
"The",
"returned",
"instance",
"will",
"be",
"only",
"partially",
"inflated",
".",
"The",
"run",
"and",
"finalize",
"barriers",
"will",
"not",
"be",
"available",
"but",
"the",
"o... | 277394648dac3e8214677af898935d07399ac8e1 | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/java/src/main/java/com/google/appengine/tools/pipeline/impl/PipelineManager.java#L351-L356 | train |
GoogleCloudPlatform/appengine-pipelines | java/src/main/java/com/google/appengine/tools/pipeline/impl/PipelineManager.java | PipelineManager.stopJob | public static void stopJob(String jobHandle) throws NoSuchObjectException {
checkNonEmpty(jobHandle, "jobHandle");
Key key = KeyFactory.createKey(JobRecord.DATA_STORE_KIND, jobHandle);
JobRecord jobRecord = backEnd.queryJob(key, JobRecord.InflationType.NONE);
jobRecord.setState(State.STOPPED);
Updat... | java | public static void stopJob(String jobHandle) throws NoSuchObjectException {
checkNonEmpty(jobHandle, "jobHandle");
Key key = KeyFactory.createKey(JobRecord.DATA_STORE_KIND, jobHandle);
JobRecord jobRecord = backEnd.queryJob(key, JobRecord.InflationType.NONE);
jobRecord.setState(State.STOPPED);
Updat... | [
"public",
"static",
"void",
"stopJob",
"(",
"String",
"jobHandle",
")",
"throws",
"NoSuchObjectException",
"{",
"checkNonEmpty",
"(",
"jobHandle",
",",
"\"jobHandle\"",
")",
";",
"Key",
"key",
"=",
"KeyFactory",
".",
"createKey",
"(",
"JobRecord",
".",
"DATA_STO... | Changes the state of the specified job to STOPPED.
@param jobHandle The handle of a job
@throws NoSuchObjectException If a JobRecord with the given handle cannot
be found in the data store. | [
"Changes",
"the",
"state",
"of",
"the",
"specified",
"job",
"to",
"STOPPED",
"."
] | 277394648dac3e8214677af898935d07399ac8e1 | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/java/src/main/java/com/google/appengine/tools/pipeline/impl/PipelineManager.java#L365-L373 | train |
GoogleCloudPlatform/appengine-pipelines | java/src/main/java/com/google/appengine/tools/pipeline/impl/PipelineManager.java | PipelineManager.cancelJob | public static void cancelJob(String jobHandle) throws NoSuchObjectException {
checkNonEmpty(jobHandle, "jobHandle");
Key key = KeyFactory.createKey(JobRecord.DATA_STORE_KIND, jobHandle);
JobRecord jobRecord = backEnd.queryJob(key, InflationType.NONE);
CancelJobTask cancelJobTask = new CancelJobTask(key,... | java | public static void cancelJob(String jobHandle) throws NoSuchObjectException {
checkNonEmpty(jobHandle, "jobHandle");
Key key = KeyFactory.createKey(JobRecord.DATA_STORE_KIND, jobHandle);
JobRecord jobRecord = backEnd.queryJob(key, InflationType.NONE);
CancelJobTask cancelJobTask = new CancelJobTask(key,... | [
"public",
"static",
"void",
"cancelJob",
"(",
"String",
"jobHandle",
")",
"throws",
"NoSuchObjectException",
"{",
"checkNonEmpty",
"(",
"jobHandle",
",",
"\"jobHandle\"",
")",
";",
"Key",
"key",
"=",
"KeyFactory",
".",
"createKey",
"(",
"JobRecord",
".",
"DATA_S... | Sends cancellation request to the root job.
@param jobHandle The handle of a job
@throws NoSuchObjectException If a JobRecord with the given handle cannot
be found in the data store. | [
"Sends",
"cancellation",
"request",
"to",
"the",
"root",
"job",
"."
] | 277394648dac3e8214677af898935d07399ac8e1 | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/java/src/main/java/com/google/appengine/tools/pipeline/impl/PipelineManager.java#L382-L392 | train |
GoogleCloudPlatform/appengine-pipelines | java/src/main/java/com/google/appengine/tools/pipeline/impl/PipelineManager.java | PipelineManager.deletePipelineRecords | public static void deletePipelineRecords(String pipelineHandle, boolean force, boolean async)
throws NoSuchObjectException, IllegalStateException {
checkNonEmpty(pipelineHandle, "pipelineHandle");
Key key = KeyFactory.createKey(JobRecord.DATA_STORE_KIND, pipelineHandle);
backEnd.deletePipeline(key, fo... | java | public static void deletePipelineRecords(String pipelineHandle, boolean force, boolean async)
throws NoSuchObjectException, IllegalStateException {
checkNonEmpty(pipelineHandle, "pipelineHandle");
Key key = KeyFactory.createKey(JobRecord.DATA_STORE_KIND, pipelineHandle);
backEnd.deletePipeline(key, fo... | [
"public",
"static",
"void",
"deletePipelineRecords",
"(",
"String",
"pipelineHandle",
",",
"boolean",
"force",
",",
"boolean",
"async",
")",
"throws",
"NoSuchObjectException",
",",
"IllegalStateException",
"{",
"checkNonEmpty",
"(",
"pipelineHandle",
",",
"\"pipelineHan... | Delete all data store entities corresponding to the given pipeline.
@param pipelineHandle The handle of the pipeline to be deleted
@param force If this parameter is not {@code true} then this method will
throw an {@link IllegalStateException} if the specified pipeline is
not in the {@link State#FINALIZED} or {@link St... | [
"Delete",
"all",
"data",
"store",
"entities",
"corresponding",
"to",
"the",
"given",
"pipeline",
"."
] | 277394648dac3e8214677af898935d07399ac8e1 | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/java/src/main/java/com/google/appengine/tools/pipeline/impl/PipelineManager.java#L409-L414 | train |
GoogleCloudPlatform/appengine-pipelines | java/src/main/java/com/google/appengine/tools/pipeline/impl/PipelineManager.java | PipelineManager.processTask | public static void processTask(Task task) {
logger.finest("Processing task " + task);
try {
switch (task.getType()) {
case RUN_JOB:
runJob((RunJobTask) task);
break;
case HANDLE_SLOT_FILLED:
handleSlotFilled((HandleSlotFilledTask) task);
break;
... | java | public static void processTask(Task task) {
logger.finest("Processing task " + task);
try {
switch (task.getType()) {
case RUN_JOB:
runJob((RunJobTask) task);
break;
case HANDLE_SLOT_FILLED:
handleSlotFilled((HandleSlotFilledTask) task);
break;
... | [
"public",
"static",
"void",
"processTask",
"(",
"Task",
"task",
")",
"{",
"logger",
".",
"finest",
"(",
"\"Processing task \"",
"+",
"task",
")",
";",
"try",
"{",
"switch",
"(",
"task",
".",
"getType",
"(",
")",
")",
"{",
"case",
"RUN_JOB",
":",
"runJo... | Process an incoming task received from the App Engine task queue.
@param task The task to be processed. | [
"Process",
"an",
"incoming",
"task",
"received",
"from",
"the",
"App",
"Engine",
"task",
"queue",
"."
] | 277394648dac3e8214677af898935d07399ac8e1 | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/java/src/main/java/com/google/appengine/tools/pipeline/impl/PipelineManager.java#L518-L558 | train |
GoogleCloudPlatform/appengine-pipelines | java/src/main/java/com/google/appengine/tools/pipeline/impl/PipelineManager.java | PipelineManager.handleDelayedSlotFill | private static void handleDelayedSlotFill(DelayedSlotFillTask task) {
Key slotKey = task.getSlotKey();
Slot slot = querySlotOrAbandonTask(slotKey, true);
Key rootJobKey = task.getRootJobKey();
UpdateSpec updateSpec = new UpdateSpec(rootJobKey);
slot.fill(null);
updateSpec.getNonTransactionalGrou... | java | private static void handleDelayedSlotFill(DelayedSlotFillTask task) {
Key slotKey = task.getSlotKey();
Slot slot = querySlotOrAbandonTask(slotKey, true);
Key rootJobKey = task.getRootJobKey();
UpdateSpec updateSpec = new UpdateSpec(rootJobKey);
slot.fill(null);
updateSpec.getNonTransactionalGrou... | [
"private",
"static",
"void",
"handleDelayedSlotFill",
"(",
"DelayedSlotFillTask",
"task",
")",
"{",
"Key",
"slotKey",
"=",
"task",
".",
"getSlotKey",
"(",
")",
";",
"Slot",
"slot",
"=",
"querySlotOrAbandonTask",
"(",
"slotKey",
",",
"true",
")",
";",
"Key",
... | Fills the slot with null value and calls handleSlotFilled | [
"Fills",
"the",
"slot",
"with",
"null",
"value",
"and",
"calls",
"handleSlotFilled"
] | 277394648dac3e8214677af898935d07399ac8e1 | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/java/src/main/java/com/google/appengine/tools/pipeline/impl/PipelineManager.java#L1162-L1172 | train |
GoogleCloudPlatform/appengine-pipelines | java/src/main/java/com/google/appengine/tools/pipeline/impl/model/Barrier.java | Barrier.addListArgumentSlots | public void addListArgumentSlots(Slot initialSlot, List<Slot> slotList) {
if (!initialSlot.isFilled()) {
throw new IllegalArgumentException("initialSlot must be filled");
}
verifyStateBeforAdd(initialSlot);
int groupSize = slotList.size() + 1;
addSlotDescriptor(new SlotDescriptor(initialSlot, ... | java | public void addListArgumentSlots(Slot initialSlot, List<Slot> slotList) {
if (!initialSlot.isFilled()) {
throw new IllegalArgumentException("initialSlot must be filled");
}
verifyStateBeforAdd(initialSlot);
int groupSize = slotList.size() + 1;
addSlotDescriptor(new SlotDescriptor(initialSlot, ... | [
"public",
"void",
"addListArgumentSlots",
"(",
"Slot",
"initialSlot",
",",
"List",
"<",
"Slot",
">",
"slotList",
")",
"{",
"if",
"(",
"!",
"initialSlot",
".",
"isFilled",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"initialSlot must ... | Adds multiple slots to this barrier's waiting-on list representing a single
Job argument of type list.
@param slotList A list of slots that will be added to the barrier and used
as the elements of the list Job argument.
@throws IllegalArgumentException if intialSlot is not filled. | [
"Adds",
"multiple",
"slots",
"to",
"this",
"barrier",
"s",
"waiting",
"-",
"on",
"list",
"representing",
"a",
"single",
"Job",
"argument",
"of",
"type",
"list",
"."
] | 277394648dac3e8214677af898935d07399ac8e1 | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/java/src/main/java/com/google/appengine/tools/pipeline/impl/model/Barrier.java#L269-L279 | train |
GoogleCloudPlatform/appengine-pipelines | java/src/main/java/com/google/appengine/tools/pipeline/impl/model/JobRecord.java | JobRecord.toEntity | @Override
public Entity toEntity() {
Entity entity = toProtoEntity();
entity.setProperty(JOB_INSTANCE_PROPERTY, jobInstanceKey);
entity.setProperty(FINALIZE_BARRIER_PROPERTY, finalizeBarrierKey);
entity.setProperty(RUN_BARRIER_PROPERTY, runBarrierKey);
entity.setProperty(OUTPUT_SLOT_PROPERTY, outp... | java | @Override
public Entity toEntity() {
Entity entity = toProtoEntity();
entity.setProperty(JOB_INSTANCE_PROPERTY, jobInstanceKey);
entity.setProperty(FINALIZE_BARRIER_PROPERTY, finalizeBarrierKey);
entity.setProperty(RUN_BARRIER_PROPERTY, runBarrierKey);
entity.setProperty(OUTPUT_SLOT_PROPERTY, outp... | [
"@",
"Override",
"public",
"Entity",
"toEntity",
"(",
")",
"{",
"Entity",
"entity",
"=",
"toProtoEntity",
"(",
")",
";",
"entity",
".",
"setProperty",
"(",
"JOB_INSTANCE_PROPERTY",
",",
"jobInstanceKey",
")",
";",
"entity",
".",
"setProperty",
"(",
"FINALIZE_B... | Constructs and returns a Data Store Entity that represents this model
object | [
"Constructs",
"and",
"returns",
"a",
"Data",
"Store",
"Entity",
"that",
"represents",
"this",
"model",
"object"
] | 277394648dac3e8214677af898935d07399ac8e1 | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/java/src/main/java/com/google/appengine/tools/pipeline/impl/model/JobRecord.java#L237-L282 | train |
GoogleCloudPlatform/appengine-pipelines | java/src/main/java/com/google/appengine/tools/pipeline/impl/model/JobRecord.java | JobRecord.createRootJobRecord | public static JobRecord createRootJobRecord(Job<?> jobInstance, JobSetting[] settings) {
Key key = generateKey(null, DATA_STORE_KIND);
return new JobRecord(key, jobInstance, settings);
} | java | public static JobRecord createRootJobRecord(Job<?> jobInstance, JobSetting[] settings) {
Key key = generateKey(null, DATA_STORE_KIND);
return new JobRecord(key, jobInstance, settings);
} | [
"public",
"static",
"JobRecord",
"createRootJobRecord",
"(",
"Job",
"<",
"?",
">",
"jobInstance",
",",
"JobSetting",
"[",
"]",
"settings",
")",
"{",
"Key",
"key",
"=",
"generateKey",
"(",
"null",
",",
"DATA_STORE_KIND",
")",
";",
"return",
"new",
"JobRecord"... | A factory method for root jobs.
@param jobInstance The non-null user-supplied instance of {@code Job} that
implements the Job that the newly created JobRecord represents.
@param settings Array of {@code JobSetting} to apply to the newly created
JobRecord. | [
"A",
"factory",
"method",
"for",
"root",
"jobs",
"."
] | 277394648dac3e8214677af898935d07399ac8e1 | https://github.com/GoogleCloudPlatform/appengine-pipelines/blob/277394648dac3e8214677af898935d07399ac8e1/java/src/main/java/com/google/appengine/tools/pipeline/impl/model/JobRecord.java#L403-L406 | train |
craigwblake/redline | src/main/java/org/redline_rpm/Main.java | Main.run | public void run( File file) throws SAXException, NoSuchAlgorithmException, IOException {
XmlEditor editor = new XmlEditor();
editor.read( file);
run( editor, new File( "."));
} | java | public void run( File file) throws SAXException, NoSuchAlgorithmException, IOException {
XmlEditor editor = new XmlEditor();
editor.read( file);
run( editor, new File( "."));
} | [
"public",
"void",
"run",
"(",
"File",
"file",
")",
"throws",
"SAXException",
",",
"NoSuchAlgorithmException",
",",
"IOException",
"{",
"XmlEditor",
"editor",
"=",
"new",
"XmlEditor",
"(",
")",
";",
"editor",
".",
"read",
"(",
"file",
")",
";",
"run",
"(",
... | Runs the tool using a configuration provided in the given file parameter. The configuration file
is expected to be well formed XML conforming to the Redline configuration syntax.
@param file the configuration file to use
@throws SAXException if the provided file is not well formed XML
@throws NoSuchAlgorithmException ... | [
"Runs",
"the",
"tool",
"using",
"a",
"configuration",
"provided",
"in",
"the",
"given",
"file",
"parameter",
".",
"The",
"configuration",
"file",
"is",
"expected",
"to",
"be",
"well",
"formed",
"XML",
"conforming",
"to",
"the",
"Redline",
"configuration",
"syn... | b2fee5eb6c8150e801a132a4478a643f9ec0df04 | https://github.com/craigwblake/redline/blob/b2fee5eb6c8150e801a132a4478a643f9ec0df04/src/main/java/org/redline_rpm/Main.java#L43-L47 | train |
craigwblake/redline | src/main/java/org/redline_rpm/Main.java | Main.run | public void run( XmlEditor editor, File destination) throws NoSuchAlgorithmException, IOException {
editor.startPrefixMapping( "http://redline-rpm.org/ns", "rpm");
Contents include = new Contents();
for ( Node files : editor.findNodes( "rpm:files")) {
try {
editor.pushContext( files);
int permission =... | java | public void run( XmlEditor editor, File destination) throws NoSuchAlgorithmException, IOException {
editor.startPrefixMapping( "http://redline-rpm.org/ns", "rpm");
Contents include = new Contents();
for ( Node files : editor.findNodes( "rpm:files")) {
try {
editor.pushContext( files);
int permission =... | [
"public",
"void",
"run",
"(",
"XmlEditor",
"editor",
",",
"File",
"destination",
")",
"throws",
"NoSuchAlgorithmException",
",",
"IOException",
"{",
"editor",
".",
"startPrefixMapping",
"(",
"\"http://redline-rpm.org/ns\"",
",",
"\"rpm\"",
")",
";",
"Contents",
"inc... | Runs the tool using a configuration provided in the given configuration and output file.
@param editor the XML configuration file, parsed by the XmlEditor utility
@param destination the destination file to use in creating the RPM
@throws NoSuchAlgorithmException if an operation attempted during RPM creation fails due
... | [
"Runs",
"the",
"tool",
"using",
"a",
"configuration",
"provided",
"in",
"the",
"given",
"configuration",
"and",
"output",
"file",
"."
] | b2fee5eb6c8150e801a132a4478a643f9ec0df04 | https://github.com/craigwblake/redline/blob/b2fee5eb6c8150e801a132a4478a643f9ec0df04/src/main/java/org/redline_rpm/Main.java#L59-L84 | train |
craigwblake/redline | src/main/java/org/redline_rpm/Main.java | Main.run | public void run( XmlEditor editor, String name, String version, String release, Contents include, File destination) throws NoSuchAlgorithmException, IOException {
Builder builder = new Builder();
builder.setPackage( name, version, release);
RpmType type = RpmType.valueOf( editor.getValue( "rpm:type", BINARY.to... | java | public void run( XmlEditor editor, String name, String version, String release, Contents include, File destination) throws NoSuchAlgorithmException, IOException {
Builder builder = new Builder();
builder.setPackage( name, version, release);
RpmType type = RpmType.valueOf( editor.getValue( "rpm:type", BINARY.to... | [
"public",
"void",
"run",
"(",
"XmlEditor",
"editor",
",",
"String",
"name",
",",
"String",
"version",
",",
"String",
"release",
",",
"Contents",
"include",
",",
"File",
"destination",
")",
"throws",
"NoSuchAlgorithmException",
",",
"IOException",
"{",
"Builder",... | Runs the tool using the provided settings.
@param editor the XML configuration file, parsed by the XmlEditor utility
@param name the name of the RPM file to create
@param version the version of the created RPM
@param release the release version of the created RPM
@param include the contents to include in the generated... | [
"Runs",
"the",
"tool",
"using",
"the",
"provided",
"settings",
"."
] | b2fee5eb6c8150e801a132a4478a643f9ec0df04 | https://github.com/craigwblake/redline/blob/b2fee5eb6c8150e801a132a4478a643f9ec0df04/src/main/java/org/redline_rpm/Main.java#L100-L122 | train |
craigwblake/redline | src/main/java/org/redline_rpm/header/AbstractHeader.java | AbstractEntry.index | public void index( final ByteBuffer index, final int position) {
index.putInt( tag).putInt( getType()).putInt( position).putInt( count);
} | java | public void index( final ByteBuffer index, final int position) {
index.putInt( tag).putInt( getType()).putInt( position).putInt( count);
} | [
"public",
"void",
"index",
"(",
"final",
"ByteBuffer",
"index",
",",
"final",
"int",
"position",
")",
"{",
"index",
".",
"putInt",
"(",
"tag",
")",
".",
"putInt",
"(",
"getType",
"(",
")",
")",
".",
"putInt",
"(",
"position",
")",
".",
"putInt",
"(",... | Writes the index entry into the provided buffer at the current position. | [
"Writes",
"the",
"index",
"entry",
"into",
"the",
"provided",
"buffer",
"at",
"the",
"current",
"position",
"."
] | b2fee5eb6c8150e801a132a4478a643f9ec0df04 | https://github.com/craigwblake/redline/blob/b2fee5eb6c8150e801a132a4478a643f9ec0df04/src/main/java/org/redline_rpm/header/AbstractHeader.java#L476-L478 | train |
craigwblake/redline | src/main/java/org/redline_rpm/DumpPayload.java | DumpPayload.main | public static void main( String[] args) throws Exception {
ReadableByteChannel in = Channels.newChannel( System.in);
new Scanner().run( new ReadableChannelWrapper( in));
FileOutputStream fout = new FileOutputStream( args[ 0]);
FileChannel out = fout.getChannel();
long position = 0;
long read;
while (( ... | java | public static void main( String[] args) throws Exception {
ReadableByteChannel in = Channels.newChannel( System.in);
new Scanner().run( new ReadableChannelWrapper( in));
FileOutputStream fout = new FileOutputStream( args[ 0]);
FileChannel out = fout.getChannel();
long position = 0;
long read;
while (( ... | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"throws",
"Exception",
"{",
"ReadableByteChannel",
"in",
"=",
"Channels",
".",
"newChannel",
"(",
"System",
".",
"in",
")",
";",
"new",
"Scanner",
"(",
")",
".",
"run",
"(",
"new... | Dumps the contents of the payload for an RPM file to
the provided file. This method accepts an RPM file from
standard input and dumps it's payload out to the file
name provided as the first argument.
@param args command line arguements
@throws Exception an exception occurred | [
"Dumps",
"the",
"contents",
"of",
"the",
"payload",
"for",
"an",
"RPM",
"file",
"to",
"the",
"provided",
"file",
".",
"This",
"method",
"accepts",
"an",
"RPM",
"file",
"from",
"standard",
"input",
"and",
"dumps",
"it",
"s",
"payload",
"out",
"to",
"the",... | b2fee5eb6c8150e801a132a4478a643f9ec0df04 | https://github.com/craigwblake/redline/blob/b2fee5eb6c8150e801a132a4478a643f9ec0df04/src/main/java/org/redline_rpm/DumpPayload.java#L24-L34 | train |
craigwblake/redline | src/main/java/org/redline_rpm/changelog/ChangelogHandler.java | ChangelogHandler.addChangeLog | public void addChangeLog(File changelogFile) throws IOException, ChangelogParseException {
// parse the change log to a list of entries
InputStream changelog = new FileInputStream(changelogFile);
ChangelogParser parser = new ChangelogParser();
List<ChangelogEntry> entries = parser.parse(changelog);
for (... | java | public void addChangeLog(File changelogFile) throws IOException, ChangelogParseException {
// parse the change log to a list of entries
InputStream changelog = new FileInputStream(changelogFile);
ChangelogParser parser = new ChangelogParser();
List<ChangelogEntry> entries = parser.parse(changelog);
for (... | [
"public",
"void",
"addChangeLog",
"(",
"File",
"changelogFile",
")",
"throws",
"IOException",
",",
"ChangelogParseException",
"{",
"// parse the change log to a list of entries\r",
"InputStream",
"changelog",
"=",
"new",
"FileInputStream",
"(",
"changelogFile",
")",
";",
... | Adds the specified Changelog file to the rpm
@param changelogFile the Changelog file to be added
@throws IOException if the specified file cannot be read
@throws ChangelogParseException if the file violates the requirements of a Changelog | [
"Adds",
"the",
"specified",
"Changelog",
"file",
"to",
"the",
"rpm"
] | b2fee5eb6c8150e801a132a4478a643f9ec0df04 | https://github.com/craigwblake/redline/blob/b2fee5eb6c8150e801a132a4478a643f9ec0df04/src/main/java/org/redline_rpm/changelog/ChangelogHandler.java#L31-L39 | train |
craigwblake/redline | src/main/java/org/redline_rpm/ChannelWrapper.java | ChannelWrapper.start | public Key< Integer> start() {
final Key< Integer> object = new Key< Integer>();
consumers.put( object, new Consumer< Integer>() {
int count;
public void consume( final ByteBuffer buffer) { count += buffer.remaining(); }
public Integer finish() { return count; }
});
return object;
} | java | public Key< Integer> start() {
final Key< Integer> object = new Key< Integer>();
consumers.put( object, new Consumer< Integer>() {
int count;
public void consume( final ByteBuffer buffer) { count += buffer.remaining(); }
public Integer finish() { return count; }
});
return object;
} | [
"public",
"Key",
"<",
"Integer",
">",
"start",
"(",
")",
"{",
"final",
"Key",
"<",
"Integer",
">",
"object",
"=",
"new",
"Key",
"<",
"Integer",
">",
"(",
")",
";",
"consumers",
".",
"put",
"(",
"object",
",",
"new",
"Consumer",
"<",
"Integer",
">",... | Initializes a byte counter on this channel.
@return reference to the new key added to the consumers | [
"Initializes",
"a",
"byte",
"counter",
"on",
"this",
"channel",
"."
] | b2fee5eb6c8150e801a132a4478a643f9ec0df04 | https://github.com/craigwblake/redline/blob/b2fee5eb6c8150e801a132a4478a643f9ec0df04/src/main/java/org/redline_rpm/ChannelWrapper.java#L77-L85 | train |
craigwblake/redline | src/main/java/org/redline_rpm/ChannelWrapper.java | ChannelWrapper.start | public Key< byte[]> start( final PrivateKey key) throws NoSuchAlgorithmException, InvalidKeyException {
final Signature signature = Signature.getInstance( key.getAlgorithm());
signature.initSign( key);
final Key< byte[]> object = new Key< byte[]>();
consumers.put( object, new Consumer< byte[]>() {
public voi... | java | public Key< byte[]> start( final PrivateKey key) throws NoSuchAlgorithmException, InvalidKeyException {
final Signature signature = Signature.getInstance( key.getAlgorithm());
signature.initSign( key);
final Key< byte[]> object = new Key< byte[]>();
consumers.put( object, new Consumer< byte[]>() {
public voi... | [
"public",
"Key",
"<",
"byte",
"[",
"]",
">",
"start",
"(",
"final",
"PrivateKey",
"key",
")",
"throws",
"NoSuchAlgorithmException",
",",
"InvalidKeyException",
"{",
"final",
"Signature",
"signature",
"=",
"Signature",
".",
"getInstance",
"(",
"key",
".",
"getA... | Initialize a signature on this channel.
@param key the private key to use in signing this data stream.
@return reference to the new key added to the consumers
@throws NoSuchAlgorithmException if the key algorithm is not supported
@throws InvalidKeyException if the key provided is invalid for signing | [
"Initialize",
"a",
"signature",
"on",
"this",
"channel",
"."
] | b2fee5eb6c8150e801a132a4478a643f9ec0df04 | https://github.com/craigwblake/redline/blob/b2fee5eb6c8150e801a132a4478a643f9ec0df04/src/main/java/org/redline_rpm/ChannelWrapper.java#L95-L116 | train |
craigwblake/redline | src/main/java/org/redline_rpm/ChannelWrapper.java | ChannelWrapper.start | public Key<byte[]> start( final PGPPrivateKey key, int algorithm ) {
BcPGPContentSignerBuilder contentSignerBuilder = new BcPGPContentSignerBuilder( algorithm, SHA1 );
final PGPSignatureGenerator signatureGenerator = new PGPSignatureGenerator( contentSignerBuilder );
try {
signatureG... | java | public Key<byte[]> start( final PGPPrivateKey key, int algorithm ) {
BcPGPContentSignerBuilder contentSignerBuilder = new BcPGPContentSignerBuilder( algorithm, SHA1 );
final PGPSignatureGenerator signatureGenerator = new PGPSignatureGenerator( contentSignerBuilder );
try {
signatureG... | [
"public",
"Key",
"<",
"byte",
"[",
"]",
">",
"start",
"(",
"final",
"PGPPrivateKey",
"key",
",",
"int",
"algorithm",
")",
"{",
"BcPGPContentSignerBuilder",
"contentSignerBuilder",
"=",
"new",
"BcPGPContentSignerBuilder",
"(",
"algorithm",
",",
"SHA1",
")",
";",
... | Initialize a PGP signatue on the channel
@param key the private key to use in signing this data stream.
@param algorithm the algorithm to use. Can be extracted from public key.
@return reference to the new key added to the consumers | [
"Initialize",
"a",
"PGP",
"signatue",
"on",
"the",
"channel"
] | b2fee5eb6c8150e801a132a4478a643f9ec0df04 | https://github.com/craigwblake/redline/blob/b2fee5eb6c8150e801a132a4478a643f9ec0df04/src/main/java/org/redline_rpm/ChannelWrapper.java#L125-L177 | train |
craigwblake/redline | src/main/java/org/redline_rpm/ChannelWrapper.java | ChannelWrapper.start | public Key< byte[]> start( final String algorithm) throws NoSuchAlgorithmException {
final MessageDigest digest = MessageDigest.getInstance( algorithm);
final Key< byte[]> object = new Key< byte[]>();
consumers.put( object, new Consumer< byte[]>() {
public void consume( final ByteBuffer buffer) {
try {
... | java | public Key< byte[]> start( final String algorithm) throws NoSuchAlgorithmException {
final MessageDigest digest = MessageDigest.getInstance( algorithm);
final Key< byte[]> object = new Key< byte[]>();
consumers.put( object, new Consumer< byte[]>() {
public void consume( final ByteBuffer buffer) {
try {
... | [
"public",
"Key",
"<",
"byte",
"[",
"]",
">",
"start",
"(",
"final",
"String",
"algorithm",
")",
"throws",
"NoSuchAlgorithmException",
"{",
"final",
"MessageDigest",
"digest",
"=",
"MessageDigest",
".",
"getInstance",
"(",
"algorithm",
")",
";",
"final",
"Key",... | Initialize a digest on this channel.
@param algorithm the digest algorithm to use in computing the hash
@return reference to the new key added to the consumers
@throws NoSuchAlgorithmException if the given algorithm does not exist | [
"Initialize",
"a",
"digest",
"on",
"this",
"channel",
"."
] | b2fee5eb6c8150e801a132a4478a643f9ec0df04 | https://github.com/craigwblake/redline/blob/b2fee5eb6c8150e801a132a4478a643f9ec0df04/src/main/java/org/redline_rpm/ChannelWrapper.java#L186-L206 | train |
craigwblake/redline | src/main/java/org/redline_rpm/Util.java | Util.fill | public static ByteBuffer fill( ReadableByteChannel in, int size) throws IOException {
return fill( in, ByteBuffer.allocate( size));
} | java | public static ByteBuffer fill( ReadableByteChannel in, int size) throws IOException {
return fill( in, ByteBuffer.allocate( size));
} | [
"public",
"static",
"ByteBuffer",
"fill",
"(",
"ReadableByteChannel",
"in",
",",
"int",
"size",
")",
"throws",
"IOException",
"{",
"return",
"fill",
"(",
"in",
",",
"ByteBuffer",
".",
"allocate",
"(",
"size",
")",
")",
";",
"}"
] | Creates a new buffer and fills it with bytes from the
provided channel. The amount of data to read is specified
in the arguments.
@param in the channel to read from
@param size the number of bytes to read into a new buffer
@return a new buffer containing the bytes read
@throws IOException if an IO error occurs | [
"Creates",
"a",
"new",
"buffer",
"and",
"fills",
"it",
"with",
"bytes",
"from",
"the",
"provided",
"channel",
".",
"The",
"amount",
"of",
"data",
"to",
"read",
"is",
"specified",
"in",
"the",
"arguments",
"."
] | b2fee5eb6c8150e801a132a4478a643f9ec0df04 | https://github.com/craigwblake/redline/blob/b2fee5eb6c8150e801a132a4478a643f9ec0df04/src/main/java/org/redline_rpm/Util.java#L59-L61 | train |
craigwblake/redline | src/main/java/org/redline_rpm/Util.java | Util.fill | public static ByteBuffer fill( ReadableByteChannel in, ByteBuffer buffer) throws IOException {
while ( buffer.hasRemaining()) if ( in.read( buffer) == -1) throw new BufferUnderflowException();
buffer.flip();
return buffer;
} | java | public static ByteBuffer fill( ReadableByteChannel in, ByteBuffer buffer) throws IOException {
while ( buffer.hasRemaining()) if ( in.read( buffer) == -1) throw new BufferUnderflowException();
buffer.flip();
return buffer;
} | [
"public",
"static",
"ByteBuffer",
"fill",
"(",
"ReadableByteChannel",
"in",
",",
"ByteBuffer",
"buffer",
")",
"throws",
"IOException",
"{",
"while",
"(",
"buffer",
".",
"hasRemaining",
"(",
")",
")",
"if",
"(",
"in",
".",
"read",
"(",
"buffer",
")",
"==",
... | Fills the provided buffer it with bytes from the
provided channel. The amount of data to read is
dependant on the available space in the provided
buffer.
@param in the channel to read from
@param buffer the buffer to read into
@return the provided buffer
@throws IOException if an IO error occurs | [
"Fills",
"the",
"provided",
"buffer",
"it",
"with",
"bytes",
"from",
"the",
"provided",
"channel",
".",
"The",
"amount",
"of",
"data",
"to",
"read",
"is",
"dependant",
"on",
"the",
"available",
"space",
"in",
"the",
"provided",
"buffer",
"."
] | b2fee5eb6c8150e801a132a4478a643f9ec0df04 | https://github.com/craigwblake/redline/blob/b2fee5eb6c8150e801a132a4478a643f9ec0df04/src/main/java/org/redline_rpm/Util.java#L74-L78 | train |
craigwblake/redline | src/main/java/org/redline_rpm/Util.java | Util.empty | public static void empty( WritableByteChannel out, ByteBuffer buffer) throws IOException {
while ( buffer.hasRemaining()) out.write( buffer);
} | java | public static void empty( WritableByteChannel out, ByteBuffer buffer) throws IOException {
while ( buffer.hasRemaining()) out.write( buffer);
} | [
"public",
"static",
"void",
"empty",
"(",
"WritableByteChannel",
"out",
",",
"ByteBuffer",
"buffer",
")",
"throws",
"IOException",
"{",
"while",
"(",
"buffer",
".",
"hasRemaining",
"(",
")",
")",
"out",
".",
"write",
"(",
"buffer",
")",
";",
"}"
] | Empties the contents of the given buffer into the
writable channel provided. The buffer will be copied
to the channel in it's entirety.
@param out the channel to write to
@param buffer the buffer to write out to the channel
@throws IOException if an IO error occurs | [
"Empties",
"the",
"contents",
"of",
"the",
"given",
"buffer",
"into",
"the",
"writable",
"channel",
"provided",
".",
"The",
"buffer",
"will",
"be",
"copied",
"to",
"the",
"channel",
"in",
"it",
"s",
"entirety",
"."
] | b2fee5eb6c8150e801a132a4478a643f9ec0df04 | https://github.com/craigwblake/redline/blob/b2fee5eb6c8150e801a132a4478a643f9ec0df04/src/main/java/org/redline_rpm/Util.java#L89-L91 | train |
craigwblake/redline | src/main/java/org/redline_rpm/Util.java | Util.check | public static void check( byte expected, byte actual) throws IOException {
if ( expected != actual) throw new IOException( "check expected " + Integer.toHexString( 0xff & expected) + ", found " + Integer.toHexString( 0xff & actual));
} | java | public static void check( byte expected, byte actual) throws IOException {
if ( expected != actual) throw new IOException( "check expected " + Integer.toHexString( 0xff & expected) + ", found " + Integer.toHexString( 0xff & actual));
} | [
"public",
"static",
"void",
"check",
"(",
"byte",
"expected",
",",
"byte",
"actual",
")",
"throws",
"IOException",
"{",
"if",
"(",
"expected",
"!=",
"actual",
")",
"throw",
"new",
"IOException",
"(",
"\"check expected \"",
"+",
"Integer",
".",
"toHexString",
... | Checks that two bytes are the same, while generating
a formatted error message if they are not. The error
message will indicate the hex value of the bytes if
they do not match.
@param expected the expected value
@param actual the actual value
@throws IOException if the two values do not match | [
"Checks",
"that",
"two",
"bytes",
"are",
"the",
"same",
"while",
"generating",
"a",
"formatted",
"error",
"message",
"if",
"they",
"are",
"not",
".",
"The",
"error",
"message",
"will",
"indicate",
"the",
"hex",
"value",
"of",
"the",
"bytes",
"if",
"they",
... | b2fee5eb6c8150e801a132a4478a643f9ec0df04 | https://github.com/craigwblake/redline/blob/b2fee5eb6c8150e801a132a4478a643f9ec0df04/src/main/java/org/redline_rpm/Util.java#L117-L119 | train |
craigwblake/redline | src/main/java/org/redline_rpm/Util.java | Util.pad | public static void pad( ByteBuffer buffer, int boundary) {
buffer.position( round( buffer.position(), boundary));
} | java | public static void pad( ByteBuffer buffer, int boundary) {
buffer.position( round( buffer.position(), boundary));
} | [
"public",
"static",
"void",
"pad",
"(",
"ByteBuffer",
"buffer",
",",
"int",
"boundary",
")",
"{",
"buffer",
".",
"position",
"(",
"round",
"(",
"buffer",
".",
"position",
"(",
")",
",",
"boundary",
")",
")",
";",
"}"
] | Pads the given buffer up to the indicated boundary.
The RPM file format requires that headers be aligned
with various boundaries, this method pads output
to match the requirements.
@param buffer the buffer to pad zeros into
@param boundary the boundary to which we need to pad | [
"Pads",
"the",
"given",
"buffer",
"up",
"to",
"the",
"indicated",
"boundary",
".",
"The",
"RPM",
"file",
"format",
"requires",
"that",
"headers",
"be",
"aligned",
"with",
"various",
"boundaries",
"this",
"method",
"pads",
"output",
"to",
"match",
"the",
"req... | b2fee5eb6c8150e801a132a4478a643f9ec0df04 | https://github.com/craigwblake/redline/blob/b2fee5eb6c8150e801a132a4478a643f9ec0df04/src/main/java/org/redline_rpm/Util.java#L138-L140 | train |
craigwblake/redline | src/main/java/org/redline_rpm/XmlEditor.java | XmlEditor.readDocument | public static Document readDocument( File file) throws SAXException, IOException {
InputStream in = new FileInputStream( file);
Document result = readDocument( in);
in.close();
return result;
} | java | public static Document readDocument( File file) throws SAXException, IOException {
InputStream in = new FileInputStream( file);
Document result = readDocument( in);
in.close();
return result;
} | [
"public",
"static",
"Document",
"readDocument",
"(",
"File",
"file",
")",
"throws",
"SAXException",
",",
"IOException",
"{",
"InputStream",
"in",
"=",
"new",
"FileInputStream",
"(",
"file",
")",
";",
"Document",
"result",
"=",
"readDocument",
"(",
"in",
")",
... | Static API follows | [
"Static",
"API",
"follows"
] | b2fee5eb6c8150e801a132a4478a643f9ec0df04 | https://github.com/craigwblake/redline/blob/b2fee5eb6c8150e801a132a4478a643f9ec0df04/src/main/java/org/redline_rpm/XmlEditor.java#L327-L332 | train |
craigwblake/redline | src/main/java/org/redline_rpm/Scanner.java | Scanner.main | public static void main( String[] args) throws Exception {
InputStream fios = new FileInputStream ( args[0] );
ReadableChannelWrapper in = new ReadableChannelWrapper( Channels.newChannel( fios));
Scanner scanner = new Scanner(System.out);
Format format = scanner.run(in);
scanner.log( format.toS... | java | public static void main( String[] args) throws Exception {
InputStream fios = new FileInputStream ( args[0] );
ReadableChannelWrapper in = new ReadableChannelWrapper( Channels.newChannel( fios));
Scanner scanner = new Scanner(System.out);
Format format = scanner.run(in);
scanner.log( format.toS... | [
"public",
"static",
"void",
"main",
"(",
"String",
"[",
"]",
"args",
")",
"throws",
"Exception",
"{",
"InputStream",
"fios",
"=",
"new",
"FileInputStream",
"(",
"args",
"[",
"0",
"]",
")",
";",
"ReadableChannelWrapper",
"in",
"=",
"new",
"ReadableChannelWrap... | Scans a file and prints out useful information.
This utility reads from standard input, and parses
the binary contents of the RPM file.
@param args command line arguements
@throws Exception if an error occurs while
reading the RPM file or it's contents | [
"Scans",
"a",
"file",
"and",
"prints",
"out",
"useful",
"information",
".",
"This",
"utility",
"reads",
"from",
"standard",
"input",
"and",
"parses",
"the",
"binary",
"contents",
"of",
"the",
"RPM",
"file",
"."
] | b2fee5eb6c8150e801a132a4478a643f9ec0df04 | https://github.com/craigwblake/redline/blob/b2fee5eb6c8150e801a132a4478a643f9ec0df04/src/main/java/org/redline_rpm/Scanner.java#L54-L74 | train |
craigwblake/redline | src/main/java/org/redline_rpm/Scanner.java | Scanner.run | public Format run( ReadableChannelWrapper in) throws IOException {
Format format = new Format();
Key< Integer> headerStartKey = in.start();
Key< Integer> lead = in.start();
format.getLead().read( in);
log( "Lead ended at '" + in.finish( lead) + "'.");
Key< Integer> signature = in.start();
int c... | java | public Format run( ReadableChannelWrapper in) throws IOException {
Format format = new Format();
Key< Integer> headerStartKey = in.start();
Key< Integer> lead = in.start();
format.getLead().read( in);
log( "Lead ended at '" + in.finish( lead) + "'.");
Key< Integer> signature = in.start();
int c... | [
"public",
"Format",
"run",
"(",
"ReadableChannelWrapper",
"in",
")",
"throws",
"IOException",
"{",
"Format",
"format",
"=",
"new",
"Format",
"(",
")",
";",
"Key",
"<",
"Integer",
">",
"headerStartKey",
"=",
"in",
".",
"start",
"(",
")",
";",
"Key",
"<",
... | Reads the headers of an RPM and returns a description of it
and it's format.
@param in the channel wrapper to read input from
@return information describing the RPM file
@throws IOException if an error occurs reading the file | [
"Reads",
"the",
"headers",
"of",
"an",
"RPM",
"and",
"returns",
"a",
"description",
"of",
"it",
"and",
"it",
"s",
"format",
"."
] | b2fee5eb6c8150e801a132a4478a643f9ec0df04 | https://github.com/craigwblake/redline/blob/b2fee5eb6c8150e801a132a4478a643f9ec0df04/src/main/java/org/redline_rpm/Scanner.java#L84-L109 | train |
craigwblake/redline | src/main/java/org/redline_rpm/payload/CpioHeader.java | CpioHeader.write | public int write( final WritableByteChannel channel, int total) throws IOException {
final ByteBuffer buffer = charset.encode( CharBuffer.wrap( name));
int length = buffer.remaining() + 1;
ByteBuffer descriptor = ByteBuffer.allocate( CPIO_HEADER);
descriptor.put( writeSix( MAGIC));
descriptor.put( writeEight(... | java | public int write( final WritableByteChannel channel, int total) throws IOException {
final ByteBuffer buffer = charset.encode( CharBuffer.wrap( name));
int length = buffer.remaining() + 1;
ByteBuffer descriptor = ByteBuffer.allocate( CPIO_HEADER);
descriptor.put( writeSix( MAGIC));
descriptor.put( writeEight(... | [
"public",
"int",
"write",
"(",
"final",
"WritableByteChannel",
"channel",
",",
"int",
"total",
")",
"throws",
"IOException",
"{",
"final",
"ByteBuffer",
"buffer",
"=",
"charset",
".",
"encode",
"(",
"CharBuffer",
".",
"wrap",
"(",
"name",
")",
")",
";",
"i... | Write the content for the CPIO header, including the name immediately following. The name data is rounded
to the nearest 2 byte boundary as CPIO requires by appending a null when needed.
@param channel which channel to write on
@param total current size of header?
@return total written and skipped
@throws IOException t... | [
"Write",
"the",
"content",
"for",
"the",
"CPIO",
"header",
"including",
"the",
"name",
"immediately",
"following",
".",
"The",
"name",
"data",
"is",
"rounded",
"to",
"the",
"nearest",
"2",
"byte",
"boundary",
"as",
"CPIO",
"requires",
"by",
"appending",
"a",... | b2fee5eb6c8150e801a132a4478a643f9ec0df04 | https://github.com/craigwblake/redline/blob/b2fee5eb6c8150e801a132a4478a643f9ec0df04/src/main/java/org/redline_rpm/payload/CpioHeader.java#L232-L257 | train |
craigwblake/redline | src/main/java/org/redline_rpm/Builder.java | Builder.addDependencyLess | public void addDependencyLess( final CharSequence name, final CharSequence version) {
int flag = LESS | EQUAL;
if (name.toString().startsWith("rpmlib(")){
flag = flag | RPMLIB;
}
addDependency( name, version, flag);
} | java | public void addDependencyLess( final CharSequence name, final CharSequence version) {
int flag = LESS | EQUAL;
if (name.toString().startsWith("rpmlib(")){
flag = flag | RPMLIB;
}
addDependency( name, version, flag);
} | [
"public",
"void",
"addDependencyLess",
"(",
"final",
"CharSequence",
"name",
",",
"final",
"CharSequence",
"version",
")",
"{",
"int",
"flag",
"=",
"LESS",
"|",
"EQUAL",
";",
"if",
"(",
"name",
".",
"toString",
"(",
")",
".",
"startsWith",
"(",
"\"rpmlib(\... | Adds a dependency to the RPM package. This dependency version will be marked as the maximum
allowed, and the package will require the named dependency with this version or lower at
install time.
@param name the name of the dependency.
@param version the version identifier. | [
"Adds",
"a",
"dependency",
"to",
"the",
"RPM",
"package",
".",
"This",
"dependency",
"version",
"will",
"be",
"marked",
"as",
"the",
"maximum",
"allowed",
"and",
"the",
"package",
"will",
"require",
"the",
"named",
"dependency",
"with",
"this",
"version",
"o... | b2fee5eb6c8150e801a132a4478a643f9ec0df04 | https://github.com/craigwblake/redline/blob/b2fee5eb6c8150e801a132a4478a643f9ec0df04/src/main/java/org/redline_rpm/Builder.java#L181-L187 | train |
craigwblake/redline | src/main/java/org/redline_rpm/Builder.java | Builder.addDependencyMore | public void addDependencyMore( final CharSequence name, final CharSequence version) {
addDependency( name, version, GREATER | EQUAL);
} | java | public void addDependencyMore( final CharSequence name, final CharSequence version) {
addDependency( name, version, GREATER | EQUAL);
} | [
"public",
"void",
"addDependencyMore",
"(",
"final",
"CharSequence",
"name",
",",
"final",
"CharSequence",
"version",
")",
"{",
"addDependency",
"(",
"name",
",",
"version",
",",
"GREATER",
"|",
"EQUAL",
")",
";",
"}"
] | Adds a dependency to the RPM package. This dependency version will be marked as the minimum
allowed, and the package will require the named dependency with this version or higher at
install time.
@param name the name of the dependency.
@param version the version identifier. | [
"Adds",
"a",
"dependency",
"to",
"the",
"RPM",
"package",
".",
"This",
"dependency",
"version",
"will",
"be",
"marked",
"as",
"the",
"minimum",
"allowed",
"and",
"the",
"package",
"will",
"require",
"the",
"named",
"dependency",
"with",
"this",
"version",
"o... | b2fee5eb6c8150e801a132a4478a643f9ec0df04 | https://github.com/craigwblake/redline/blob/b2fee5eb6c8150e801a132a4478a643f9ec0df04/src/main/java/org/redline_rpm/Builder.java#L197-L199 | train |
craigwblake/redline | src/main/java/org/redline_rpm/Builder.java | Builder.addHeaderEntry | public void addHeaderEntry( final Tag tag, final String value) {
format.getHeader().createEntry(tag, value);
} | java | public void addHeaderEntry( final Tag tag, final String value) {
format.getHeader().createEntry(tag, value);
} | [
"public",
"void",
"addHeaderEntry",
"(",
"final",
"Tag",
"tag",
",",
"final",
"String",
"value",
")",
"{",
"format",
".",
"getHeader",
"(",
")",
".",
"createEntry",
"(",
"tag",
",",
"value",
")",
";",
"}"
] | Adds a header entry value to the header. For example use this to set the source RPM package
name on your RPM
@param tag the header tag to set
@param value the value to set the header entry with | [
"Adds",
"a",
"header",
"entry",
"value",
"to",
"the",
"header",
".",
"For",
"example",
"use",
"this",
"to",
"set",
"the",
"source",
"RPM",
"package",
"name",
"on",
"your",
"RPM"
] | b2fee5eb6c8150e801a132a4478a643f9ec0df04 | https://github.com/craigwblake/redline/blob/b2fee5eb6c8150e801a132a4478a643f9ec0df04/src/main/java/org/redline_rpm/Builder.java#L220-L222 | train |
craigwblake/redline | src/main/java/org/redline_rpm/Builder.java | Builder.setSourceRpm | public void setSourceRpm( final String rpm) {
if ( rpm != null) format.getHeader().createEntry( SOURCERPM, rpm);
} | java | public void setSourceRpm( final String rpm) {
if ( rpm != null) format.getHeader().createEntry( SOURCERPM, rpm);
} | [
"public",
"void",
"setSourceRpm",
"(",
"final",
"String",
"rpm",
")",
"{",
"if",
"(",
"rpm",
"!=",
"null",
")",
"format",
".",
"getHeader",
"(",
")",
".",
"createEntry",
"(",
"SOURCERPM",
",",
"rpm",
")",
";",
"}"
] | Adds a source rpm.
@param rpm name of rpm source file | [
"Adds",
"a",
"source",
"rpm",
"."
] | b2fee5eb6c8150e801a132a4478a643f9ec0df04 | https://github.com/craigwblake/redline/blob/b2fee5eb6c8150e801a132a4478a643f9ec0df04/src/main/java/org/redline_rpm/Builder.java#L522-L524 | train |
craigwblake/redline | src/main/java/org/redline_rpm/Builder.java | Builder.setPrefixes | public void setPrefixes( final String... prefixes) {
if ( prefixes != null && 0 < prefixes.length) format.getHeader().createEntry( PREFIXES, prefixes);
} | java | public void setPrefixes( final String... prefixes) {
if ( prefixes != null && 0 < prefixes.length) format.getHeader().createEntry( PREFIXES, prefixes);
} | [
"public",
"void",
"setPrefixes",
"(",
"final",
"String",
"...",
"prefixes",
")",
"{",
"if",
"(",
"prefixes",
"!=",
"null",
"&&",
"0",
"<",
"prefixes",
".",
"length",
")",
"format",
".",
"getHeader",
"(",
")",
".",
"createEntry",
"(",
"PREFIXES",
",",
"... | Sets the package prefix directories to allow any files installed under
them to be relocatable.
@param prefixes Path prefixes which may be relocated | [
"Sets",
"the",
"package",
"prefix",
"directories",
"to",
"allow",
"any",
"files",
"installed",
"under",
"them",
"to",
"be",
"relocatable",
"."
] | b2fee5eb6c8150e801a132a4478a643f9ec0df04 | https://github.com/craigwblake/redline/blob/b2fee5eb6c8150e801a132a4478a643f9ec0df04/src/main/java/org/redline_rpm/Builder.java#L532-L534 | train |
craigwblake/redline | src/main/java/org/redline_rpm/Builder.java | Builder.readScript | private String readScript( File file) throws IOException {
if ( file == null) return null;
StringBuilder script = new StringBuilder();
BufferedReader in = new BufferedReader( new FileReader(file));
try {
String line;
while (( line = in.readLine()) != null) {
... | java | private String readScript( File file) throws IOException {
if ( file == null) return null;
StringBuilder script = new StringBuilder();
BufferedReader in = new BufferedReader( new FileReader(file));
try {
String line;
while (( line = in.readLine()) != null) {
... | [
"private",
"String",
"readScript",
"(",
"File",
"file",
")",
"throws",
"IOException",
"{",
"if",
"(",
"file",
"==",
"null",
")",
"return",
"null",
";",
"StringBuilder",
"script",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"BufferedReader",
"in",
"=",
"new... | Return the content of the specified script file as a String.
@param file the script file to be read | [
"Return",
"the",
"content",
"of",
"the",
"specified",
"script",
"file",
"as",
"a",
"String",
"."
] | b2fee5eb6c8150e801a132a4478a643f9ec0df04 | https://github.com/craigwblake/redline/blob/b2fee5eb6c8150e801a132a4478a643f9ec0df04/src/main/java/org/redline_rpm/Builder.java#L541-L558 | train |
craigwblake/redline | src/main/java/org/redline_rpm/Builder.java | Builder.addTrigger | public void addTrigger( final File script, final String prog, final Map< String, IntString> depends, final int flag) throws IOException {
triggerscripts.add(readScript(script));
if ( null == prog) {
triggerscriptprogs.add(DEFAULTSCRIPTPROG);
} else if ( 0 == prog.length()){
triggerscriptprogs.add(DEFAULTSCR... | java | public void addTrigger( final File script, final String prog, final Map< String, IntString> depends, final int flag) throws IOException {
triggerscripts.add(readScript(script));
if ( null == prog) {
triggerscriptprogs.add(DEFAULTSCRIPTPROG);
} else if ( 0 == prog.length()){
triggerscriptprogs.add(DEFAULTSCR... | [
"public",
"void",
"addTrigger",
"(",
"final",
"File",
"script",
",",
"final",
"String",
"prog",
",",
"final",
"Map",
"<",
"String",
",",
"IntString",
">",
"depends",
",",
"final",
"int",
"flag",
")",
"throws",
"IOException",
"{",
"triggerscripts",
".",
"ad... | Adds a trigger to the RPM package.
@param script the script to add.
@param prog the interpreter with which to run the script.
@param depends the map of rpms and versions that will trigger the script
@param flag the trigger type (SCRIPT_TRIGGERPREIN, SCRIPT_TRIGGERIN, SCRIPT_TRIGGERUN, or SCRIPT_TRIGGERPOSTUN)
@throws ... | [
"Adds",
"a",
"trigger",
"to",
"the",
"RPM",
"package",
"."
] | b2fee5eb6c8150e801a132a4478a643f9ec0df04 | https://github.com/craigwblake/redline/blob/b2fee5eb6c8150e801a132a4478a643f9ec0df04/src/main/java/org/redline_rpm/Builder.java#L835-L851 | train |
craigwblake/redline | src/main/java/org/redline_rpm/Builder.java | Builder.addFile | public void addFile( final String path, final File source, final int mode, final int dirmode, final Directive directive, final String uname, final String gname, final boolean addParents) throws NoSuchAlgorithmException, IOException {
contents.addFile( path, source, mode, directive, uname, gname, dirmode, addPar... | java | public void addFile( final String path, final File source, final int mode, final int dirmode, final Directive directive, final String uname, final String gname, final boolean addParents) throws NoSuchAlgorithmException, IOException {
contents.addFile( path, source, mode, directive, uname, gname, dirmode, addPar... | [
"public",
"void",
"addFile",
"(",
"final",
"String",
"path",
",",
"final",
"File",
"source",
",",
"final",
"int",
"mode",
",",
"final",
"int",
"dirmode",
",",
"final",
"Directive",
"directive",
",",
"final",
"String",
"uname",
",",
"final",
"String",
"gnam... | Add the specified file to the repository payload in order.
The required header entries will automatically be generated
to record the directory names and file names, as well as their
digests.
@param path the absolute path at which this file will be installed.
@param source the file content to include in this rpm.
@para... | [
"Add",
"the",
"specified",
"file",
"to",
"the",
"repository",
"payload",
"in",
"order",
".",
"The",
"required",
"header",
"entries",
"will",
"automatically",
"be",
"generated",
"to",
"record",
"the",
"directory",
"names",
"and",
"file",
"names",
"as",
"well",
... | b2fee5eb6c8150e801a132a4478a643f9ec0df04 | https://github.com/craigwblake/redline/blob/b2fee5eb6c8150e801a132a4478a643f9ec0df04/src/main/java/org/redline_rpm/Builder.java#L942-L944 | train |
craigwblake/redline | src/main/java/org/redline_rpm/Builder.java | Builder.addDirectory | public void addDirectory( final String path, final int permissions, final Directive directive, final String uname, final String gname) throws NoSuchAlgorithmException, IOException {
contents.addDirectory( path, permissions, directive, uname, gname);
} | java | public void addDirectory( final String path, final int permissions, final Directive directive, final String uname, final String gname) throws NoSuchAlgorithmException, IOException {
contents.addDirectory( path, permissions, directive, uname, gname);
} | [
"public",
"void",
"addDirectory",
"(",
"final",
"String",
"path",
",",
"final",
"int",
"permissions",
",",
"final",
"Directive",
"directive",
",",
"final",
"String",
"uname",
",",
"final",
"String",
"gname",
")",
"throws",
"NoSuchAlgorithmException",
",",
"IOExc... | Adds the directory to the repository.
@param path the absolute path to add as a directory.
@param permissions the mode of the directory in standard three octet notation.
@param directive directive indicating special handling for this file.
@param uname user owner of the directory
@param gname group owner of the direct... | [
"Adds",
"the",
"directory",
"to",
"the",
"repository",
"."
] | b2fee5eb6c8150e801a132a4478a643f9ec0df04 | https://github.com/craigwblake/redline/blob/b2fee5eb6c8150e801a132a4478a643f9ec0df04/src/main/java/org/redline_rpm/Builder.java#L1094-L1096 | train |
craigwblake/redline | src/main/java/org/redline_rpm/Builder.java | Builder.addChangelogFile | public void addChangelogFile(File changelogFile) throws IOException, ChangelogParseException {
new ChangelogHandler(this.format.getHeader()).addChangeLog(changelogFile);
} | java | public void addChangelogFile(File changelogFile) throws IOException, ChangelogParseException {
new ChangelogHandler(this.format.getHeader()).addChangeLog(changelogFile);
} | [
"public",
"void",
"addChangelogFile",
"(",
"File",
"changelogFile",
")",
"throws",
"IOException",
",",
"ChangelogParseException",
"{",
"new",
"ChangelogHandler",
"(",
"this",
".",
"format",
".",
"getHeader",
"(",
")",
")",
".",
"addChangeLog",
"(",
"changelogFile"... | Adds the supplied Changelog file as a Changelog to the header
@param changelogFile File containing the Changelog information
@throws IOException if file does not exist or cannot be read
@throws ChangelogParseException if file is not of the correct format. | [
"Adds",
"the",
"supplied",
"Changelog",
"file",
"as",
"a",
"Changelog",
"to",
"the",
"header"
] | b2fee5eb6c8150e801a132a4478a643f9ec0df04 | https://github.com/craigwblake/redline/blob/b2fee5eb6c8150e801a132a4478a643f9ec0df04/src/main/java/org/redline_rpm/Builder.java#L1182-L1184 | train |
craigwblake/redline | src/main/java/org/redline_rpm/Builder.java | Builder.build | public String build( final File directory) throws NoSuchAlgorithmException, IOException {
final String rpm = format.getLead().getName() + "." + format.getLead().getArch().toString().toLowerCase() + ".rpm";
final File file = new File( directory, rpm);
if ( file.exists()) file.delete();
RandomAccessFile raFile = ... | java | public String build( final File directory) throws NoSuchAlgorithmException, IOException {
final String rpm = format.getLead().getName() + "." + format.getLead().getArch().toString().toLowerCase() + ".rpm";
final File file = new File( directory, rpm);
if ( file.exists()) file.delete();
RandomAccessFile raFile = ... | [
"public",
"String",
"build",
"(",
"final",
"File",
"directory",
")",
"throws",
"NoSuchAlgorithmException",
",",
"IOException",
"{",
"final",
"String",
"rpm",
"=",
"format",
".",
"getLead",
"(",
")",
".",
"getName",
"(",
")",
"+",
"\".\"",
"+",
"format",
".... | Generates an RPM with a standard name consisting of the RPM package name, version, release,
and type in the given directory.
@param directory the destination directory for the new RPM file.
@return the name of the rpm
@throws NoSuchAlgorithmException the algorithm isn't supported
@throws IOException there was an IO er... | [
"Generates",
"an",
"RPM",
"with",
"a",
"standard",
"name",
"consisting",
"of",
"the",
"RPM",
"package",
"name",
"version",
"release",
"and",
"type",
"in",
"the",
"given",
"directory",
"."
] | b2fee5eb6c8150e801a132a4478a643f9ec0df04 | https://github.com/craigwblake/redline/blob/b2fee5eb6c8150e801a132a4478a643f9ec0df04/src/main/java/org/redline_rpm/Builder.java#L1233-L1241 | train |
craigwblake/redline | src/main/java/org/redline_rpm/Builder.java | Builder.getSpecial | protected byte[] getSpecial( final int tag, final int count) {
final ByteBuffer buffer = ByteBuffer.allocate( 16);
buffer.putInt( tag);
buffer.putInt( 0x00000007);
buffer.putInt( count * -16);
buffer.putInt( 0x00000010);
return buffer.array();
} | java | protected byte[] getSpecial( final int tag, final int count) {
final ByteBuffer buffer = ByteBuffer.allocate( 16);
buffer.putInt( tag);
buffer.putInt( 0x00000007);
buffer.putInt( count * -16);
buffer.putInt( 0x00000010);
return buffer.array();
} | [
"protected",
"byte",
"[",
"]",
"getSpecial",
"(",
"final",
"int",
"tag",
",",
"final",
"int",
"count",
")",
"{",
"final",
"ByteBuffer",
"buffer",
"=",
"ByteBuffer",
".",
"allocate",
"(",
"16",
")",
";",
"buffer",
".",
"putInt",
"(",
"tag",
")",
";",
... | Returns the special header expected by RPM for
a particular header.
@param tag the tag to get
@param count the number to get
@return the header bytes | [
"Returns",
"the",
"special",
"header",
"expected",
"by",
"RPM",
"for",
"a",
"particular",
"header",
"."
] | b2fee5eb6c8150e801a132a4478a643f9ec0df04 | https://github.com/craigwblake/redline/blob/b2fee5eb6c8150e801a132a4478a643f9ec0df04/src/main/java/org/redline_rpm/Builder.java#L1421-L1428 | train |
craigwblake/redline | src/main/java/org/redline_rpm/Builder.java | Builder.convert | protected int[] convert( final Integer[] ints) {
int[] array = new int[ ints.length];
int count = 0;
for ( int i : ints) array[ count++] = i;
return array;
} | java | protected int[] convert( final Integer[] ints) {
int[] array = new int[ ints.length];
int count = 0;
for ( int i : ints) array[ count++] = i;
return array;
} | [
"protected",
"int",
"[",
"]",
"convert",
"(",
"final",
"Integer",
"[",
"]",
"ints",
")",
"{",
"int",
"[",
"]",
"array",
"=",
"new",
"int",
"[",
"ints",
".",
"length",
"]",
";",
"int",
"count",
"=",
"0",
";",
"for",
"(",
"int",
"i",
":",
"ints",... | Converts an array of Integer objects into an equivalent
array of int primitives.
@param ints the array of Integer objects
@return the primitive ints array | [
"Converts",
"an",
"array",
"of",
"Integer",
"objects",
"into",
"an",
"equivalent",
"array",
"of",
"int",
"primitives",
"."
] | b2fee5eb6c8150e801a132a4478a643f9ec0df04 | https://github.com/craigwblake/redline/blob/b2fee5eb6c8150e801a132a4478a643f9ec0df04/src/main/java/org/redline_rpm/Builder.java#L1436-L1441 | train |
FlexTradeUKLtd/jfixture | jfixture/src/main/java/com/flextrade/jfixture/requests/enrichers/NumberListBuilder.java | NumberListBuilder.toActualNumber | private Object toActualNumber(Double value, Type type) {
if (type.equals(Byte.class)) return value.byteValue();
if (type.equals(Short.class)) return value.shortValue();
if (type.equals(Integer.class)) return value.intValue();
if (type.equals(Long.class)) return value.longValue();
... | java | private Object toActualNumber(Double value, Type type) {
if (type.equals(Byte.class)) return value.byteValue();
if (type.equals(Short.class)) return value.shortValue();
if (type.equals(Integer.class)) return value.intValue();
if (type.equals(Long.class)) return value.longValue();
... | [
"private",
"Object",
"toActualNumber",
"(",
"Double",
"value",
",",
"Type",
"type",
")",
"{",
"if",
"(",
"type",
".",
"equals",
"(",
"Byte",
".",
"class",
")",
")",
"return",
"value",
".",
"byteValue",
"(",
")",
";",
"if",
"(",
"type",
".",
"equals",... | but I'm going to rely on the user to not do anything silly | [
"but",
"I",
"m",
"going",
"to",
"rely",
"on",
"the",
"user",
"to",
"not",
"do",
"anything",
"silly"
] | 8733db70343bc253b9b8626aa94ed538ccb21a82 | https://github.com/FlexTradeUKLtd/jfixture/blob/8733db70343bc253b9b8626aa94ed538ccb21a82/jfixture/src/main/java/com/flextrade/jfixture/requests/enrichers/NumberListBuilder.java#L25-L36 | train |
santhosh-tekuri/jlibs | xml/src/main/java/jlibs/xml/sax/SAXDelegate.java | SAXDelegate.setHandler | public void setHandler(Object handler){
if(handler instanceof ContentHandler)
setContentHandler((ContentHandler)handler);
if(handler instanceof EntityResolver)
setEntityResolver((EntityResolver)handler);
if(handler instanceof ErrorHandler)
setErrorHandler((Err... | java | public void setHandler(Object handler){
if(handler instanceof ContentHandler)
setContentHandler((ContentHandler)handler);
if(handler instanceof EntityResolver)
setEntityResolver((EntityResolver)handler);
if(handler instanceof ErrorHandler)
setErrorHandler((Err... | [
"public",
"void",
"setHandler",
"(",
"Object",
"handler",
")",
"{",
"if",
"(",
"handler",
"instanceof",
"ContentHandler",
")",
"setContentHandler",
"(",
"(",
"ContentHandler",
")",
"handler",
")",
";",
"if",
"(",
"handler",
"instanceof",
"EntityResolver",
")",
... | Registers given handler with all its implementing interfaces.
This would be handy if you want to register to all interfaces
implemented by given handler object
@param handler Object implementing one or more sax handler interfaces | [
"Registers",
"given",
"handler",
"with",
"all",
"its",
"implementing",
"interfaces",
".",
"This",
"would",
"be",
"handy",
"if",
"you",
"want",
"to",
"register",
"to",
"all",
"interfaces",
"implemented",
"by",
"given",
"handler",
"object"
] | 59c28719f054123cf778278154e1b92e943ad232 | https://github.com/santhosh-tekuri/jlibs/blob/59c28719f054123cf778278154e1b92e943ad232/xml/src/main/java/jlibs/xml/sax/SAXDelegate.java#L45-L58 | train |
santhosh-tekuri/jlibs | core/src/main/java/jlibs/core/lang/RuntimeUtil.java | RuntimeUtil.redirectStreams | public static void redirectStreams(Process process, OutputStream output, OutputStream error){
if(output!=null)
new Thread(new IOPump(process.getInputStream(), output, false, false).asRunnable()).start();
if(error!=null)
new Thread(new IOPump(process.getErrorStream(), error, false... | java | public static void redirectStreams(Process process, OutputStream output, OutputStream error){
if(output!=null)
new Thread(new IOPump(process.getInputStream(), output, false, false).asRunnable()).start();
if(error!=null)
new Thread(new IOPump(process.getErrorStream(), error, false... | [
"public",
"static",
"void",
"redirectStreams",
"(",
"Process",
"process",
",",
"OutputStream",
"output",
",",
"OutputStream",
"error",
")",
"{",
"if",
"(",
"output",
"!=",
"null",
")",
"new",
"Thread",
"(",
"new",
"IOPump",
"(",
"process",
".",
"getInputStre... | Redirects given process's input and error streams to the specified streams.
the streams specified are not closed automatically. The streams passed
can be null, if you don't want to redirect them.
@param process process whose streams to be redirected
@param output outputStream to which process's inputStream is red... | [
"Redirects",
"given",
"process",
"s",
"input",
"and",
"error",
"streams",
"to",
"the",
"specified",
"streams",
".",
"the",
"streams",
"specified",
"are",
"not",
"closed",
"automatically",
".",
"The",
"streams",
"passed",
"can",
"be",
"null",
"if",
"you",
"do... | 59c28719f054123cf778278154e1b92e943ad232 | https://github.com/santhosh-tekuri/jlibs/blob/59c28719f054123cf778278154e1b92e943ad232/core/src/main/java/jlibs/core/lang/RuntimeUtil.java#L43-L48 | train |
santhosh-tekuri/jlibs | core/src/main/java/jlibs/core/lang/ArrayUtil.java | ArrayUtil.concat | public static Object[] concat(Object array1[], Object array2[]){
Class<?> class1 = array1.getClass().getComponentType();
Class<?> class2 = array2.getClass().getComponentType();
Class<?> commonClass = class1.isAssignableFrom(class2)
? class1
... | java | public static Object[] concat(Object array1[], Object array2[]){
Class<?> class1 = array1.getClass().getComponentType();
Class<?> class2 = array2.getClass().getComponentType();
Class<?> commonClass = class1.isAssignableFrom(class2)
? class1
... | [
"public",
"static",
"Object",
"[",
"]",
"concat",
"(",
"Object",
"array1",
"[",
"]",
",",
"Object",
"array2",
"[",
"]",
")",
"{",
"Class",
"<",
"?",
">",
"class1",
"=",
"array1",
".",
"getClass",
"(",
")",
".",
"getComponentType",
"(",
")",
";",
"C... | Returns new array which has all values from array1 and array2 in order.
The componentType for the new array is determined by the componentTypes of
two arrays. | [
"Returns",
"new",
"array",
"which",
"has",
"all",
"values",
"from",
"array1",
"and",
"array2",
"in",
"order",
".",
"The",
"componentType",
"for",
"the",
"new",
"array",
"is",
"determined",
"by",
"the",
"componentTypes",
"of",
"two",
"arrays",
"."
] | 59c28719f054123cf778278154e1b92e943ad232 | https://github.com/santhosh-tekuri/jlibs/blob/59c28719f054123cf778278154e1b92e943ad232/core/src/main/java/jlibs/core/lang/ArrayUtil.java#L195-L202 | train |
santhosh-tekuri/jlibs | xml/src/main/java/jlibs/xml/xsl/TransformerUtil.java | TransformerUtil.setOutputProperties | public static Transformer setOutputProperties(Transformer transformer, boolean omitXMLDeclaration, int indentAmount, String encoding){
transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, omitXMLDeclaration ? "yes" : "no");
// indentation
if(indentAmount>0){
transformer.se... | java | public static Transformer setOutputProperties(Transformer transformer, boolean omitXMLDeclaration, int indentAmount, String encoding){
transformer.setOutputProperty(OutputKeys.OMIT_XML_DECLARATION, omitXMLDeclaration ? "yes" : "no");
// indentation
if(indentAmount>0){
transformer.se... | [
"public",
"static",
"Transformer",
"setOutputProperties",
"(",
"Transformer",
"transformer",
",",
"boolean",
"omitXMLDeclaration",
",",
"int",
"indentAmount",
",",
"String",
"encoding",
")",
"{",
"transformer",
".",
"setOutputProperty",
"(",
"OutputKeys",
".",
"OMIT_X... | to set various output properties on given transformer.
@param transformer transformer on which properties are set
@param omitXMLDeclaration omit xml declaration or not
@param indentAmount the number fo spaces used for indentation.
use <=0, in case you dont want indentation
@param encoding ... | [
"to",
"set",
"various",
"output",
"properties",
"on",
"given",
"transformer",
"."
] | 59c28719f054123cf778278154e1b92e943ad232 | https://github.com/santhosh-tekuri/jlibs/blob/59c28719f054123cf778278154e1b92e943ad232/xml/src/main/java/jlibs/xml/xsl/TransformerUtil.java#L44-L57 | train |
santhosh-tekuri/jlibs | nbp/src/main/java/jlibs/nbp/Location.java | Location.consume | public boolean consume(int ch){
offset++;
if(ch==0x0D){
skipLF = true;
line++;
col = 0;
return true;
}else if(ch==0x0A){
if(skipLF){
skipLF = false;
return false;
}else{
line++... | java | public boolean consume(int ch){
offset++;
if(ch==0x0D){
skipLF = true;
line++;
col = 0;
return true;
}else if(ch==0x0A){
if(skipLF){
skipLF = false;
return false;
}else{
line++... | [
"public",
"boolean",
"consume",
"(",
"int",
"ch",
")",
"{",
"offset",
"++",
";",
"if",
"(",
"ch",
"==",
"0x0D",
")",
"{",
"skipLF",
"=",
"true",
";",
"line",
"++",
";",
"col",
"=",
"0",
";",
"return",
"true",
";",
"}",
"else",
"if",
"(",
"ch",
... | return value tells whether the given character
has been included in location or not
for example in sequence "\r\n", the character
'\n' is not included in location. | [
"return",
"value",
"tells",
"whether",
"the",
"given",
"character",
"has",
"been",
"included",
"in",
"location",
"or",
"not"
] | 59c28719f054123cf778278154e1b92e943ad232 | https://github.com/santhosh-tekuri/jlibs/blob/59c28719f054123cf778278154e1b92e943ad232/nbp/src/main/java/jlibs/nbp/Location.java#L47-L68 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.