id int32 0 165k | repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 |
|---|---|---|---|---|---|---|---|---|---|---|---|
109,300 | irmen/Serpent | java/src/main/java/net/razorvine/serpent/SeekableStringReader.java | SeekableStringReader.readUntil | public String readUntil(char sentinel)
{
int i = str.indexOf(sentinel, cursor);
if(i>=0) {
int from = cursor;
cursor = i+1;
return str.substring(from, i);
}
throw new ParseException("terminator not found");
} | java | public String readUntil(char sentinel)
{
int i = str.indexOf(sentinel, cursor);
if(i>=0) {
int from = cursor;
cursor = i+1;
return str.substring(from, i);
}
throw new ParseException("terminator not found");
} | [
"public",
"String",
"readUntil",
"(",
"char",
"sentinel",
")",
"{",
"int",
"i",
"=",
"str",
".",
"indexOf",
"(",
"sentinel",
",",
"cursor",
")",
";",
"if",
"(",
"i",
">=",
"0",
")",
"{",
"int",
"from",
"=",
"cursor",
";",
"cursor",
"=",
"i",
"+",... | Read everything until one the sentinel, which must exist in the string.
Sentinel char is read but not returned in the result. | [
"Read",
"everything",
"until",
"one",
"the",
"sentinel",
"which",
"must",
"exist",
"in",
"the",
"string",
".",
"Sentinel",
"char",
"is",
"read",
"but",
"not",
"returned",
"in",
"the",
"result",
"."
] | 763a6e15f75c4d5937cd16dfc70b0930a442b541 | https://github.com/irmen/Serpent/blob/763a6e15f75c4d5937cd16dfc70b0930a442b541/java/src/main/java/net/razorvine/serpent/SeekableStringReader.java#L91-L100 |
109,301 | irmen/Serpent | java/src/main/java/net/razorvine/serpent/SeekableStringReader.java | SeekableStringReader.readWhile | public String readWhile(String accepted)
{
int start = cursor;
while(cursor < str.length())
{
if(accepted.indexOf(str.charAt(cursor))>=0)
++cursor;
else
break;
}
return str.substring(start, cursor);
} | java | public String readWhile(String accepted)
{
int start = cursor;
while(cursor < str.length())
{
if(accepted.indexOf(str.charAt(cursor))>=0)
++cursor;
else
break;
}
return str.substring(start, cursor);
} | [
"public",
"String",
"readWhile",
"(",
"String",
"accepted",
")",
"{",
"int",
"start",
"=",
"cursor",
";",
"while",
"(",
"cursor",
"<",
"str",
".",
"length",
"(",
")",
")",
"{",
"if",
"(",
"accepted",
".",
"indexOf",
"(",
"str",
".",
"charAt",
"(",
... | Read everything as long as the char occurs in the accepted characters. | [
"Read",
"everything",
"as",
"long",
"as",
"the",
"char",
"occurs",
"in",
"the",
"accepted",
"characters",
"."
] | 763a6e15f75c4d5937cd16dfc70b0930a442b541 | https://github.com/irmen/Serpent/blob/763a6e15f75c4d5937cd16dfc70b0930a442b541/java/src/main/java/net/razorvine/serpent/SeekableStringReader.java#L128-L139 |
109,302 | irmen/Serpent | java/src/main/java/net/razorvine/serpent/SeekableStringReader.java | SeekableStringReader.rest | public String rest()
{
if(cursor>=str.length())
throw new ParseException("no more data");
String result=str.substring(cursor);
cursor = str.length();
return result;
} | java | public String rest()
{
if(cursor>=str.length())
throw new ParseException("no more data");
String result=str.substring(cursor);
cursor = str.length();
return result;
} | [
"public",
"String",
"rest",
"(",
")",
"{",
"if",
"(",
"cursor",
">=",
"str",
".",
"length",
"(",
")",
")",
"throw",
"new",
"ParseException",
"(",
"\"no more data\"",
")",
";",
"String",
"result",
"=",
"str",
".",
"substring",
"(",
"cursor",
")",
";",
... | Returns the rest of the data until the end. | [
"Returns",
"the",
"rest",
"of",
"the",
"data",
"until",
"the",
"end",
"."
] | 763a6e15f75c4d5937cd16dfc70b0930a442b541 | https://github.com/irmen/Serpent/blob/763a6e15f75c4d5937cd16dfc70b0930a442b541/java/src/main/java/net/razorvine/serpent/SeekableStringReader.java#L166-L173 |
109,303 | irmen/Serpent | java/src/main/java/net/razorvine/serpent/ast/Ast.java | Ast.getData | public Object getData(IDictToInstance dictConverter)
{
ObjectifyVisitor v = new ObjectifyVisitor(dictConverter);
this.accept(v);
return v.getObject();
} | java | public Object getData(IDictToInstance dictConverter)
{
ObjectifyVisitor v = new ObjectifyVisitor(dictConverter);
this.accept(v);
return v.getObject();
} | [
"public",
"Object",
"getData",
"(",
"IDictToInstance",
"dictConverter",
")",
"{",
"ObjectifyVisitor",
"v",
"=",
"new",
"ObjectifyVisitor",
"(",
"dictConverter",
")",
";",
"this",
".",
"accept",
"(",
"v",
")",
";",
"return",
"v",
".",
"getObject",
"(",
")",
... | get the actual data as Java objects.
@param dictConverter object to convert dicts to actual instances for a class,
instead of leaving them as dictionaries. Requires the __class__ key to be present
in the dict node. If it returns null, the normal processing is done. | [
"get",
"the",
"actual",
"data",
"as",
"Java",
"objects",
"."
] | 763a6e15f75c4d5937cd16dfc70b0930a442b541 | https://github.com/irmen/Serpent/blob/763a6e15f75c4d5937cd16dfc70b0930a442b541/java/src/main/java/net/razorvine/serpent/ast/Ast.java#L42-L47 |
109,304 | irmen/Serpent | java/src/main/java/net/razorvine/serpent/Parser.java | Parser.parse | public Ast parse(String expression)
{
Ast ast=new Ast();
if(expression==null || expression.length()==0)
return ast;
SeekableStringReader sr = new SeekableStringReader(expression);
if(sr.peek()=='#')
sr.readUntil('\n'); // skip comment line
try {
ast.root = parseExpr(sr);
sr.skipWhitespace(... | java | public Ast parse(String expression)
{
Ast ast=new Ast();
if(expression==null || expression.length()==0)
return ast;
SeekableStringReader sr = new SeekableStringReader(expression);
if(sr.peek()=='#')
sr.readUntil('\n'); // skip comment line
try {
ast.root = parseExpr(sr);
sr.skipWhitespace(... | [
"public",
"Ast",
"parse",
"(",
"String",
"expression",
")",
"{",
"Ast",
"ast",
"=",
"new",
"Ast",
"(",
")",
";",
"if",
"(",
"expression",
"==",
"null",
"||",
"expression",
".",
"length",
"(",
")",
"==",
"0",
")",
"return",
"ast",
";",
"SeekableString... | Parse from a string with the Python literal expression | [
"Parse",
"from",
"a",
"string",
"with",
"the",
"Python",
"literal",
"expression"
] | 763a6e15f75c4d5937cd16dfc70b0930a442b541 | https://github.com/irmen/Serpent/blob/763a6e15f75c4d5937cd16dfc70b0930a442b541/java/src/main/java/net/razorvine/serpent/Parser.java#L43-L63 |
109,305 | XiaoMi/galaxy-fds-sdk-java | src/main/java/com/xiaomi/infra/galaxy/fds/client/GalaxyFDSClient.java | GalaxyFDSClient.getObject | @Override
public FDSObject getObject(String bucketName, String objectName, long pos)
throws GalaxyFDSClientException {
return this.getObject(bucketName, objectName, null, pos);
} | java | @Override
public FDSObject getObject(String bucketName, String objectName, long pos)
throws GalaxyFDSClientException {
return this.getObject(bucketName, objectName, null, pos);
} | [
"@",
"Override",
"public",
"FDSObject",
"getObject",
"(",
"String",
"bucketName",
",",
"String",
"objectName",
",",
"long",
"pos",
")",
"throws",
"GalaxyFDSClientException",
"{",
"return",
"this",
".",
"getObject",
"(",
"bucketName",
",",
"objectName",
",",
"nul... | range mode for getobject while not be autoReConnection
@param bucketName The name of the bucket where the object stores
@param objectName The name of the object to get
@param pos The position to start read
@return
@throws GalaxyFDSClientException | [
"range",
"mode",
"for",
"getobject",
"while",
"not",
"be",
"autoReConnection"
] | 5e93bc2b574dfa51e47451a0efa80c018ff2c48f | https://github.com/XiaoMi/galaxy-fds-sdk-java/blob/5e93bc2b574dfa51e47451a0efa80c018ff2c48f/src/main/java/com/xiaomi/infra/galaxy/fds/client/GalaxyFDSClient.java#L1177-L1181 |
109,306 | XiaoMi/galaxy-fds-sdk-java | src/main/java/com/xiaomi/infra/galaxy/fds/client/GalaxyFDSClient.java | GalaxyFDSClient.putClientMetrics | public void putClientMetrics(ClientMetrics clientMetrics)
throws GalaxyFDSClientException {
URI uri = formatUri(fdsConfig.getBaseUri(), "", (SubResource[]) null);
ContentType contentType = ContentType.APPLICATION_JSON;
HashMap<String, String> params = new HashMap<String, String>();
params.put("cli... | java | public void putClientMetrics(ClientMetrics clientMetrics)
throws GalaxyFDSClientException {
URI uri = formatUri(fdsConfig.getBaseUri(), "", (SubResource[]) null);
ContentType contentType = ContentType.APPLICATION_JSON;
HashMap<String, String> params = new HashMap<String, String>();
params.put("cli... | [
"public",
"void",
"putClientMetrics",
"(",
"ClientMetrics",
"clientMetrics",
")",
"throws",
"GalaxyFDSClientException",
"{",
"URI",
"uri",
"=",
"formatUri",
"(",
"fdsConfig",
".",
"getBaseUri",
"(",
")",
",",
"\"\"",
",",
"(",
"SubResource",
"[",
"]",
")",
"nu... | Put client metrics to server. This method should only be used internally.
@param clientMetrics Metrics to be pushed to server.
@throws GalaxyFDSClientException | [
"Put",
"client",
"metrics",
"to",
"server",
".",
"This",
"method",
"should",
"only",
"be",
"used",
"internally",
"."
] | 5e93bc2b574dfa51e47451a0efa80c018ff2c48f | https://github.com/XiaoMi/galaxy-fds-sdk-java/blob/5e93bc2b574dfa51e47451a0efa80c018ff2c48f/src/main/java/com/xiaomi/infra/galaxy/fds/client/GalaxyFDSClient.java#L2289-L2302 |
109,307 | XiaoMi/galaxy-fds-sdk-java | src/main/java/com/xiaomi/infra/galaxy/fds/client/model/FDSPutObjectRequest.java | FDSPutObjectRequest.setInputStream | public void setInputStream(InputStream inputStream, long inputStreamLength) {
// close last file when set a new inputStream
if (this.isUploadFile){
try{
this.inputStream.close();
}
catch (Exception e){
}
}
if (inputStream instanceof FDSProgressInputStream){
this.inputStream = (FDSProgressInp... | java | public void setInputStream(InputStream inputStream, long inputStreamLength) {
// close last file when set a new inputStream
if (this.isUploadFile){
try{
this.inputStream.close();
}
catch (Exception e){
}
}
if (inputStream instanceof FDSProgressInputStream){
this.inputStream = (FDSProgressInp... | [
"public",
"void",
"setInputStream",
"(",
"InputStream",
"inputStream",
",",
"long",
"inputStreamLength",
")",
"{",
"// close last file when set a new inputStream",
"if",
"(",
"this",
".",
"isUploadFile",
")",
"{",
"try",
"{",
"this",
".",
"inputStream",
".",
"close"... | Auto convert inputStream to FDSProgressInputStream in order to invoke progress listener
@param inputStream
@param inputStreamLength the length of inputStream, set -1 if the length is uncertain | [
"Auto",
"convert",
"inputStream",
"to",
"FDSProgressInputStream",
"in",
"order",
"to",
"invoke",
"progress",
"listener"
] | 5e93bc2b574dfa51e47451a0efa80c018ff2c48f | https://github.com/XiaoMi/galaxy-fds-sdk-java/blob/5e93bc2b574dfa51e47451a0efa80c018ff2c48f/src/main/java/com/xiaomi/infra/galaxy/fds/client/model/FDSPutObjectRequest.java#L117-L139 |
109,308 | XiaoMi/galaxy-fds-sdk-java | src/main/java/com/xiaomi/infra/galaxy/fds/client/model/FDSPutObjectRequest.java | FDSPutObjectRequest.setFile | public void setFile(File file) throws FileNotFoundException{
this.setInputStream(new BufferedInputStream(new FileInputStream(file)), file.length());
this.isUploadFile = true;
} | java | public void setFile(File file) throws FileNotFoundException{
this.setInputStream(new BufferedInputStream(new FileInputStream(file)), file.length());
this.isUploadFile = true;
} | [
"public",
"void",
"setFile",
"(",
"File",
"file",
")",
"throws",
"FileNotFoundException",
"{",
"this",
".",
"setInputStream",
"(",
"new",
"BufferedInputStream",
"(",
"new",
"FileInputStream",
"(",
"file",
")",
")",
",",
"file",
".",
"length",
"(",
")",
")",
... | Upload file as inputStream
@param file
@throws FileNotFoundException | [
"Upload",
"file",
"as",
"inputStream"
] | 5e93bc2b574dfa51e47451a0efa80c018ff2c48f | https://github.com/XiaoMi/galaxy-fds-sdk-java/blob/5e93bc2b574dfa51e47451a0efa80c018ff2c48f/src/main/java/com/xiaomi/infra/galaxy/fds/client/model/FDSPutObjectRequest.java#L151-L154 |
109,309 | uber/rides-java-sdk | samples/servlet-sample/src/main/java/com/uber/sdk/rides/samples/servlet/SampleServlet.java | SampleServlet.service | @Override
protected void service(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException {
SessionConfiguration config = Server.createSessionConfiguration();
if (oAuth2Credentials == null) {
oAuth2Credentials = Server.createOAuth2Credentials(config);
... | java | @Override
protected void service(HttpServletRequest req, HttpServletResponse resp) throws IOException, ServletException {
SessionConfiguration config = Server.createSessionConfiguration();
if (oAuth2Credentials == null) {
oAuth2Credentials = Server.createOAuth2Credentials(config);
... | [
"@",
"Override",
"protected",
"void",
"service",
"(",
"HttpServletRequest",
"req",
",",
"HttpServletResponse",
"resp",
")",
"throws",
"IOException",
",",
"ServletException",
"{",
"SessionConfiguration",
"config",
"=",
"Server",
".",
"createSessionConfiguration",
"(",
... | Before each request, fetch an OAuth2 credential for the user or redirect them to the
OAuth2 login page instead. | [
"Before",
"each",
"request",
"fetch",
"an",
"OAuth2",
"credential",
"for",
"the",
"user",
"or",
"redirect",
"them",
"to",
"the",
"OAuth2",
"login",
"page",
"instead",
"."
] | 6c75570ab7884f8ecafaad312ef471dd33f64c42 | https://github.com/uber/rides-java-sdk/blob/6c75570ab7884f8ecafaad312ef471dd33f64c42/samples/servlet-sample/src/main/java/com/uber/sdk/rides/samples/servlet/SampleServlet.java#L66-L95 |
109,310 | uber/rides-java-sdk | samples/cmdline-sample/src/main/java/com/uber/sdk/rides/samples/cmdline/GetUserProfile.java | GetUserProfile.authenticate | private static Credential authenticate(String userId, SessionConfiguration config) throws Exception {
OAuth2Credentials oAuth2Credentials = createOAuth2Credentials(config);
// First try to load an existing Credential. If that credential is null, authenticate the user.
Credential credential = oA... | java | private static Credential authenticate(String userId, SessionConfiguration config) throws Exception {
OAuth2Credentials oAuth2Credentials = createOAuth2Credentials(config);
// First try to load an existing Credential. If that credential is null, authenticate the user.
Credential credential = oA... | [
"private",
"static",
"Credential",
"authenticate",
"(",
"String",
"userId",
",",
"SessionConfiguration",
"config",
")",
"throws",
"Exception",
"{",
"OAuth2Credentials",
"oAuth2Credentials",
"=",
"createOAuth2Credentials",
"(",
"config",
")",
";",
"// First try to load an ... | Authenticate the given user. If you are distributing an installed application, this method
should exist on your server so that the client ID and secret are not shared with the end
user. | [
"Authenticate",
"the",
"given",
"user",
".",
"If",
"you",
"are",
"distributing",
"an",
"installed",
"application",
"this",
"method",
"should",
"exist",
"on",
"your",
"server",
"so",
"that",
"the",
"client",
"ID",
"and",
"secret",
"are",
"not",
"shared",
"wit... | 6c75570ab7884f8ecafaad312ef471dd33f64c42 | https://github.com/uber/rides-java-sdk/blob/6c75570ab7884f8ecafaad312ef471dd33f64c42/samples/cmdline-sample/src/main/java/com/uber/sdk/rides/samples/cmdline/GetUserProfile.java#L90-L118 |
109,311 | uber/rides-java-sdk | uber-core-oauth-client-adapter/src/main/java/com/uber/sdk/core/auth/OAuth2Credentials.java | OAuth2Credentials.getAuthorizationUrl | @Nullable
public String getAuthorizationUrl() throws UnsupportedEncodingException {
String authorizationCodeRequestUrl =
authorizationCodeFlow.newAuthorizationUrl().setScopes(scopes).build();
if (redirectUri != null) {
authorizationCodeRequestUrl += "&redirect_uri=" + URL... | java | @Nullable
public String getAuthorizationUrl() throws UnsupportedEncodingException {
String authorizationCodeRequestUrl =
authorizationCodeFlow.newAuthorizationUrl().setScopes(scopes).build();
if (redirectUri != null) {
authorizationCodeRequestUrl += "&redirect_uri=" + URL... | [
"@",
"Nullable",
"public",
"String",
"getAuthorizationUrl",
"(",
")",
"throws",
"UnsupportedEncodingException",
"{",
"String",
"authorizationCodeRequestUrl",
"=",
"authorizationCodeFlow",
".",
"newAuthorizationUrl",
"(",
")",
".",
"setScopes",
"(",
"scopes",
")",
".",
... | Gets the authorization URL to retrieve the authorization code. | [
"Gets",
"the",
"authorization",
"URL",
"to",
"retrieve",
"the",
"authorization",
"code",
"."
] | 6c75570ab7884f8ecafaad312ef471dd33f64c42 | https://github.com/uber/rides-java-sdk/blob/6c75570ab7884f8ecafaad312ef471dd33f64c42/uber-core-oauth-client-adapter/src/main/java/com/uber/sdk/core/auth/OAuth2Credentials.java#L229-L237 |
109,312 | uber/rides-java-sdk | uber-core-oauth-client-adapter/src/main/java/com/uber/sdk/core/auth/OAuth2Credentials.java | OAuth2Credentials.clearCredential | public void clearCredential(String userId) throws AuthException {
try {
authorizationCodeFlow.getCredentialDataStore().delete(userId);
} catch (IOException e) {
throw new AuthException("Unable to clear credential.", e);
}
} | java | public void clearCredential(String userId) throws AuthException {
try {
authorizationCodeFlow.getCredentialDataStore().delete(userId);
} catch (IOException e) {
throw new AuthException("Unable to clear credential.", e);
}
} | [
"public",
"void",
"clearCredential",
"(",
"String",
"userId",
")",
"throws",
"AuthException",
"{",
"try",
"{",
"authorizationCodeFlow",
".",
"getCredentialDataStore",
"(",
")",
".",
"delete",
"(",
"userId",
")",
";",
"}",
"catch",
"(",
"IOException",
"e",
")",... | Clears the credential for the user in the underlying (@link DateStore}.
@throws AuthException If the credential could not be cleared. | [
"Clears",
"the",
"credential",
"for",
"the",
"user",
"in",
"the",
"underlying",
"("
] | 6c75570ab7884f8ecafaad312ef471dd33f64c42 | https://github.com/uber/rides-java-sdk/blob/6c75570ab7884f8ecafaad312ef471dd33f64c42/uber-core-oauth-client-adapter/src/main/java/com/uber/sdk/core/auth/OAuth2Credentials.java#L287-L293 |
109,313 | google/gwteventbinder | eventbinder/src/main/java/com/google/web/bindery/event/shared/binder/impl/AbstractEventBinder.java | AbstractEventBinder.bind | protected final <U extends GenericEvent> void bind(
EventBus eventBus,
List<HandlerRegistration> registrations,
Class<U> type,
GenericEventHandler handler) {
registrations.add(eventBus.addHandler(GenericEventType.getTypeOf(type), handler));
} | java | protected final <U extends GenericEvent> void bind(
EventBus eventBus,
List<HandlerRegistration> registrations,
Class<U> type,
GenericEventHandler handler) {
registrations.add(eventBus.addHandler(GenericEventType.getTypeOf(type), handler));
} | [
"protected",
"final",
"<",
"U",
"extends",
"GenericEvent",
">",
"void",
"bind",
"(",
"EventBus",
"eventBus",
",",
"List",
"<",
"HandlerRegistration",
">",
"registrations",
",",
"Class",
"<",
"U",
">",
"type",
",",
"GenericEventHandler",
"handler",
")",
"{",
... | Registers the given handler for the given event class on the given event bus. Factored out
into a method here instead of generated directly in order to simplify the generated code and
save a little space. | [
"Registers",
"the",
"given",
"handler",
"for",
"the",
"given",
"event",
"class",
"on",
"the",
"given",
"event",
"bus",
".",
"Factored",
"out",
"into",
"a",
"method",
"here",
"instead",
"of",
"generated",
"directly",
"in",
"order",
"to",
"simplify",
"the",
... | 46d3e72e9006a4c7801c077b1b83ffb11bf687f7 | https://github.com/google/gwteventbinder/blob/46d3e72e9006a4c7801c077b1b83ffb11bf687f7/eventbinder/src/main/java/com/google/web/bindery/event/shared/binder/impl/AbstractEventBinder.java#L59-L65 |
109,314 | coursera/courier | generator-api/src/main/java/org/coursera/courier/api/DefaultGeneratorRunner.java | DefaultGeneratorRunner.findTopLevelTypes | private static Set<ClassTemplateSpec> findTopLevelTypes(ClassTemplateSpec spec) {
Set<ClassTemplateSpec> specs =
new HashSet<ClassTemplateSpec>(ClassTemplateSpecs.allReferencedTypes(spec));
specs.add(spec);
Iterator<ClassTemplateSpec> iterator = specs.iterator();
while (iterator.hasNext()) {
... | java | private static Set<ClassTemplateSpec> findTopLevelTypes(ClassTemplateSpec spec) {
Set<ClassTemplateSpec> specs =
new HashSet<ClassTemplateSpec>(ClassTemplateSpecs.allReferencedTypes(spec));
specs.add(spec);
Iterator<ClassTemplateSpec> iterator = specs.iterator();
while (iterator.hasNext()) {
... | [
"private",
"static",
"Set",
"<",
"ClassTemplateSpec",
">",
"findTopLevelTypes",
"(",
"ClassTemplateSpec",
"spec",
")",
"{",
"Set",
"<",
"ClassTemplateSpec",
">",
"specs",
"=",
"new",
"HashSet",
"<",
"ClassTemplateSpec",
">",
"(",
"ClassTemplateSpecs",
".",
"allRef... | Currently, one ClassDefinition is provided per .pdsc file. But some of those .pdsc contain
inline schema definitions that should be generated into top level classes.
This method traverses the spec hierarchy, finding all specs that should be generated as top
level classes.
I've asked the rest.li team to consider restr... | [
"Currently",
"one",
"ClassDefinition",
"is",
"provided",
"per",
".",
"pdsc",
"file",
".",
"But",
"some",
"of",
"those",
".",
"pdsc",
"contain",
"inline",
"schema",
"definitions",
"that",
"should",
"be",
"generated",
"into",
"top",
"level",
"classes",
"."
] | 749674fa7ee33804ad11b6c8ecb560f455cb4c22 | https://github.com/coursera/courier/blob/749674fa7ee33804ad11b6c8ecb560f455cb4c22/generator-api/src/main/java/org/coursera/courier/api/DefaultGeneratorRunner.java#L152-L165 |
109,315 | coursera/courier | typescript-lite/generator/src/main/java/org/coursera/courier/tslite/TSSyntax.java | TSSyntax.escapeKeyword | private static String escapeKeyword(String symbol, EscapeStrategy strategy) {
if (tsKeywords.contains(symbol)) {
if (strategy.equals(EscapeStrategy.MANGLE)) {
return symbol + "$";
} else {
return "\"" + symbol + "\"";
}
} else {
return symbol;
}
} | java | private static String escapeKeyword(String symbol, EscapeStrategy strategy) {
if (tsKeywords.contains(symbol)) {
if (strategy.equals(EscapeStrategy.MANGLE)) {
return symbol + "$";
} else {
return "\"" + symbol + "\"";
}
} else {
return symbol;
}
} | [
"private",
"static",
"String",
"escapeKeyword",
"(",
"String",
"symbol",
",",
"EscapeStrategy",
"strategy",
")",
"{",
"if",
"(",
"tsKeywords",
".",
"contains",
"(",
"symbol",
")",
")",
"{",
"if",
"(",
"strategy",
".",
"equals",
"(",
"EscapeStrategy",
".",
... | Returns the escaped Pegasus symbol for use in Typescript source code.
Pegasus symbols must be of the form [A-Za-z_], so this routine simply checks if the
symbol collides with a typescript keyword, and if so, escapes it.
@param symbol the symbol to escape
@param strategy which strategy to use in escaping
@return the ... | [
"Returns",
"the",
"escaped",
"Pegasus",
"symbol",
"for",
"use",
"in",
"Typescript",
"source",
"code",
"."
] | 749674fa7ee33804ad11b6c8ecb560f455cb4c22 | https://github.com/coursera/courier/blob/749674fa7ee33804ad11b6c8ecb560f455cb4c22/typescript-lite/generator/src/main/java/org/coursera/courier/tslite/TSSyntax.java#L161-L171 |
109,316 | coursera/courier | typescript-lite/generator/src/main/java/org/coursera/courier/tslite/TSSyntax.java | TSSyntax.docComment | private static String docComment(String doc, Object deprecation /* nullable */) {
StringBuilder docStr = new StringBuilder();
if (doc != null) {
docStr.append(doc.trim());
}
if (deprecation != null) {
docStr.append("\n\n").append("@deprecated");
if (deprecation instanceof String) {
... | java | private static String docComment(String doc, Object deprecation /* nullable */) {
StringBuilder docStr = new StringBuilder();
if (doc != null) {
docStr.append(doc.trim());
}
if (deprecation != null) {
docStr.append("\n\n").append("@deprecated");
if (deprecation instanceof String) {
... | [
"private",
"static",
"String",
"docComment",
"(",
"String",
"doc",
",",
"Object",
"deprecation",
"/* nullable */",
")",
"{",
"StringBuilder",
"docStr",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"if",
"(",
"doc",
"!=",
"null",
")",
"{",
"docStr",
".",
"ap... | Return a full tsdoc for a type.
@param doc the doc string in the type's DataSchema.
@param deprecation the object listed under the schema's "deprecation" property
@return a fully formed tsdoc for the type. | [
"Return",
"a",
"full",
"tsdoc",
"for",
"a",
"type",
"."
] | 749674fa7ee33804ad11b6c8ecb560f455cb4c22 | https://github.com/coursera/courier/blob/749674fa7ee33804ad11b6c8ecb560f455cb4c22/typescript-lite/generator/src/main/java/org/coursera/courier/tslite/TSSyntax.java#L202-L216 |
109,317 | coursera/courier | typescript-lite/generator/src/main/java/org/coursera/courier/tslite/TSSyntax.java | TSSyntax.typeNameQualifiedByEnclosingClass | String typeNameQualifiedByEnclosingClass(TSTypeSyntax syntax) {
if (syntax instanceof TSEnclosedTypeSyntax) {
return ((TSEnclosedTypeSyntax) syntax).typeNameQualifiedByEnclosedType();
} else {
return syntax.typeName();
}
} | java | String typeNameQualifiedByEnclosingClass(TSTypeSyntax syntax) {
if (syntax instanceof TSEnclosedTypeSyntax) {
return ((TSEnclosedTypeSyntax) syntax).typeNameQualifiedByEnclosedType();
} else {
return syntax.typeName();
}
} | [
"String",
"typeNameQualifiedByEnclosingClass",
"(",
"TSTypeSyntax",
"syntax",
")",
"{",
"if",
"(",
"syntax",
"instanceof",
"TSEnclosedTypeSyntax",
")",
"{",
"return",
"(",
"(",
"TSEnclosedTypeSyntax",
")",
"syntax",
")",
".",
"typeNameQualifiedByEnclosedType",
"(",
")... | Returns the type name, prefaced with the enclosing class name if there was one.
For example, a standalone union called MyUnion will just return "MyUnion".
If that same union were enclosed within MyRecord, this would return "MyRecord.MyUnion". | [
"Returns",
"the",
"type",
"name",
"prefaced",
"with",
"the",
"enclosing",
"class",
"name",
"if",
"there",
"was",
"one",
"."
] | 749674fa7ee33804ad11b6c8ecb560f455cb4c22 | https://github.com/coursera/courier/blob/749674fa7ee33804ad11b6c8ecb560f455cb4c22/typescript-lite/generator/src/main/java/org/coursera/courier/tslite/TSSyntax.java#L298-L304 |
109,318 | coursera/courier | typescript-lite/generator/src/main/java/org/coursera/courier/tslite/TSSyntax.java | TSSyntax.TSTyperefSyntaxCreate | public TSTyperefSyntax TSTyperefSyntaxCreate(TyperefTemplateSpec template) {
return new TSTyperefSyntax(template, template.getSchema(), new TSNamedTypeSyntax(template.getSchema()));
} | java | public TSTyperefSyntax TSTyperefSyntaxCreate(TyperefTemplateSpec template) {
return new TSTyperefSyntax(template, template.getSchema(), new TSNamedTypeSyntax(template.getSchema()));
} | [
"public",
"TSTyperefSyntax",
"TSTyperefSyntaxCreate",
"(",
"TyperefTemplateSpec",
"template",
")",
"{",
"return",
"new",
"TSTyperefSyntax",
"(",
"template",
",",
"template",
".",
"getSchema",
"(",
")",
",",
"new",
"TSNamedTypeSyntax",
"(",
"template",
".",
"getSchem... | Create a new TyperefSyntax | [
"Create",
"a",
"new",
"TyperefSyntax"
] | 749674fa7ee33804ad11b6c8ecb560f455cb4c22 | https://github.com/coursera/courier/blob/749674fa7ee33804ad11b6c8ecb560f455cb4c22/typescript-lite/generator/src/main/java/org/coursera/courier/tslite/TSSyntax.java#L915-L917 |
109,319 | coursera/courier | generator-api/src/main/java/org/coursera/courier/api/CourierTemplateSpecGenerator.java | CourierTemplateSpecGenerator.allowCustomClass | private static boolean allowCustomClass(DataSchema schema)
{
boolean result = false;
final DataSchema.Type type = schema.getType();
if (type == DataSchema.Type.TYPEREF || type == DataSchema.Type.RECORD)
{
// allow custom class only if the dereferenced type is a record or a primitive types that a... | java | private static boolean allowCustomClass(DataSchema schema)
{
boolean result = false;
final DataSchema.Type type = schema.getType();
if (type == DataSchema.Type.TYPEREF || type == DataSchema.Type.RECORD)
{
// allow custom class only if the dereferenced type is a record or a primitive types that a... | [
"private",
"static",
"boolean",
"allowCustomClass",
"(",
"DataSchema",
"schema",
")",
"{",
"boolean",
"result",
"=",
"false",
";",
"final",
"DataSchema",
".",
"Type",
"type",
"=",
"schema",
".",
"getType",
"(",
")",
";",
"if",
"(",
"type",
"==",
"DataSchem... | Allow custom class to to bound to record or typeref of primitive types that are not enums. | [
"Allow",
"custom",
"class",
"to",
"to",
"bound",
"to",
"record",
"or",
"typeref",
"of",
"primitive",
"types",
"that",
"are",
"not",
"enums",
"."
] | 749674fa7ee33804ad11b6c8ecb560f455cb4c22 | https://github.com/coursera/courier/blob/749674fa7ee33804ad11b6c8ecb560f455cb4c22/generator-api/src/main/java/org/coursera/courier/api/CourierTemplateSpecGenerator.java#L226-L240 |
109,320 | coursera/courier | generator-api/src/main/java/org/coursera/courier/api/CourierTemplateSpecGenerator.java | CourierTemplateSpecGenerator.createFromDataSchema | private ClassTemplateSpec createFromDataSchema(DataSchema schema)
{
if (schema instanceof MapDataSchema)
{
return new CourierMapTemplateSpec((MapDataSchema) schema);
}
return ClassTemplateSpec.createFromDataSchema(schema);
} | java | private ClassTemplateSpec createFromDataSchema(DataSchema schema)
{
if (schema instanceof MapDataSchema)
{
return new CourierMapTemplateSpec((MapDataSchema) schema);
}
return ClassTemplateSpec.createFromDataSchema(schema);
} | [
"private",
"ClassTemplateSpec",
"createFromDataSchema",
"(",
"DataSchema",
"schema",
")",
"{",
"if",
"(",
"schema",
"instanceof",
"MapDataSchema",
")",
"{",
"return",
"new",
"CourierMapTemplateSpec",
"(",
"(",
"MapDataSchema",
")",
"schema",
")",
";",
"}",
"return... | For Courier, use CourierMapTemplateSpec for maps. | [
"For",
"Courier",
"use",
"CourierMapTemplateSpec",
"for",
"maps",
"."
] | 749674fa7ee33804ad11b6c8ecb560f455cb4c22 | https://github.com/coursera/courier/blob/749674fa7ee33804ad11b6c8ecb560f455cb4c22/generator-api/src/main/java/org/coursera/courier/api/CourierTemplateSpecGenerator.java#L877-L884 |
109,321 | coursera/courier | idea-plugin/src/org/coursera/courier/CourierBraceMatcher.java | CourierBraceMatcher.getPairs | @Override
public BracePair[] getPairs() {
return new BracePair[] {
new BracePair(CourierTypes.OPEN_BRACE, CourierTypes.CLOSE_BRACE, true),
new BracePair(CourierTypes.OPEN_BRACKET, CourierTypes.CLOSE_BRACKET, false),
new BracePair(CourierTypes.OPEN_PAREN, CourierTypes.CLOSE_PAREN, false)
//... | java | @Override
public BracePair[] getPairs() {
return new BracePair[] {
new BracePair(CourierTypes.OPEN_BRACE, CourierTypes.CLOSE_BRACE, true),
new BracePair(CourierTypes.OPEN_BRACKET, CourierTypes.CLOSE_BRACKET, false),
new BracePair(CourierTypes.OPEN_PAREN, CourierTypes.CLOSE_PAREN, false)
//... | [
"@",
"Override",
"public",
"BracePair",
"[",
"]",
"getPairs",
"(",
")",
"{",
"return",
"new",
"BracePair",
"[",
"]",
"{",
"new",
"BracePair",
"(",
"CourierTypes",
".",
"OPEN_BRACE",
",",
"CourierTypes",
".",
"CLOSE_BRACE",
",",
"true",
")",
",",
"new",
"... | Returns the array of definitions for brace pairs that need to be matched when
editing code in the language.
@return the array of brace pair definitions. | [
"Returns",
"the",
"array",
"of",
"definitions",
"for",
"brace",
"pairs",
"that",
"need",
"to",
"be",
"matched",
"when",
"editing",
"code",
"in",
"the",
"language",
"."
] | 749674fa7ee33804ad11b6c8ecb560f455cb4c22 | https://github.com/coursera/courier/blob/749674fa7ee33804ad11b6c8ecb560f455cb4c22/idea-plugin/src/org/coursera/courier/CourierBraceMatcher.java#L20-L28 |
109,322 | coursera/courier | schema-language/src/main/java/org/coursera/courier/grammar/CourierSchemaParser.java | CourierSchemaParser.parse | private String parse(DocumentContext document) throws ParseException {
if (document.namespaceDeclaration() != null) {
setCurrentNamespace(
document.namespaceDeclaration().qualifiedIdentifier().value);
} else {
setCurrentNamespace("");
}
setCurrentImports(document.importDeclarations(... | java | private String parse(DocumentContext document) throws ParseException {
if (document.namespaceDeclaration() != null) {
setCurrentNamespace(
document.namespaceDeclaration().qualifiedIdentifier().value);
} else {
setCurrentNamespace("");
}
setCurrentImports(document.importDeclarations(... | [
"private",
"String",
"parse",
"(",
"DocumentContext",
"document",
")",
"throws",
"ParseException",
"{",
"if",
"(",
"document",
".",
"namespaceDeclaration",
"(",
")",
"!=",
"null",
")",
"{",
"setCurrentNamespace",
"(",
"document",
".",
"namespaceDeclaration",
"(",
... | Parse list of Data objects.
The {{DataSchema}'s parsed are in {{#topLevelDataSchemas}.
Parse errors are in {{#errorMessageBuilder} and indicated
by {{#hasError()}.
@param document provides the source code in AST form | [
"Parse",
"list",
"of",
"Data",
"objects",
"."
] | 749674fa7ee33804ad11b6c8ecb560f455cb4c22 | https://github.com/coursera/courier/blob/749674fa7ee33804ad11b6c8ecb560f455cb4c22/schema-language/src/main/java/org/coursera/courier/grammar/CourierSchemaParser.java#L284-L296 |
109,323 | coursera/courier | schema-language/src/main/java/org/coursera/courier/grammar/CourierSchemaParser.java | CourierSchemaParser.addPropertiesAtPath | private void addPropertiesAtPath(
Map<String, Object> existingProperties, PropDeclarationContext prop) throws ParseException{
addPropertiesAtPath(prop, existingProperties, prop.path, parsePropValue(prop));
} | java | private void addPropertiesAtPath(
Map<String, Object> existingProperties, PropDeclarationContext prop) throws ParseException{
addPropertiesAtPath(prop, existingProperties, prop.path, parsePropValue(prop));
} | [
"private",
"void",
"addPropertiesAtPath",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"existingProperties",
",",
"PropDeclarationContext",
"prop",
")",
"throws",
"ParseException",
"{",
"addPropertiesAtPath",
"(",
"prop",
",",
"existingProperties",
",",
"prop",
".... | Adds additional properties to an existing properties map at the location identified by
the given PropDeclarationContexts path.
@param existingProperties provides the existing properties to add the additional properties to.
@param prop provides the ANTLR property AST node to add the properties for. | [
"Adds",
"additional",
"properties",
"to",
"an",
"existing",
"properties",
"map",
"at",
"the",
"location",
"identified",
"by",
"the",
"given",
"PropDeclarationContexts",
"path",
"."
] | 749674fa7ee33804ad11b6c8ecb560f455cb4c22 | https://github.com/coursera/courier/blob/749674fa7ee33804ad11b6c8ecb560f455cb4c22/schema-language/src/main/java/org/coursera/courier/grammar/CourierSchemaParser.java#L512-L515 |
109,324 | coursera/courier | schema-language/src/main/java/org/coursera/courier/grammar/CourierSchemaParser.java | CourierSchemaParser.addPropertiesAtPath | private void addPropertiesAtPath(
ParserRuleContext context,
Map<String, Object> existingProperties,
Iterable<String> path,
Object value) throws ParseException {
Map<String, Object> current = existingProperties;
Iterator<String> iter = path.iterator();
while (iter.hasNext()) {
... | java | private void addPropertiesAtPath(
ParserRuleContext context,
Map<String, Object> existingProperties,
Iterable<String> path,
Object value) throws ParseException {
Map<String, Object> current = existingProperties;
Iterator<String> iter = path.iterator();
while (iter.hasNext()) {
... | [
"private",
"void",
"addPropertiesAtPath",
"(",
"ParserRuleContext",
"context",
",",
"Map",
"<",
"String",
",",
"Object",
">",
"existingProperties",
",",
"Iterable",
"<",
"String",
">",
"path",
",",
"Object",
"value",
")",
"throws",
"ParseException",
"{",
"Map",
... | Adds additional properties to an existing properties map at the location identified by
the given path.
This allows for properties defined with paths such as:
{@literal @}a.b = "x"
{@literal @}a.c = "y"
to be merged together into a property map like:
{ "a": { "b": "x", "c": "y" }}
Examples:
<pre>
existing properti... | [
"Adds",
"additional",
"properties",
"to",
"an",
"existing",
"properties",
"map",
"at",
"the",
"location",
"identified",
"by",
"the",
"given",
"path",
"."
] | 749674fa7ee33804ad11b6c8ecb560f455cb4c22 | https://github.com/coursera/courier/blob/749674fa7ee33804ad11b6c8ecb560f455cb4c22/schema-language/src/main/java/org/coursera/courier/grammar/CourierSchemaParser.java#L553-L588 |
109,325 | coursera/courier | schema-language/src/main/java/org/coursera/courier/grammar/CourierSchemaParser.java | CourierSchemaParser.computeFullName | @Override
public String computeFullName(String name) {
String fullname;
DataSchema schema = DataSchemaUtil.typeStringToPrimitiveDataSchema(name);
if (schema != null)
{
fullname = name;
}
else if (Name.isFullName(name) || getCurrentNamespace().isEmpty())
{
fullname = name; // a... | java | @Override
public String computeFullName(String name) {
String fullname;
DataSchema schema = DataSchemaUtil.typeStringToPrimitiveDataSchema(name);
if (schema != null)
{
fullname = name;
}
else if (Name.isFullName(name) || getCurrentNamespace().isEmpty())
{
fullname = name; // a... | [
"@",
"Override",
"public",
"String",
"computeFullName",
"(",
"String",
"name",
")",
"{",
"String",
"fullname",
";",
"DataSchema",
"schema",
"=",
"DataSchemaUtil",
".",
"typeStringToPrimitiveDataSchema",
"(",
"name",
")",
";",
"if",
"(",
"schema",
"!=",
"null",
... | Extended fullname computation to handle imports | [
"Extended",
"fullname",
"computation",
"to",
"handle",
"imports"
] | 749674fa7ee33804ad11b6c8ecb560f455cb4c22 | https://github.com/coursera/courier/blob/749674fa7ee33804ad11b6c8ecb560f455cb4c22/schema-language/src/main/java/org/coursera/courier/grammar/CourierSchemaParser.java#L735-L756 |
109,326 | coursera/courier | schema-language/src/main/java/org/coursera/courier/grammar/ParseUtils.java | ParseUtils.toNumber | public static Number toNumber(String string) {
BigDecimal value = new BigDecimal(string);
try {
long l = value.longValueExact();
int i = (int) l;
if ((long) i == l) {
return i;
} else {
return l;
}
} catch (ArithmeticException e) {
double d = value.doubleV... | java | public static Number toNumber(String string) {
BigDecimal value = new BigDecimal(string);
try {
long l = value.longValueExact();
int i = (int) l;
if ((long) i == l) {
return i;
} else {
return l;
}
} catch (ArithmeticException e) {
double d = value.doubleV... | [
"public",
"static",
"Number",
"toNumber",
"(",
"String",
"string",
")",
"{",
"BigDecimal",
"value",
"=",
"new",
"BigDecimal",
"(",
"string",
")",
";",
"try",
"{",
"long",
"l",
"=",
"value",
".",
"longValueExact",
"(",
")",
";",
"int",
"i",
"=",
"(",
... | There must be a better way. | [
"There",
"must",
"be",
"a",
"better",
"way",
"."
] | 749674fa7ee33804ad11b6c8ecb560f455cb4c22 | https://github.com/coursera/courier/blob/749674fa7ee33804ad11b6c8ecb560f455cb4c22/schema-language/src/main/java/org/coursera/courier/grammar/ParseUtils.java#L88-L111 |
109,327 | coursera/courier | generator-api/src/main/java/org/coursera/courier/api/FileFormatDataSchemaParser.java | FileFormatDataSchemaParser.validateSchemaWithFilePath | private void validateSchemaWithFilePath(File schemaSourceFile, DataSchema schema)
{
if (schemaSourceFile != null && schemaSourceFile.isFile() && schema instanceof NamedDataSchema)
{
final NamedDataSchema namedDataSchema = (NamedDataSchema) schema;
final String namespace = namedDataSchema.getNamesp... | java | private void validateSchemaWithFilePath(File schemaSourceFile, DataSchema schema)
{
if (schemaSourceFile != null && schemaSourceFile.isFile() && schema instanceof NamedDataSchema)
{
final NamedDataSchema namedDataSchema = (NamedDataSchema) schema;
final String namespace = namedDataSchema.getNamesp... | [
"private",
"void",
"validateSchemaWithFilePath",
"(",
"File",
"schemaSourceFile",
",",
"DataSchema",
"schema",
")",
"{",
"if",
"(",
"schemaSourceFile",
"!=",
"null",
"&&",
"schemaSourceFile",
".",
"isFile",
"(",
")",
"&&",
"schema",
"instanceof",
"NamedDataSchema",
... | Checks that the schema name and namespace match the file name and path. These must match for FileDataSchemaResolver to find a schema pdscs by fully qualified name. | [
"Checks",
"that",
"the",
"schema",
"name",
"and",
"namespace",
"match",
"the",
"file",
"name",
"and",
"path",
".",
"These",
"must",
"match",
"for",
"FileDataSchemaResolver",
"to",
"find",
"a",
"schema",
"pdscs",
"by",
"fully",
"qualified",
"name",
"."
] | 749674fa7ee33804ad11b6c8ecb560f455cb4c22 | https://github.com/coursera/courier/blob/749674fa7ee33804ad11b6c8ecb560f455cb4c22/generator-api/src/main/java/org/coursera/courier/api/FileFormatDataSchemaParser.java#L195-L215 |
109,328 | coursera/courier | generator-api/src/main/java/org/coursera/courier/api/FileFormatDataSchemaParser.java | FileFormatDataSchemaParser.wasResolved | private boolean wasResolved(File schemaSourceFile)
{
final FileDataSchemaLocation schemaLocation = new FileDataSchemaLocation(schemaSourceFile);
return _schemaResolver.locationResolved(schemaLocation);
} | java | private boolean wasResolved(File schemaSourceFile)
{
final FileDataSchemaLocation schemaLocation = new FileDataSchemaLocation(schemaSourceFile);
return _schemaResolver.locationResolved(schemaLocation);
} | [
"private",
"boolean",
"wasResolved",
"(",
"File",
"schemaSourceFile",
")",
"{",
"final",
"FileDataSchemaLocation",
"schemaLocation",
"=",
"new",
"FileDataSchemaLocation",
"(",
"schemaSourceFile",
")",
";",
"return",
"_schemaResolver",
".",
"locationResolved",
"(",
"sche... | Whether a source file has already been resolved to data schemas.
@param schemaSourceFile provides the source file.
@return true if this source file has already been resolved to data schemas. | [
"Whether",
"a",
"source",
"file",
"has",
"already",
"been",
"resolved",
"to",
"data",
"schemas",
"."
] | 749674fa7ee33804ad11b6c8ecb560f455cb4c22 | https://github.com/coursera/courier/blob/749674fa7ee33804ad11b6c8ecb560f455cb4c22/generator-api/src/main/java/org/coursera/courier/api/FileFormatDataSchemaParser.java#L224-L228 |
109,329 | coursera/courier | generator-api/src/main/java/org/coursera/courier/api/FileFormatDataSchemaParser.java | FileFormatDataSchemaParser.parseSchema | private List<DataSchema> parseSchema(final File schemaSourceFile, CourierParseResult result)
throws IOException
{
SchemaParser parser = _schemaParserFactory.create(_schemaResolver);
final FileInputStream schemaStream = new SchemaFileInputStream(schemaSourceFile);
try
{
parser.setLocation(n... | java | private List<DataSchema> parseSchema(final File schemaSourceFile, CourierParseResult result)
throws IOException
{
SchemaParser parser = _schemaParserFactory.create(_schemaResolver);
final FileInputStream schemaStream = new SchemaFileInputStream(schemaSourceFile);
try
{
parser.setLocation(n... | [
"private",
"List",
"<",
"DataSchema",
">",
"parseSchema",
"(",
"final",
"File",
"schemaSourceFile",
",",
"CourierParseResult",
"result",
")",
"throws",
"IOException",
"{",
"SchemaParser",
"parser",
"=",
"_schemaParserFactory",
".",
"create",
"(",
"_schemaResolver",
... | Parse a source file to obtain the data schemas contained within.
@param schemaSourceFile provides the source file.
@param result {@link ParseResult} to update.
@return the data schemas within the source file.
@throws IOException if there is a file access error. | [
"Parse",
"a",
"source",
"file",
"to",
"obtain",
"the",
"data",
"schemas",
"contained",
"within",
"."
] | 749674fa7ee33804ad11b6c8ecb560f455cb4c22 | https://github.com/coursera/courier/blob/749674fa7ee33804ad11b6c8ecb560f455cb4c22/generator-api/src/main/java/org/coursera/courier/api/FileFormatDataSchemaParser.java#L241-L265 |
109,330 | coursera/courier | swift/generator/src/main/java/org/coursera/courier/swift/SwiftSyntax.java | SwiftSyntax.escapeKeyword | public static String escapeKeyword(String symbol) {
if (swiftKeywords.contains(symbol)) {
return "`" + symbol + "`";
} else if (reservedSymbols.contains(symbol)) {
return symbol + "$";
} else {
return symbol;
}
} | java | public static String escapeKeyword(String symbol) {
if (swiftKeywords.contains(symbol)) {
return "`" + symbol + "`";
} else if (reservedSymbols.contains(symbol)) {
return symbol + "$";
} else {
return symbol;
}
} | [
"public",
"static",
"String",
"escapeKeyword",
"(",
"String",
"symbol",
")",
"{",
"if",
"(",
"swiftKeywords",
".",
"contains",
"(",
"symbol",
")",
")",
"{",
"return",
"\"`\"",
"+",
"symbol",
"+",
"\"`\"",
";",
"}",
"else",
"if",
"(",
"reservedSymbols",
"... | Returns the escaped Pegasus symbol for use in Swift source code.
Pegasus symbols must be of the form [A-Za-z_], so this routine simply checks if the
symbol collides with a swift keyword, and if so, escapes it.
(Because only fields are generated, symbols like hashCode do not collide with method names
from Object and m... | [
"Returns",
"the",
"escaped",
"Pegasus",
"symbol",
"for",
"use",
"in",
"Swift",
"source",
"code",
"."
] | 749674fa7ee33804ad11b6c8ecb560f455cb4c22 | https://github.com/coursera/courier/blob/749674fa7ee33804ad11b6c8ecb560f455cb4c22/swift/generator/src/main/java/org/coursera/courier/swift/SwiftSyntax.java#L97-L105 |
109,331 | coursera/courier | swift/generator/src/main/java/org/coursera/courier/swift/SwiftSyntax.java | SwiftSyntax.toTypeString | private String toTypeString(ClassTemplateSpec spec) {
// If we're supporting projections, all fields, even required ones, may be absent.
// To support this, we box all primitive field types.
if (spec.getSchema() == null) { // custom type
return escapedFullname(spec);
}
Type schemaType = spec.g... | java | private String toTypeString(ClassTemplateSpec spec) {
// If we're supporting projections, all fields, even required ones, may be absent.
// To support this, we box all primitive field types.
if (spec.getSchema() == null) { // custom type
return escapedFullname(spec);
}
Type schemaType = spec.g... | [
"private",
"String",
"toTypeString",
"(",
"ClassTemplateSpec",
"spec",
")",
"{",
"// If we're supporting projections, all fields, even required ones, may be absent.",
"// To support this, we box all primitive field types.",
"if",
"(",
"spec",
".",
"getSchema",
"(",
")",
"==",
"nu... | emit string representing type | [
"emit",
"string",
"representing",
"type"
] | 749674fa7ee33804ad11b6c8ecb560f455cb4c22 | https://github.com/coursera/courier/blob/749674fa7ee33804ad11b6c8ecb560f455cb4c22/swift/generator/src/main/java/org/coursera/courier/swift/SwiftSyntax.java#L164-L200 |
109,332 | coursera/courier | swift/generator/src/main/java/org/coursera/courier/swift/SwiftDocEscaping.java | SwiftDocEscaping.stringToDocComment | public static String stringToDocComment(String doc) {
boolean emptyDoc = (doc == null || doc.trim().isEmpty());
if (emptyDoc) return "";
return DocEscaping.stringToDocComment(doc, DocCommentStyle.NO_MARGIN);
} | java | public static String stringToDocComment(String doc) {
boolean emptyDoc = (doc == null || doc.trim().isEmpty());
if (emptyDoc) return "";
return DocEscaping.stringToDocComment(doc, DocCommentStyle.NO_MARGIN);
} | [
"public",
"static",
"String",
"stringToDocComment",
"(",
"String",
"doc",
")",
"{",
"boolean",
"emptyDoc",
"=",
"(",
"doc",
"==",
"null",
"||",
"doc",
".",
"trim",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
";",
"if",
"(",
"emptyDoc",
")",
"return",
"\... | Returns a doc comment, as a string of Swift source, for the given documentation string.
@param doc provides the javadoc for the symbol, if any. May be null.
@return an escaped doc comment string. | [
"Returns",
"a",
"doc",
"comment",
"as",
"a",
"string",
"of",
"Swift",
"source",
"for",
"the",
"given",
"documentation",
"string",
"."
] | 749674fa7ee33804ad11b6c8ecb560f455cb4c22 | https://github.com/coursera/courier/blob/749674fa7ee33804ad11b6c8ecb560f455cb4c22/swift/generator/src/main/java/org/coursera/courier/swift/SwiftDocEscaping.java#L29-L34 |
109,333 | coursera/courier | idea-plugin/src/org/coursera/courier/CourierScalaToCourierAction.java | CourierScalaToCourierAction.getScalaClassName | private String getScalaClassName(PsiClass c) {
String baseName = c.getName();
return baseName.replaceAll("\\$", "");
} | java | private String getScalaClassName(PsiClass c) {
String baseName = c.getName();
return baseName.replaceAll("\\$", "");
} | [
"private",
"String",
"getScalaClassName",
"(",
"PsiClass",
"c",
")",
"{",
"String",
"baseName",
"=",
"c",
".",
"getName",
"(",
")",
";",
"return",
"baseName",
".",
"replaceAll",
"(",
"\"\\\\$\"",
",",
"\"\"",
")",
";",
"}"
] | Given a Java class or a Scala class OR object, gets the underlying class name.
Object names have $ appended | [
"Given",
"a",
"Java",
"class",
"or",
"a",
"Scala",
"class",
"OR",
"object",
"gets",
"the",
"underlying",
"class",
"name",
"."
] | 749674fa7ee33804ad11b6c8ecb560f455cb4c22 | https://github.com/coursera/courier/blob/749674fa7ee33804ad11b6c8ecb560f455cb4c22/idea-plugin/src/org/coursera/courier/CourierScalaToCourierAction.java#L71-L74 |
109,334 | coursera/courier | idea-plugin/src/org/coursera/courier/psi/CourierFile.java | CourierFile.addFirstImport | private CourierImportDeclarations addFirstImport(CourierImportDeclaration importDecl) {
TypeName first = importDecl.getFullname();
CourierTopLevel root = getRoot();
CourierImportDeclarations importDecls = root.getImportDeclarations();
if (importDecls.getImportDeclarationList().size() == 0) {
impor... | java | private CourierImportDeclarations addFirstImport(CourierImportDeclaration importDecl) {
TypeName first = importDecl.getFullname();
CourierTopLevel root = getRoot();
CourierImportDeclarations importDecls = root.getImportDeclarations();
if (importDecls.getImportDeclarationList().size() == 0) {
impor... | [
"private",
"CourierImportDeclarations",
"addFirstImport",
"(",
"CourierImportDeclaration",
"importDecl",
")",
"{",
"TypeName",
"first",
"=",
"importDecl",
".",
"getFullname",
"(",
")",
";",
"CourierTopLevel",
"root",
"=",
"getRoot",
"(",
")",
";",
"CourierImportDeclar... | Position imports correctly when adding the first import. | [
"Position",
"imports",
"correctly",
"when",
"adding",
"the",
"first",
"import",
"."
] | 749674fa7ee33804ad11b6c8ecb560f455cb4c22 | https://github.com/coursera/courier/blob/749674fa7ee33804ad11b6c8ecb560f455cb4c22/idea-plugin/src/org/coursera/courier/psi/CourierFile.java#L70-L94 |
109,335 | coursera/courier | idea-plugin/src/org/coursera/courier/psi/CourierFile.java | CourierFile.addNthImport | private CourierImportDeclarations addNthImport(CourierImportDeclaration importDecl) {
CourierTopLevel root = getRoot();
CourierImportDeclarations importDecls = root.getImportDeclarations();
if (importDecl.getFullname() == null) {
return importDecls;
}
boolean added = false;
for (CourierIm... | java | private CourierImportDeclarations addNthImport(CourierImportDeclaration importDecl) {
CourierTopLevel root = getRoot();
CourierImportDeclarations importDecls = root.getImportDeclarations();
if (importDecl.getFullname() == null) {
return importDecls;
}
boolean added = false;
for (CourierIm... | [
"private",
"CourierImportDeclarations",
"addNthImport",
"(",
"CourierImportDeclaration",
"importDecl",
")",
"{",
"CourierTopLevel",
"root",
"=",
"getRoot",
"(",
")",
";",
"CourierImportDeclarations",
"importDecls",
"=",
"root",
".",
"getImportDeclarations",
"(",
")",
";... | Add an import to an existing import list, attempting to keep the list sorted.
Note: this does not change the sort order of the existing import list. It only attempts
to keep the list sorted if it already is by adding the import at the correct position. | [
"Add",
"an",
"import",
"to",
"an",
"existing",
"import",
"list",
"attempting",
"to",
"keep",
"the",
"list",
"sorted",
"."
] | 749674fa7ee33804ad11b6c8ecb560f455cb4c22 | https://github.com/coursera/courier/blob/749674fa7ee33804ad11b6c8ecb560f455cb4c22/idea-plugin/src/org/coursera/courier/psi/CourierFile.java#L103-L122 |
109,336 | coursera/courier | generator-api/src/main/java/org/coursera/courier/lang/DocEscaping.java | DocEscaping.stringToDocComment | public static String stringToDocComment(String doc, DocCommentStyle style) {
if (doc == null || doc.trim().isEmpty()) return "";
String commentNewline = (style == DocCommentStyle.ASTRISK_MARGIN) ? "\n * " : "\n";
String schemadoc = wrap(escape(doc)).replaceAll("\\n", commentNewline);
StringBuilder buil... | java | public static String stringToDocComment(String doc, DocCommentStyle style) {
if (doc == null || doc.trim().isEmpty()) return "";
String commentNewline = (style == DocCommentStyle.ASTRISK_MARGIN) ? "\n * " : "\n";
String schemadoc = wrap(escape(doc)).replaceAll("\\n", commentNewline);
StringBuilder buil... | [
"public",
"static",
"String",
"stringToDocComment",
"(",
"String",
"doc",
",",
"DocCommentStyle",
"style",
")",
"{",
"if",
"(",
"doc",
"==",
"null",
"||",
"doc",
".",
"trim",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
"return",
"\"\"",
";",
"String",
"co... | Returns a doc comment, as a string of source, for the given documentation string
and deprecated property.
@param doc provides the schemadoc for the symbol, if any. May be null.
@return an escaped schemadoc string. | [
"Returns",
"a",
"doc",
"comment",
"as",
"a",
"string",
"of",
"source",
"for",
"the",
"given",
"documentation",
"string",
"and",
"deprecated",
"property",
"."
] | 749674fa7ee33804ad11b6c8ecb560f455cb4c22 | https://github.com/coursera/courier/blob/749674fa7ee33804ad11b6c8ecb560f455cb4c22/generator-api/src/main/java/org/coursera/courier/lang/DocEscaping.java#L30-L42 |
109,337 | coursera/courier | android/generator/src/main/java/org/coursera/courier/android/JavadocEscaping.java | JavadocEscaping.stringToJavadoc | public static String stringToJavadoc(String doc, Object deprecatedProp) {
boolean emptyDoc = (doc == null || doc.trim().isEmpty());
boolean emptyDeprecated = (deprecatedProp == null || !(deprecatedProp instanceof String));
if (emptyDoc && emptyDeprecated) return "";
String javadocBody = emptyDoc ? "" ... | java | public static String stringToJavadoc(String doc, Object deprecatedProp) {
boolean emptyDoc = (doc == null || doc.trim().isEmpty());
boolean emptyDeprecated = (deprecatedProp == null || !(deprecatedProp instanceof String));
if (emptyDoc && emptyDeprecated) return "";
String javadocBody = emptyDoc ? "" ... | [
"public",
"static",
"String",
"stringToJavadoc",
"(",
"String",
"doc",
",",
"Object",
"deprecatedProp",
")",
"{",
"boolean",
"emptyDoc",
"=",
"(",
"doc",
"==",
"null",
"||",
"doc",
".",
"trim",
"(",
")",
".",
"isEmpty",
"(",
")",
")",
";",
"boolean",
"... | Returns a javadoc comment, as a string of java source, for the given documentation string
and deprecated property.
@param doc provides the javadoc for the symbol, if any. May be null.
@param deprecatedProp provides the deprecated Pegasus schema property, if any. May be a
Boolean, a String, or null.
@return an escape... | [
"Returns",
"a",
"javadoc",
"comment",
"as",
"a",
"string",
"of",
"java",
"source",
"for",
"the",
"given",
"documentation",
"string",
"and",
"deprecated",
"property",
"."
] | 749674fa7ee33804ad11b6c8ecb560f455cb4c22 | https://github.com/coursera/courier/blob/749674fa7ee33804ad11b6c8ecb560f455cb4c22/android/generator/src/main/java/org/coursera/courier/android/JavadocEscaping.java#L34-L45 |
109,338 | coursera/courier | android/generator/src/main/java/org/coursera/courier/android/JavaSyntax.java | JavaSyntax.hashCodeList | public String hashCodeList(List<RecordTemplateSpec.Field> fields) {
StringBuilder sb = new StringBuilder();
Iterator<RecordTemplateSpec.Field> iter = fields.iterator();
while(iter.hasNext()) {
RecordTemplateSpec.Field field = iter.next();
Type schemaType = field.getSchemaField().getType().getTyp... | java | public String hashCodeList(List<RecordTemplateSpec.Field> fields) {
StringBuilder sb = new StringBuilder();
Iterator<RecordTemplateSpec.Field> iter = fields.iterator();
while(iter.hasNext()) {
RecordTemplateSpec.Field field = iter.next();
Type schemaType = field.getSchemaField().getType().getTyp... | [
"public",
"String",
"hashCodeList",
"(",
"List",
"<",
"RecordTemplateSpec",
".",
"Field",
">",
"fields",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"Iterator",
"<",
"RecordTemplateSpec",
".",
"Field",
">",
"iter",
"=",
"fiel... | Returns Java source code that computes the hashCodes of each of the fields, as a list of
parameters.
This is the same as {@link #fieldList} except when the fields are Java arrays, in which
case they are wrapped with a utilty method to hash them correctly. E.g.
<code>
intField, stringField, mapField, Arrays.deepHashC... | [
"Returns",
"Java",
"source",
"code",
"that",
"computes",
"the",
"hashCodes",
"of",
"each",
"of",
"the",
"fields",
"as",
"a",
"list",
"of",
"parameters",
"."
] | 749674fa7ee33804ad11b6c8ecb560f455cb4c22 | https://github.com/coursera/courier/blob/749674fa7ee33804ad11b6c8ecb560f455cb4c22/android/generator/src/main/java/org/coursera/courier/android/JavaSyntax.java#L293-L303 |
109,339 | coursera/courier | generator-api/src/main/java/org/coursera/courier/api/ClassTemplateSpecs.java | ClassTemplateSpecs.allReferencedTypes | public static Set<ClassTemplateSpec> allReferencedTypes(ClassTemplateSpec spec) {
return findAllReferencedTypes(
directReferencedTypes(spec),
Collections.<ClassTemplateSpec>emptySet(),
Collections.<ClassTemplateSpec>emptySet());
} | java | public static Set<ClassTemplateSpec> allReferencedTypes(ClassTemplateSpec spec) {
return findAllReferencedTypes(
directReferencedTypes(spec),
Collections.<ClassTemplateSpec>emptySet(),
Collections.<ClassTemplateSpec>emptySet());
} | [
"public",
"static",
"Set",
"<",
"ClassTemplateSpec",
">",
"allReferencedTypes",
"(",
"ClassTemplateSpec",
"spec",
")",
"{",
"return",
"findAllReferencedTypes",
"(",
"directReferencedTypes",
"(",
"spec",
")",
",",
"Collections",
".",
"<",
"ClassTemplateSpec",
">",
"e... | Return all types directly or transitively referenced by this type. | [
"Return",
"all",
"types",
"directly",
"or",
"transitively",
"referenced",
"by",
"this",
"type",
"."
] | 749674fa7ee33804ad11b6c8ecb560f455cb4c22 | https://github.com/coursera/courier/blob/749674fa7ee33804ad11b6c8ecb560f455cb4c22/generator-api/src/main/java/org/coursera/courier/api/ClassTemplateSpecs.java#L113-L118 |
109,340 | coursera/courier | generator-api/src/main/java/org/coursera/courier/api/ClassTemplateSpecs.java | ClassTemplateSpecs.findAllReferencedTypes | private static Set<ClassTemplateSpec> findAllReferencedTypes(
Set<ClassTemplateSpec> current,
Set<ClassTemplateSpec> visited,
Set<ClassTemplateSpec> acc) {
//val nextUnvisited = current.flatMap(_.directReferencedTypes).filterNot(visited.contains);
Set<ClassTemplateSpec> nextUnvisited = new Ha... | java | private static Set<ClassTemplateSpec> findAllReferencedTypes(
Set<ClassTemplateSpec> current,
Set<ClassTemplateSpec> visited,
Set<ClassTemplateSpec> acc) {
//val nextUnvisited = current.flatMap(_.directReferencedTypes).filterNot(visited.contains);
Set<ClassTemplateSpec> nextUnvisited = new Ha... | [
"private",
"static",
"Set",
"<",
"ClassTemplateSpec",
">",
"findAllReferencedTypes",
"(",
"Set",
"<",
"ClassTemplateSpec",
">",
"current",
",",
"Set",
"<",
"ClassTemplateSpec",
">",
"visited",
",",
"Set",
"<",
"ClassTemplateSpec",
">",
"acc",
")",
"{",
"//val ne... | traverses the directReferencedTypes graph, keeping track of already visited ClassTemplateSpecs | [
"traverses",
"the",
"directReferencedTypes",
"graph",
"keeping",
"track",
"of",
"already",
"visited",
"ClassTemplateSpecs"
] | 749674fa7ee33804ad11b6c8ecb560f455cb4c22 | https://github.com/coursera/courier/blob/749674fa7ee33804ad11b6c8ecb560f455cb4c22/generator-api/src/main/java/org/coursera/courier/api/ClassTemplateSpecs.java#L121-L147 |
109,341 | guardtime/ksi-java-sdk | ksi-blocksigner/src/main/java/com/guardtime/ksi/tree/BlindingMaskLinkingHashTreeBuilder.java | BlindingMaskLinkingHashTreeBuilder.add | @Override
public void add(ImprintNode node) {
Util.notNull(node, "Node");
if (node.getLevel() != 0) {
throw new IllegalArgumentException("ImprintNode with level greater than 0 is not supported by BlindingMaskLinkingHashTreeBuilder");
}
ImprintNode newNode = calculateNewNo... | java | @Override
public void add(ImprintNode node) {
Util.notNull(node, "Node");
if (node.getLevel() != 0) {
throw new IllegalArgumentException("ImprintNode with level greater than 0 is not supported by BlindingMaskLinkingHashTreeBuilder");
}
ImprintNode newNode = calculateNewNo... | [
"@",
"Override",
"public",
"void",
"add",
"(",
"ImprintNode",
"node",
")",
"{",
"Util",
".",
"notNull",
"(",
"node",
",",
"\"Node\"",
")",
";",
"if",
"(",
"node",
".",
"getLevel",
"(",
")",
"!=",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException... | Adds a new node to the tree.
@param node a leaf to add to the tree, must not be null. The level of the node must be 0.
@throws IllegalArgumentException if node level is greater than 0. | [
"Adds",
"a",
"new",
"node",
"to",
"the",
"tree",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-blocksigner/src/main/java/com/guardtime/ksi/tree/BlindingMaskLinkingHashTreeBuilder.java#L129-L138 |
109,342 | guardtime/ksi-java-sdk | ksi-blocksigner/src/main/java/com/guardtime/ksi/tree/BlindingMaskLinkingHashTreeBuilder.java | BlindingMaskLinkingHashTreeBuilder.calculateHeight | @Override
public long calculateHeight(ImprintNode node) {
Util.notNull(node, "Node");
return hashTreeBuilder.calculateHeight(calculateNewNode(node));
} | java | @Override
public long calculateHeight(ImprintNode node) {
Util.notNull(node, "Node");
return hashTreeBuilder.calculateHeight(calculateNewNode(node));
} | [
"@",
"Override",
"public",
"long",
"calculateHeight",
"(",
"ImprintNode",
"node",
")",
"{",
"Util",
".",
"notNull",
"(",
"node",
",",
"\"Node\"",
")",
";",
"return",
"hashTreeBuilder",
".",
"calculateHeight",
"(",
"calculateNewNode",
"(",
"node",
")",
")",
"... | Calculates the binary tree height if new leaf would be added.
@param node a leaf to be added to the tree, must not be null. The level of the node must be 0.
@return Hash tree height.
@throws IllegalArgumentException if node level is greater than 0. | [
"Calculates",
"the",
"binary",
"tree",
"height",
"if",
"new",
"leaf",
"would",
"be",
"added",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-blocksigner/src/main/java/com/guardtime/ksi/tree/BlindingMaskLinkingHashTreeBuilder.java#L156-L160 |
109,343 | guardtime/ksi-java-sdk | ksi-blocksigner/src/main/java/com/guardtime/ksi/tree/BlindingMaskLinkingHashTreeBuilder.java | BlindingMaskLinkingHashTreeBuilder.add | @Override
public void add(ImprintNode... nodes) {
Util.notNull(nodes, "Nodes");
for (ImprintNode node : nodes) {
add(node);
}
} | java | @Override
public void add(ImprintNode... nodes) {
Util.notNull(nodes, "Nodes");
for (ImprintNode node : nodes) {
add(node);
}
} | [
"@",
"Override",
"public",
"void",
"add",
"(",
"ImprintNode",
"...",
"nodes",
")",
"{",
"Util",
".",
"notNull",
"(",
"nodes",
",",
"\"Nodes\"",
")",
";",
"for",
"(",
"ImprintNode",
"node",
":",
"nodes",
")",
"{",
"add",
"(",
"node",
")",
";",
"}",
... | Adds a new list of leaves to the binary tree.
@param nodes a list of leaves to be added to the tree, must not be null.
@throws IllegalArgumentException if node level is greater than 0. | [
"Adds",
"a",
"new",
"list",
"of",
"leaves",
"to",
"the",
"binary",
"tree",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-blocksigner/src/main/java/com/guardtime/ksi/tree/BlindingMaskLinkingHashTreeBuilder.java#L177-L183 |
109,344 | guardtime/ksi-java-sdk | ksi-service-ha/src/main/java/com/guardtime/ksi/service/ha/SigningHAServiceConfigurationListener.java | SigningHAServiceConfigurationListener.getAggregationConfiguration | Future<AggregatorConfiguration> getAggregationConfiguration() {
return new HAConfFuture<>(invokeSubServiceConfUpdates(),
new HAConfFuture.ConfResultSupplier<ConsolidatedResult<AggregatorConfiguration>>() {
public ConsolidatedResult<AggregatorConfiguration> get() {
... | java | Future<AggregatorConfiguration> getAggregationConfiguration() {
return new HAConfFuture<>(invokeSubServiceConfUpdates(),
new HAConfFuture.ConfResultSupplier<ConsolidatedResult<AggregatorConfiguration>>() {
public ConsolidatedResult<AggregatorConfiguration> get() {
... | [
"Future",
"<",
"AggregatorConfiguration",
">",
"getAggregationConfiguration",
"(",
")",
"{",
"return",
"new",
"HAConfFuture",
"<>",
"(",
"invokeSubServiceConfUpdates",
"(",
")",
",",
"new",
"HAConfFuture",
".",
"ConfResultSupplier",
"<",
"ConsolidatedResult",
"<",
"Ag... | Gets the aggregator's configuration. Invokes configuration updates for all the subclients.
@return {@link Future} which eventually provides subconfiguration's consolidation result. | [
"Gets",
"the",
"aggregator",
"s",
"configuration",
".",
"Invokes",
"configuration",
"updates",
"for",
"all",
"the",
"subclients",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-service-ha/src/main/java/com/guardtime/ksi/service/ha/SigningHAServiceConfigurationListener.java#L70-L77 |
109,345 | guardtime/ksi-java-sdk | ksi-api/src/main/java/com/guardtime/ksi/publication/inmemory/InMemoryPublicationsFileFactory.java | InMemoryPublicationsFileFactory.create | public PublicationsFile create(InputStream input) throws KSIException {
InMemoryPublicationsFile publicationsFile = new InMemoryPublicationsFile(input);
CMSSignature signature = publicationsFile.getSignature();
CMSSignatureVerifier verifier = new CMSSignatureVerifier(trustStore);
verifi... | java | public PublicationsFile create(InputStream input) throws KSIException {
InMemoryPublicationsFile publicationsFile = new InMemoryPublicationsFile(input);
CMSSignature signature = publicationsFile.getSignature();
CMSSignatureVerifier verifier = new CMSSignatureVerifier(trustStore);
verifi... | [
"public",
"PublicationsFile",
"create",
"(",
"InputStream",
"input",
")",
"throws",
"KSIException",
"{",
"InMemoryPublicationsFile",
"publicationsFile",
"=",
"new",
"InMemoryPublicationsFile",
"(",
"input",
")",
";",
"CMSSignature",
"signature",
"=",
"publicationsFile",
... | This method is used to read publications file from input stream. Input stream must be present and must be signed
by trusted PKI certificate.
@param input
input stream to be used to read publications file data
@return returns instance of {@link PublicationsFile}
@throws KSIException
when error occurs | [
"This",
"method",
"is",
"used",
"to",
"read",
"publications",
"file",
"from",
"input",
"stream",
".",
"Input",
"stream",
"must",
"be",
"present",
"and",
"must",
"be",
"signed",
"by",
"trusted",
"PKI",
"certificate",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-api/src/main/java/com/guardtime/ksi/publication/inmemory/InMemoryPublicationsFileFactory.java#L58-L65 |
109,346 | guardtime/ksi-java-sdk | ksi-api/src/main/java/com/guardtime/ksi/unisignature/inmemory/InMemoryKsiSignature.java | InMemoryKsiSignature.calculateCalendarHashChainOutput | private void calculateCalendarHashChainOutput() throws KSIException {
ChainResult lastRes = null;
for (AggregationHashChain chain : aggregationChains) {
if (lastRes == null) {
lastRes = chain.calculateOutputHash(0L);
} else {
lastRes = chain.calcul... | java | private void calculateCalendarHashChainOutput() throws KSIException {
ChainResult lastRes = null;
for (AggregationHashChain chain : aggregationChains) {
if (lastRes == null) {
lastRes = chain.calculateOutputHash(0L);
} else {
lastRes = chain.calcul... | [
"private",
"void",
"calculateCalendarHashChainOutput",
"(",
")",
"throws",
"KSIException",
"{",
"ChainResult",
"lastRes",
"=",
"null",
";",
"for",
"(",
"AggregationHashChain",
"chain",
":",
"aggregationChains",
")",
"{",
"if",
"(",
"lastRes",
"==",
"null",
")",
... | This method is used to verify signature consistency. | [
"This",
"method",
"is",
"used",
"to",
"verify",
"signature",
"consistency",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-api/src/main/java/com/guardtime/ksi/unisignature/inmemory/InMemoryKsiSignature.java#L140-L150 |
109,347 | guardtime/ksi-java-sdk | ksi-api/src/main/java/com/guardtime/ksi/unisignature/inmemory/InMemoryKsiSignature.java | InMemoryKsiSignature.sortAggregationHashChains | private List<AggregationHashChain> sortAggregationHashChains(List<AggregationHashChain> chains) throws InvalidSignatureException {
Collections.sort(chains, new Comparator<AggregationHashChain>() {
public int compare(AggregationHashChain chain1, AggregationHashChain chain2) {
return c... | java | private List<AggregationHashChain> sortAggregationHashChains(List<AggregationHashChain> chains) throws InvalidSignatureException {
Collections.sort(chains, new Comparator<AggregationHashChain>() {
public int compare(AggregationHashChain chain1, AggregationHashChain chain2) {
return c... | [
"private",
"List",
"<",
"AggregationHashChain",
">",
"sortAggregationHashChains",
"(",
"List",
"<",
"AggregationHashChain",
">",
"chains",
")",
"throws",
"InvalidSignatureException",
"{",
"Collections",
".",
"sort",
"(",
"chains",
",",
"new",
"Comparator",
"<",
"Agg... | Orders aggregation chains.
@param chains
aggregation chains to be ordered.
@return ordered list of aggregation chains | [
"Orders",
"aggregation",
"chains",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-api/src/main/java/com/guardtime/ksi/unisignature/inmemory/InMemoryKsiSignature.java#L230-L237 |
109,348 | guardtime/ksi-java-sdk | ksi-service-client/src/main/java/com/guardtime/ksi/pdu/v1/AbstractKSIResponse.java | AbstractKSIResponse.validateMac | private void validateMac(byte[] key, HashAlgorithm hmacAlgorithm) throws KSIException {
try {
HashAlgorithm receivedHmacAlgorithm = mac.getAlgorithm();
if (receivedHmacAlgorithm != hmacAlgorithm) {
throw new KSIException(
"HMAC algorithm mismatch. ... | java | private void validateMac(byte[] key, HashAlgorithm hmacAlgorithm) throws KSIException {
try {
HashAlgorithm receivedHmacAlgorithm = mac.getAlgorithm();
if (receivedHmacAlgorithm != hmacAlgorithm) {
throw new KSIException(
"HMAC algorithm mismatch. ... | [
"private",
"void",
"validateMac",
"(",
"byte",
"[",
"]",
"key",
",",
"HashAlgorithm",
"hmacAlgorithm",
")",
"throws",
"KSIException",
"{",
"try",
"{",
"HashAlgorithm",
"receivedHmacAlgorithm",
"=",
"mac",
".",
"getAlgorithm",
"(",
")",
";",
"if",
"(",
"receive... | Checks the MAC code.
@param key
key to be used to calculate MAC code.
@param hmacAlgorithm
algorithm for verifying the HMAC of incoming messages.
@throws KSIException
when MAC code doesn't validate | [
"Checks",
"the",
"MAC",
"code",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-service-client/src/main/java/com/guardtime/ksi/pdu/v1/AbstractKSIResponse.java#L147-L168 |
109,349 | guardtime/ksi-java-sdk | ksi-service-client/src/main/java/com/guardtime/ksi/pdu/v1/AbstractKSIResponse.java | AbstractKSIResponse.throwErrorPayloadException | private void throwErrorPayloadException(TLVElement child) throws KSIException {
TLVElement errorCodeElement = child.getFirstChildElement(ELEMENT_TYPE_ERROR_CODE);
TLVElement messageElement = child.getFirstChildElement(ELEMENT_TYPE_ERROR_MESSAGE);
throw new KSIProtocolException(errorCodeElement.g... | java | private void throwErrorPayloadException(TLVElement child) throws KSIException {
TLVElement errorCodeElement = child.getFirstChildElement(ELEMENT_TYPE_ERROR_CODE);
TLVElement messageElement = child.getFirstChildElement(ELEMENT_TYPE_ERROR_MESSAGE);
throw new KSIProtocolException(errorCodeElement.g... | [
"private",
"void",
"throwErrorPayloadException",
"(",
"TLVElement",
"child",
")",
"throws",
"KSIException",
"{",
"TLVElement",
"errorCodeElement",
"=",
"child",
".",
"getFirstChildElement",
"(",
"ELEMENT_TYPE_ERROR_CODE",
")",
";",
"TLVElement",
"messageElement",
"=",
"... | Reads error code and error message elements from given TLV element and throws KSI protocol exception containing
error information.
@param child
KSI protocol error element.
@throws KSIProtocolException
will always be thrown. | [
"Reads",
"error",
"code",
"and",
"error",
"message",
"elements",
"from",
"given",
"TLV",
"element",
"and",
"throws",
"KSI",
"protocol",
"exception",
"containing",
"error",
"information",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-service-client/src/main/java/com/guardtime/ksi/pdu/v1/AbstractKSIResponse.java#L179-L184 |
109,350 | guardtime/ksi-java-sdk | ksi-api/src/main/java/com/guardtime/ksi/unisignature/verifier/rules/CalendarHashChainRegistrationTimeRule.java | CalendarHashChainRegistrationTimeRule.calculateRegistrationTime | private Date calculateRegistrationTime(CalendarHashChain calendarHashChain) throws InvalidCalendarHashChainException {
List<CalendarHashChainLink> chain = calendarHashChain.getChainLinks();
long r = calendarHashChain.getPublicationTime().getTime() / 1000; // publication time in seconds
long t = ... | java | private Date calculateRegistrationTime(CalendarHashChain calendarHashChain) throws InvalidCalendarHashChainException {
List<CalendarHashChainLink> chain = calendarHashChain.getChainLinks();
long r = calendarHashChain.getPublicationTime().getTime() / 1000; // publication time in seconds
long t = ... | [
"private",
"Date",
"calculateRegistrationTime",
"(",
"CalendarHashChain",
"calendarHashChain",
")",
"throws",
"InvalidCalendarHashChainException",
"{",
"List",
"<",
"CalendarHashChainLink",
">",
"chain",
"=",
"calendarHashChain",
".",
"getChainLinks",
"(",
")",
";",
"long... | Calculates the time when the signature was registered in the KSI hash calendar. | [
"Calculates",
"the",
"time",
"when",
"the",
"signature",
"was",
"registered",
"in",
"the",
"KSI",
"hash",
"calendar",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-api/src/main/java/com/guardtime/ksi/unisignature/verifier/rules/CalendarHashChainRegistrationTimeRule.java#L67-L95 |
109,351 | guardtime/ksi-java-sdk | ksi-api/src/main/java/com/guardtime/ksi/unisignature/inmemory/InMemoryAggregationHashChain.java | InMemoryAggregationHashChain.calculateOutputHash | public final ChainResult calculateOutputHash(long level) throws KSIException {
// TODO task KSIJAVAAPI-207 If the aggregation hash chain component contains the `input data' field, hash the value part of the field
// using the hash algorithm specified by the first octet of the `input hash' field and veri... | java | public final ChainResult calculateOutputHash(long level) throws KSIException {
// TODO task KSIJAVAAPI-207 If the aggregation hash chain component contains the `input data' field, hash the value part of the field
// using the hash algorithm specified by the first octet of the `input hash' field and veri... | [
"public",
"final",
"ChainResult",
"calculateOutputHash",
"(",
"long",
"level",
")",
"throws",
"KSIException",
"{",
"// TODO task KSIJAVAAPI-207 If the aggregation hash chain component contains the `input data' field, hash the value part of the field",
"// using the hash algorithm specified b... | Calculate hash chain output hash.
@param level
hash chain level
@return hash chain result | [
"Calculate",
"hash",
"chain",
"output",
"hash",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-api/src/main/java/com/guardtime/ksi/unisignature/inmemory/InMemoryAggregationHashChain.java#L140-L157 |
109,352 | guardtime/ksi-java-sdk | ksi-service-ha/src/main/java/com/guardtime/ksi/service/ha/ExtendingHAServiceConfigurationListener.java | ExtendingHAServiceConfigurationListener.getExtensionConfiguration | Future<ExtenderConfiguration> getExtensionConfiguration() {
return new HAConfFuture<>(invokeSubserviceConfUpdates(),
new HAConfFuture.ConfResultSupplier<ConsolidatedResult<ExtenderConfiguration>>() {
public ConsolidatedResult<ExtenderConfiguration> get() {
... | java | Future<ExtenderConfiguration> getExtensionConfiguration() {
return new HAConfFuture<>(invokeSubserviceConfUpdates(),
new HAConfFuture.ConfResultSupplier<ConsolidatedResult<ExtenderConfiguration>>() {
public ConsolidatedResult<ExtenderConfiguration> get() {
... | [
"Future",
"<",
"ExtenderConfiguration",
">",
"getExtensionConfiguration",
"(",
")",
"{",
"return",
"new",
"HAConfFuture",
"<>",
"(",
"invokeSubserviceConfUpdates",
"(",
")",
",",
"new",
"HAConfFuture",
".",
"ConfResultSupplier",
"<",
"ConsolidatedResult",
"<",
"Extend... | Gets the extender's configuration. Invokes configuration updates for all the subclients.
@return {@link Future} which eventually provides subconfigurations consolidation result. | [
"Gets",
"the",
"extender",
"s",
"configuration",
".",
"Invokes",
"configuration",
"updates",
"for",
"all",
"the",
"subclients",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-service-ha/src/main/java/com/guardtime/ksi/service/ha/ExtendingHAServiceConfigurationListener.java#L70-L77 |
109,353 | guardtime/ksi-java-sdk | ksi-service-client/src/main/java/com/guardtime/ksi/service/ConfigurationHandler.java | ConfigurationHandler.doConfigurationUpdate | public Future<T> doConfigurationUpdate(final ConfigurationRequest<T> configurationRequest) {
Util.notNull(configurationRequest, "ConfigurationRequest passed to ConfigurationHandler");
return executorService.submit(new Callable<T>() {
public T call() throws Exception {
try {
... | java | public Future<T> doConfigurationUpdate(final ConfigurationRequest<T> configurationRequest) {
Util.notNull(configurationRequest, "ConfigurationRequest passed to ConfigurationHandler");
return executorService.submit(new Callable<T>() {
public T call() throws Exception {
try {
... | [
"public",
"Future",
"<",
"T",
">",
"doConfigurationUpdate",
"(",
"final",
"ConfigurationRequest",
"<",
"T",
">",
"configurationRequest",
")",
"{",
"Util",
".",
"notNull",
"(",
"configurationRequest",
",",
"\"ConfigurationRequest passed to ConfigurationHandler\"",
")",
"... | Invokes a configuration request and updates listeners asynchronously.
@param configurationRequest may not be null. | [
"Invokes",
"a",
"configuration",
"request",
"and",
"updates",
"listeners",
"asynchronously",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-service-client/src/main/java/com/guardtime/ksi/service/ConfigurationHandler.java#L69-L83 |
109,354 | guardtime/ksi-java-sdk | ksi-service-client/src/main/java/com/guardtime/ksi/service/ConfigurationHandler.java | ConfigurationHandler.updateListenersWithNewConfiguration | void updateListenersWithNewConfiguration(T newConfiguration) {
for (ConfigurationListener<T> listener : listeners) {
try {
listener.updated(newConfiguration);
} catch (Exception e) {
logger.error("Updating a listener with new configuration failed.", e);
... | java | void updateListenersWithNewConfiguration(T newConfiguration) {
for (ConfigurationListener<T> listener : listeners) {
try {
listener.updated(newConfiguration);
} catch (Exception e) {
logger.error("Updating a listener with new configuration failed.", e);
... | [
"void",
"updateListenersWithNewConfiguration",
"(",
"T",
"newConfiguration",
")",
"{",
"for",
"(",
"ConfigurationListener",
"<",
"T",
">",
"listener",
":",
"listeners",
")",
"{",
"try",
"{",
"listener",
".",
"updated",
"(",
"newConfiguration",
")",
";",
"}",
"... | Updates listeners with provided configuration
@param newConfiguration configuration to be applied | [
"Updates",
"listeners",
"with",
"provided",
"configuration"
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-service-client/src/main/java/com/guardtime/ksi/service/ConfigurationHandler.java#L90-L98 |
109,355 | guardtime/ksi-java-sdk | ksi-service-client/src/main/java/com/guardtime/ksi/service/ConfigurationHandler.java | ConfigurationHandler.updateListenersWithFailure | void updateListenersWithFailure(Throwable t) {
for (ConfigurationListener<T> listener : listeners) {
try {
listener.updateFailed(t);
} catch (Exception e) {
logger.error("Updating a listener with configuration request failure failed.", e);
}
... | java | void updateListenersWithFailure(Throwable t) {
for (ConfigurationListener<T> listener : listeners) {
try {
listener.updateFailed(t);
} catch (Exception e) {
logger.error("Updating a listener with configuration request failure failed.", e);
}
... | [
"void",
"updateListenersWithFailure",
"(",
"Throwable",
"t",
")",
"{",
"for",
"(",
"ConfigurationListener",
"<",
"T",
">",
"listener",
":",
"listeners",
")",
"{",
"try",
"{",
"listener",
".",
"updateFailed",
"(",
"t",
")",
";",
"}",
"catch",
"(",
"Exceptio... | Updates listeners with failure
@param t reason | [
"Updates",
"listeners",
"with",
"failure"
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-service-client/src/main/java/com/guardtime/ksi/service/ConfigurationHandler.java#L105-L113 |
109,356 | guardtime/ksi-java-sdk | ksi-service-client-apache-http/src/main/java/com/guardtime/ksi/service/client/http/apache/AbstractApacheHttpClient.java | AbstractApacheHttpClient.createClient | private CloseableHttpAsyncClient createClient(HttpSettings settings, ApacheHttpClientConfiguration conf) {
IOReactorConfig ioReactor = IOReactorConfig.custom().setIoThreadCount(conf.getMaxThreadCount()).build();
HttpAsyncClientBuilder httpClientBuilder = HttpAsyncClients.custom()
.useSys... | java | private CloseableHttpAsyncClient createClient(HttpSettings settings, ApacheHttpClientConfiguration conf) {
IOReactorConfig ioReactor = IOReactorConfig.custom().setIoThreadCount(conf.getMaxThreadCount()).build();
HttpAsyncClientBuilder httpClientBuilder = HttpAsyncClients.custom()
.useSys... | [
"private",
"CloseableHttpAsyncClient",
"createClient",
"(",
"HttpSettings",
"settings",
",",
"ApacheHttpClientConfiguration",
"conf",
")",
"{",
"IOReactorConfig",
"ioReactor",
"=",
"IOReactorConfig",
".",
"custom",
"(",
")",
".",
"setIoThreadCount",
"(",
"conf",
".",
... | Creates asynchronous Apache HTTP client.
@param settings
settings to use to create client.
@param conf
configuration related to async connection.
@return Instance of {@link CloseableHttpAsyncClient}. | [
"Creates",
"asynchronous",
"Apache",
"HTTP",
"client",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-service-client-apache-http/src/main/java/com/guardtime/ksi/service/client/http/apache/AbstractApacheHttpClient.java#L128-L142 |
109,357 | guardtime/ksi-java-sdk | ksi-service-client-apache-http/src/main/java/com/guardtime/ksi/service/client/http/apache/AbstractApacheHttpClient.java | AbstractApacheHttpClient.createProxyRoutePlanner | private DefaultProxyRoutePlanner createProxyRoutePlanner(HttpSettings settings, HttpAsyncClientBuilder httpClientBuilder) {
HttpHost proxy = new HttpHost(settings.getProxyUrl().getHost(), settings.getProxyUrl().getPort());
if (settings.getProxyUser() != null) {
CredentialsProvider credential... | java | private DefaultProxyRoutePlanner createProxyRoutePlanner(HttpSettings settings, HttpAsyncClientBuilder httpClientBuilder) {
HttpHost proxy = new HttpHost(settings.getProxyUrl().getHost(), settings.getProxyUrl().getPort());
if (settings.getProxyUser() != null) {
CredentialsProvider credential... | [
"private",
"DefaultProxyRoutePlanner",
"createProxyRoutePlanner",
"(",
"HttpSettings",
"settings",
",",
"HttpAsyncClientBuilder",
"httpClientBuilder",
")",
"{",
"HttpHost",
"proxy",
"=",
"new",
"HttpHost",
"(",
"settings",
".",
"getProxyUrl",
"(",
")",
".",
"getHost",
... | Creates default proxy route planner.
@param settings
settings to use.
@param httpClientBuilder
http client builder.
@return Instance of {@link DefaultProxyRoutePlanner}. | [
"Creates",
"default",
"proxy",
"route",
"planner",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-service-client-apache-http/src/main/java/com/guardtime/ksi/service/client/http/apache/AbstractApacheHttpClient.java#L153-L164 |
109,358 | guardtime/ksi-java-sdk | ksi-service-client-apache-http/src/main/java/com/guardtime/ksi/service/client/http/apache/AbstractApacheHttpClient.java | AbstractApacheHttpClient.createDefaultRequestConfig | private RequestConfig createDefaultRequestConfig(HttpSettings settings) {
int connectionTimeout = settings.getConnectionTimeout();
int socketTimeout = settings.getReadTimeout();
return RequestConfig.custom().setConnectionRequestTimeout(connectionTimeout).setSocketTimeout(socketTimeout).build();
... | java | private RequestConfig createDefaultRequestConfig(HttpSettings settings) {
int connectionTimeout = settings.getConnectionTimeout();
int socketTimeout = settings.getReadTimeout();
return RequestConfig.custom().setConnectionRequestTimeout(connectionTimeout).setSocketTimeout(socketTimeout).build();
... | [
"private",
"RequestConfig",
"createDefaultRequestConfig",
"(",
"HttpSettings",
"settings",
")",
"{",
"int",
"connectionTimeout",
"=",
"settings",
".",
"getConnectionTimeout",
"(",
")",
";",
"int",
"socketTimeout",
"=",
"settings",
".",
"getReadTimeout",
"(",
")",
";... | Creates default request config.
@param settings
settings to use.
@return instance of {@link RequestConfig}. | [
"Creates",
"default",
"request",
"config",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-service-client-apache-http/src/main/java/com/guardtime/ksi/service/client/http/apache/AbstractApacheHttpClient.java#L173-L177 |
109,359 | guardtime/ksi-java-sdk | ksi-service-ha/src/main/java/com/guardtime/ksi/service/ha/ExtendingHAService.java | ExtendingHAService.extend | public Future<ExtensionResponse> extend(Date aggregationTime, Date publicationTime) throws KSIException {
Util.notNull(aggregationTime, "aggregationTime");
Collection<KSIExtendingService> services = subservices;
Collection<Callable<ExtensionResponse>> tasks = new ArrayList<>(services.size());
... | java | public Future<ExtensionResponse> extend(Date aggregationTime, Date publicationTime) throws KSIException {
Util.notNull(aggregationTime, "aggregationTime");
Collection<KSIExtendingService> services = subservices;
Collection<Callable<ExtensionResponse>> tasks = new ArrayList<>(services.size());
... | [
"public",
"Future",
"<",
"ExtensionResponse",
">",
"extend",
"(",
"Date",
"aggregationTime",
",",
"Date",
"publicationTime",
")",
"throws",
"KSIException",
"{",
"Util",
".",
"notNull",
"(",
"aggregationTime",
",",
"\"aggregationTime\"",
")",
";",
"Collection",
"<"... | Creates a non-blocking extending request. Sends the request to all the subservices in parallel. First successful response is
used, others are cancelled. Request fails only if all the subservices fail.
@see KSIExtendingService#extend(Date, Date) | [
"Creates",
"a",
"non",
"-",
"blocking",
"extending",
"request",
".",
"Sends",
"the",
"request",
"to",
"all",
"the",
"subservices",
"in",
"parallel",
".",
"First",
"successful",
"response",
"is",
"used",
"others",
"are",
"cancelled",
".",
"Request",
"fails",
... | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-service-ha/src/main/java/com/guardtime/ksi/service/ha/ExtendingHAService.java#L71-L81 |
109,360 | guardtime/ksi-java-sdk | ksi-service-client-tcp/src/main/java/com/guardtime/ksi/service/tcp/KSITCPRequestFuture.java | KSITCPRequestFuture.getResult | public synchronized TLVElement getResult() throws KSITCPTransactionException {
if (finished) {
if (response != null) {
return response;
}
if (exception != null) {
throw exception;
}
}
return blockUntilTransactionFini... | java | public synchronized TLVElement getResult() throws KSITCPTransactionException {
if (finished) {
if (response != null) {
return response;
}
if (exception != null) {
throw exception;
}
}
return blockUntilTransactionFini... | [
"public",
"synchronized",
"TLVElement",
"getResult",
"(",
")",
"throws",
"KSITCPTransactionException",
"{",
"if",
"(",
"finished",
")",
"{",
"if",
"(",
"response",
"!=",
"null",
")",
"{",
"return",
"response",
";",
"}",
"if",
"(",
"exception",
"!=",
"null",
... | Blocks until response timeout occurs or the response arrives.
@return Bytes of the TCP response. | [
"Blocks",
"until",
"response",
"timeout",
"occurs",
"or",
"the",
"response",
"arrives",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-service-client-tcp/src/main/java/com/guardtime/ksi/service/tcp/KSITCPRequestFuture.java#L66-L76 |
109,361 | guardtime/ksi-java-sdk | ksi-service-ha/src/main/java/com/guardtime/ksi/service/ha/HAConfUtil.java | HAConfUtil.isBigger | static boolean isBigger(Long a, Long b) {
return a == null || (b != null && b > a);
} | java | static boolean isBigger(Long a, Long b) {
return a == null || (b != null && b > a);
} | [
"static",
"boolean",
"isBigger",
"(",
"Long",
"a",
",",
"Long",
"b",
")",
"{",
"return",
"a",
"==",
"null",
"||",
"(",
"b",
"!=",
"null",
"&&",
"b",
">",
"a",
")",
";",
"}"
] | Is value of b bigger than value of a.
@return True, if b is bigger than a. Always true, if value of a is null. | [
"Is",
"value",
"of",
"b",
"bigger",
"than",
"value",
"of",
"a",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-service-ha/src/main/java/com/guardtime/ksi/service/ha/HAConfUtil.java#L34-L36 |
109,362 | guardtime/ksi-java-sdk | ksi-service-ha/src/main/java/com/guardtime/ksi/service/ha/HAConfUtil.java | HAConfUtil.isSmaller | static boolean isSmaller(Long a, Long b) {
return a == null || (b != null && b < a);
} | java | static boolean isSmaller(Long a, Long b) {
return a == null || (b != null && b < a);
} | [
"static",
"boolean",
"isSmaller",
"(",
"Long",
"a",
",",
"Long",
"b",
")",
"{",
"return",
"a",
"==",
"null",
"||",
"(",
"b",
"!=",
"null",
"&&",
"b",
"<",
"a",
")",
";",
"}"
] | Is value of b smaller than value of a.
@return True, if b is smaller than a. Always true, if value of a is null. | [
"Is",
"value",
"of",
"b",
"smaller",
"than",
"value",
"of",
"a",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-service-ha/src/main/java/com/guardtime/ksi/service/ha/HAConfUtil.java#L43-L45 |
109,363 | guardtime/ksi-java-sdk | ksi-service-ha/src/main/java/com/guardtime/ksi/service/ha/HAConfUtil.java | HAConfUtil.isAfter | static boolean isAfter(Date a, Date b) {
return a == null || (b != null && b.after(a));
} | java | static boolean isAfter(Date a, Date b) {
return a == null || (b != null && b.after(a));
} | [
"static",
"boolean",
"isAfter",
"(",
"Date",
"a",
",",
"Date",
"b",
")",
"{",
"return",
"a",
"==",
"null",
"||",
"(",
"b",
"!=",
"null",
"&&",
"b",
".",
"after",
"(",
"a",
")",
")",
";",
"}"
] | Is value of b after value of a.
@return True, if b is after a. Always true, if value of a is null. | [
"Is",
"value",
"of",
"b",
"after",
"value",
"of",
"a",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-service-ha/src/main/java/com/guardtime/ksi/service/ha/HAConfUtil.java#L52-L54 |
109,364 | guardtime/ksi-java-sdk | ksi-service-ha/src/main/java/com/guardtime/ksi/service/ha/HAConfUtil.java | HAConfUtil.isBefore | static boolean isBefore(Date a, Date b) {
return a == null || (b != null && b.before(a));
} | java | static boolean isBefore(Date a, Date b) {
return a == null || (b != null && b.before(a));
} | [
"static",
"boolean",
"isBefore",
"(",
"Date",
"a",
",",
"Date",
"b",
")",
"{",
"return",
"a",
"==",
"null",
"||",
"(",
"b",
"!=",
"null",
"&&",
"b",
".",
"before",
"(",
"a",
")",
")",
";",
"}"
] | Is value of b before value of a.
@return True, if b is before a. Always true, if value of a is null. | [
"Is",
"value",
"of",
"b",
"before",
"value",
"of",
"a",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-service-ha/src/main/java/com/guardtime/ksi/service/ha/HAConfUtil.java#L61-L63 |
109,365 | guardtime/ksi-java-sdk | ksi-blocksigner/src/main/java/com/guardtime/ksi/blocksigner/KsiBlockSigner.java | KsiBlockSigner.sign | public List<KSISignature> sign() throws KSIException {
TreeNode rootNode = treeBuilder.build();
logger.debug("Root node calculated. {}(level={})", new DataHash(rootNode.getValue()), rootNode.getLevel());
KSISignature rootNodeSignature = signRootNode(rootNode);
if (leafs.size() == 1 && !l... | java | public List<KSISignature> sign() throws KSIException {
TreeNode rootNode = treeBuilder.build();
logger.debug("Root node calculated. {}(level={})", new DataHash(rootNode.getValue()), rootNode.getLevel());
KSISignature rootNodeSignature = signRootNode(rootNode);
if (leafs.size() == 1 && !l... | [
"public",
"List",
"<",
"KSISignature",
">",
"sign",
"(",
")",
"throws",
"KSIException",
"{",
"TreeNode",
"rootNode",
"=",
"treeBuilder",
".",
"build",
"(",
")",
";",
"logger",
".",
"debug",
"(",
"\"Root node calculated. {}(level={})\"",
",",
"new",
"DataHash",
... | Creates a block of multiple signatures.
@return Multiple signatures, according to number of input hashes.
@throws KSIException | [
"Creates",
"a",
"block",
"of",
"multiple",
"signatures",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-blocksigner/src/main/java/com/guardtime/ksi/blocksigner/KsiBlockSigner.java#L268-L281 |
109,366 | guardtime/ksi-java-sdk | ksi-blocksigner/src/main/java/com/guardtime/ksi/tree/HashTreeBuilder.java | HashTreeBuilder.add | public void add(ImprintNode node, IdentityMetadata metadata) throws HashException, KSIException {
addToHeads(heads, aggregate(node, metadata));
} | java | public void add(ImprintNode node, IdentityMetadata metadata) throws HashException, KSIException {
addToHeads(heads, aggregate(node, metadata));
} | [
"public",
"void",
"add",
"(",
"ImprintNode",
"node",
",",
"IdentityMetadata",
"metadata",
")",
"throws",
"HashException",
",",
"KSIException",
"{",
"addToHeads",
"(",
"heads",
",",
"aggregate",
"(",
"node",
",",
"metadata",
")",
")",
";",
"}"
] | Adds a new leaf with its metadata to the hash tree.
@param node leaf node to be added, must not be null.
@param metadata node's metadata, must not be null
@throws HashException
@throws KSIException | [
"Adds",
"a",
"new",
"leaf",
"with",
"its",
"metadata",
"to",
"the",
"hash",
"tree",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-blocksigner/src/main/java/com/guardtime/ksi/tree/HashTreeBuilder.java#L100-L102 |
109,367 | guardtime/ksi-java-sdk | ksi-blocksigner/src/main/java/com/guardtime/ksi/tree/HashTreeBuilder.java | HashTreeBuilder.calculateHeight | public long calculateHeight(ImprintNode node) throws HashException {
LinkedList<ImprintNode> tmpHeads = new LinkedList<>();
for (ImprintNode in : heads) {
tmpHeads.add(new ImprintNode(in));
}
addToHeads(tmpHeads, new ImprintNode(node));
ImprintNode root = getRootNod... | java | public long calculateHeight(ImprintNode node) throws HashException {
LinkedList<ImprintNode> tmpHeads = new LinkedList<>();
for (ImprintNode in : heads) {
tmpHeads.add(new ImprintNode(in));
}
addToHeads(tmpHeads, new ImprintNode(node));
ImprintNode root = getRootNod... | [
"public",
"long",
"calculateHeight",
"(",
"ImprintNode",
"node",
")",
"throws",
"HashException",
"{",
"LinkedList",
"<",
"ImprintNode",
">",
"tmpHeads",
"=",
"new",
"LinkedList",
"<>",
"(",
")",
";",
"for",
"(",
"ImprintNode",
"in",
":",
"heads",
")",
"{",
... | Calculates the height of the hash tree in case a new node would be added.
@param node
a leaf to be added to the tree, must not be null.
@return Height of the hash tree.
@throws HashException | [
"Calculates",
"the",
"height",
"of",
"the",
"hash",
"tree",
"in",
"case",
"a",
"new",
"node",
"would",
"be",
"added",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-blocksigner/src/main/java/com/guardtime/ksi/tree/HashTreeBuilder.java#L114-L126 |
109,368 | guardtime/ksi-java-sdk | ksi-blocksigner/src/main/java/com/guardtime/ksi/tree/HashTreeBuilder.java | HashTreeBuilder.calculateHeight | public long calculateHeight(ImprintNode node, IdentityMetadata metadata) throws HashException, KSIException {
return calculateHeight(aggregate(node, metadata));
} | java | public long calculateHeight(ImprintNode node, IdentityMetadata metadata) throws HashException, KSIException {
return calculateHeight(aggregate(node, metadata));
} | [
"public",
"long",
"calculateHeight",
"(",
"ImprintNode",
"node",
",",
"IdentityMetadata",
"metadata",
")",
"throws",
"HashException",
",",
"KSIException",
"{",
"return",
"calculateHeight",
"(",
"aggregate",
"(",
"node",
",",
"metadata",
")",
")",
";",
"}"
] | Calculates the height of the hash tree in case a new node with metadata would be added.
@param node a leaf to be added to the tree, must not be null.
@param metadata metadata associated with the node.
@return Height of the hash tree.
@throws HashException
@throws KSIException | [
"Calculates",
"the",
"height",
"of",
"the",
"hash",
"tree",
"in",
"case",
"a",
"new",
"node",
"with",
"metadata",
"would",
"be",
"added",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-blocksigner/src/main/java/com/guardtime/ksi/tree/HashTreeBuilder.java#L137-L139 |
109,369 | guardtime/ksi-java-sdk | ksi-blocksigner/src/main/java/com/guardtime/ksi/tree/HashTreeBuilder.java | HashTreeBuilder.add | public void add(ImprintNode... nodes) throws HashException {
notNull(nodes, "Nodes");
for (ImprintNode node : nodes) {
add(node);
}
} | java | public void add(ImprintNode... nodes) throws HashException {
notNull(nodes, "Nodes");
for (ImprintNode node : nodes) {
add(node);
}
} | [
"public",
"void",
"add",
"(",
"ImprintNode",
"...",
"nodes",
")",
"throws",
"HashException",
"{",
"notNull",
"(",
"nodes",
",",
"\"Nodes\"",
")",
";",
"for",
"(",
"ImprintNode",
"node",
":",
"nodes",
")",
"{",
"add",
"(",
"node",
")",
";",
"}",
"}"
] | Adds a new array of child nodes to the hash tree.
@param nodes array of nodes to be added.
@throws HashException | [
"Adds",
"a",
"new",
"array",
"of",
"child",
"nodes",
"to",
"the",
"hash",
"tree",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-blocksigner/src/main/java/com/guardtime/ksi/tree/HashTreeBuilder.java#L148-L153 |
109,370 | guardtime/ksi-java-sdk | ksi-api/src/main/java/com/guardtime/ksi/KSIBuilder.java | KSIBuilder.setKsiProtocolSignerClient | public KSIBuilder setKsiProtocolSignerClient(KSISigningClient signingClient) {
Util.notNull(signingClient, "KSI Signing Client");
return setKsiProtocolSigningService(new KSISigningClientServiceAdapter(signingClient));
} | java | public KSIBuilder setKsiProtocolSignerClient(KSISigningClient signingClient) {
Util.notNull(signingClient, "KSI Signing Client");
return setKsiProtocolSigningService(new KSISigningClientServiceAdapter(signingClient));
} | [
"public",
"KSIBuilder",
"setKsiProtocolSignerClient",
"(",
"KSISigningClient",
"signingClient",
")",
"{",
"Util",
".",
"notNull",
"(",
"signingClient",
",",
"\"KSI Signing Client\"",
")",
";",
"return",
"setKsiProtocolSigningService",
"(",
"new",
"KSISigningClientServiceAda... | Sets the signer client to be used in signing process.
@param signingClient
instance of {@link KSISigningClient}.
@return Instance of {@link KSIBuilder}. | [
"Sets",
"the",
"signer",
"client",
"to",
"be",
"used",
"in",
"signing",
"process",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-api/src/main/java/com/guardtime/ksi/KSIBuilder.java#L135-L138 |
109,371 | guardtime/ksi-java-sdk | ksi-api/src/main/java/com/guardtime/ksi/KSIBuilder.java | KSIBuilder.setKsiProtocolExtenderClient | public KSIBuilder setKsiProtocolExtenderClient(KSIExtenderClient extenderClient) {
Util.notNull(extenderClient, "KSI Extender Client");
return setKsiProtocolExtendingService(new KSIExtendingClientServiceAdapter(extenderClient));
} | java | public KSIBuilder setKsiProtocolExtenderClient(KSIExtenderClient extenderClient) {
Util.notNull(extenderClient, "KSI Extender Client");
return setKsiProtocolExtendingService(new KSIExtendingClientServiceAdapter(extenderClient));
} | [
"public",
"KSIBuilder",
"setKsiProtocolExtenderClient",
"(",
"KSIExtenderClient",
"extenderClient",
")",
"{",
"Util",
".",
"notNull",
"(",
"extenderClient",
",",
"\"KSI Extender Client\"",
")",
";",
"return",
"setKsiProtocolExtendingService",
"(",
"new",
"KSIExtendingClient... | Sets the extender client to be used in verification and extending process.
@param extenderClient
instance of {@link KSIExtenderClient}.
@return Instance of {@link KSIBuilder}. | [
"Sets",
"the",
"extender",
"client",
"to",
"be",
"used",
"in",
"verification",
"and",
"extending",
"process",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-api/src/main/java/com/guardtime/ksi/KSIBuilder.java#L147-L150 |
109,372 | guardtime/ksi-java-sdk | ksi-api/src/main/java/com/guardtime/ksi/trust/JKSTrustStore.java | JKSTrustStore.isTrusted | public boolean isTrusted(X509Certificate certificate, Store certStore) throws CryptoException {
try {
if (certificate == null) {
throw new CryptoException("Invalid input parameter. Certificate can not be null");
}
LOGGER.info("Checking if certificate with subj... | java | public boolean isTrusted(X509Certificate certificate, Store certStore) throws CryptoException {
try {
if (certificate == null) {
throw new CryptoException("Invalid input parameter. Certificate can not be null");
}
LOGGER.info("Checking if certificate with subj... | [
"public",
"boolean",
"isTrusted",
"(",
"X509Certificate",
"certificate",
",",
"Store",
"certStore",
")",
"throws",
"CryptoException",
"{",
"try",
"{",
"if",
"(",
"certificate",
"==",
"null",
")",
"{",
"throw",
"new",
"CryptoException",
"(",
"\"Invalid input parame... | This method is used to check if certificate is trusted or not.
@param certificate
instance of PKI X.509 certificate. not null.
@param certStore
additional certificates to be used to check if certificate chain is trusted or not.
@return true if certificate is trusted, false otherwise
@throws CryptoException
will be thr... | [
"This",
"method",
"is",
"used",
"to",
"check",
"if",
"certificate",
"is",
"trusted",
"or",
"not",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-api/src/main/java/com/guardtime/ksi/trust/JKSTrustStore.java#L138-L182 |
109,373 | guardtime/ksi-java-sdk | ksi-api/src/main/java/com/guardtime/ksi/trust/JKSTrustStore.java | JKSTrustStore.loadFile | @SuppressWarnings("resource")
private InputStream loadFile(String trustStorePath) throws FileNotFoundException {
InputStream input;
try {
input = new FileInputStream(trustStorePath);
} catch (FileNotFoundException e) {
LOGGER.warn("File {} not found. Fallback to class... | java | @SuppressWarnings("resource")
private InputStream loadFile(String trustStorePath) throws FileNotFoundException {
InputStream input;
try {
input = new FileInputStream(trustStorePath);
} catch (FileNotFoundException e) {
LOGGER.warn("File {} not found. Fallback to class... | [
"@",
"SuppressWarnings",
"(",
"\"resource\"",
")",
"private",
"InputStream",
"loadFile",
"(",
"String",
"trustStorePath",
")",
"throws",
"FileNotFoundException",
"{",
"InputStream",
"input",
";",
"try",
"{",
"input",
"=",
"new",
"FileInputStream",
"(",
"trustStorePa... | This method is used to find file from disk or classpath.
@param trustStorePath
file to load
@return instance of {@link InputStream} containing content of the file
@throws FileNotFoundException
if file does not exist | [
"This",
"method",
"is",
"used",
"to",
"find",
"file",
"from",
"disk",
"or",
"classpath",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-api/src/main/java/com/guardtime/ksi/trust/JKSTrustStore.java#L194-L207 |
109,374 | guardtime/ksi-java-sdk | ksi-api/src/main/java/com/guardtime/ksi/publication/PublicationData.java | PublicationData.getPublicationString | public String getPublicationString() {
byte[] imprint = publicationHash.getImprint();
byte[] data = new byte[imprint.length + 8];
System.arraycopy(Util.toByteArray(publicationTime.getTime() / 1000), 0, data, 0, 8);
System.arraycopy(imprint, 0, data, 8, imprint.length);
return Ba... | java | public String getPublicationString() {
byte[] imprint = publicationHash.getImprint();
byte[] data = new byte[imprint.length + 8];
System.arraycopy(Util.toByteArray(publicationTime.getTime() / 1000), 0, data, 0, 8);
System.arraycopy(imprint, 0, data, 8, imprint.length);
return Ba... | [
"public",
"String",
"getPublicationString",
"(",
")",
"{",
"byte",
"[",
"]",
"imprint",
"=",
"publicationHash",
".",
"getImprint",
"(",
")",
";",
"byte",
"[",
"]",
"data",
"=",
"new",
"byte",
"[",
"imprint",
".",
"length",
"+",
"8",
"]",
";",
"System",... | Returns a publication string that is a base-32 encoded value that is meant published to print media as human
readable text
@return returns a base-32 encoded publication string | [
"Returns",
"a",
"publication",
"string",
"that",
"is",
"a",
"base",
"-",
"32",
"encoded",
"value",
"that",
"is",
"meant",
"published",
"to",
"print",
"media",
"as",
"human",
"readable",
"text"
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-api/src/main/java/com/guardtime/ksi/publication/PublicationData.java#L160-L167 |
109,375 | guardtime/ksi-java-sdk | ksi-service-client/src/main/java/com/guardtime/ksi/pdu/v1/AbstractKSIRequest.java | AbstractKSIRequest.calculateMac | protected DataHash calculateMac() throws KSIException {
try {
HashAlgorithm algorithm = HashAlgorithm.getByName("DEFAULT");
algorithm.checkExpiration();
return new DataHash(algorithm, Util.calculateHMAC(getContent(), this.loginKey, algorithm.getName()));
} catch (IOEx... | java | protected DataHash calculateMac() throws KSIException {
try {
HashAlgorithm algorithm = HashAlgorithm.getByName("DEFAULT");
algorithm.checkExpiration();
return new DataHash(algorithm, Util.calculateHMAC(getContent(), this.loginKey, algorithm.getName()));
} catch (IOEx... | [
"protected",
"DataHash",
"calculateMac",
"(",
")",
"throws",
"KSIException",
"{",
"try",
"{",
"HashAlgorithm",
"algorithm",
"=",
"HashAlgorithm",
".",
"getByName",
"(",
"\"DEFAULT\"",
")",
";",
"algorithm",
".",
"checkExpiration",
"(",
")",
";",
"return",
"new",... | Calculates the MAC based on header and payload TLVs.
@return Calculated data hash.
@throws KSIException
if HMAC generation fails. | [
"Calculates",
"the",
"MAC",
"based",
"on",
"header",
"and",
"payload",
"TLVs",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-service-client/src/main/java/com/guardtime/ksi/pdu/v1/AbstractKSIRequest.java#L132-L148 |
109,376 | guardtime/ksi-java-sdk | ksi-api/src/main/java/com/guardtime/ksi/unisignature/verifier/VerificationContextBuilder.java | VerificationContextBuilder.setDocumentHash | public VerificationContextBuilder setDocumentHash(DataHash documentHash, Long level) {
this.documentHash = documentHash;
this.inputHashLevel = level;
return this;
} | java | public VerificationContextBuilder setDocumentHash(DataHash documentHash, Long level) {
this.documentHash = documentHash;
this.inputHashLevel = level;
return this;
} | [
"public",
"VerificationContextBuilder",
"setDocumentHash",
"(",
"DataHash",
"documentHash",
",",
"Long",
"level",
")",
"{",
"this",
".",
"documentHash",
"=",
"documentHash",
";",
"this",
".",
"inputHashLevel",
"=",
"level",
";",
"return",
"this",
";",
"}"
] | Used to set the hash and local aggregation tree height.
If present then this hash must equal to signature input hash.
@param documentHash document hash
@return instance of {@link VerificationContextBuilder} | [
"Used",
"to",
"set",
"the",
"hash",
"and",
"local",
"aggregation",
"tree",
"height",
".",
"If",
"present",
"then",
"this",
"hash",
"must",
"equal",
"to",
"signature",
"input",
"hash",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-api/src/main/java/com/guardtime/ksi/unisignature/verifier/VerificationContextBuilder.java#L121-L125 |
109,377 | guardtime/ksi-java-sdk | ksi-api/src/main/java/com/guardtime/ksi/unisignature/verifier/VerificationContextBuilder.java | VerificationContextBuilder.createVerificationContext | @Deprecated
public final VerificationContext createVerificationContext() throws KSIException {
if (signature == null) {
throw new KSIException("Failed to createSignature verification context. Signature must be present.");
}
if (extendingService == null) {
throw new KS... | java | @Deprecated
public final VerificationContext createVerificationContext() throws KSIException {
if (signature == null) {
throw new KSIException("Failed to createSignature verification context. Signature must be present.");
}
if (extendingService == null) {
throw new KS... | [
"@",
"Deprecated",
"public",
"final",
"VerificationContext",
"createVerificationContext",
"(",
")",
"throws",
"KSIException",
"{",
"if",
"(",
"signature",
"==",
"null",
")",
"{",
"throw",
"new",
"KSIException",
"(",
"\"Failed to createSignature verification context. Signa... | Builds the verification context.
@return instance of verification context
@throws KSIException when error occurs (e.g mandatory parameters aren't present) | [
"Builds",
"the",
"verification",
"context",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-api/src/main/java/com/guardtime/ksi/unisignature/verifier/VerificationContextBuilder.java#L149-L161 |
109,378 | guardtime/ksi-java-sdk | ksi-api/src/main/java/com/guardtime/ksi/unisignature/inmemory/InMemoryAggregationChainLink.java | InMemoryAggregationChainLink.getIdentityFromLegacyId | private String getIdentityFromLegacyId() throws CharacterCodingException {
byte[] data = legacyId;
int len = Util.toShort(data, 1);
return Util.decodeString(data, 3, len);
} | java | private String getIdentityFromLegacyId() throws CharacterCodingException {
byte[] data = legacyId;
int len = Util.toShort(data, 1);
return Util.decodeString(data, 3, len);
} | [
"private",
"String",
"getIdentityFromLegacyId",
"(",
")",
"throws",
"CharacterCodingException",
"{",
"byte",
"[",
"]",
"data",
"=",
"legacyId",
";",
"int",
"len",
"=",
"Util",
".",
"toShort",
"(",
"data",
",",
"1",
")",
";",
"return",
"Util",
".",
"decodeS... | Decodes link identity from legacy id.
@return decoded link identity decoded from legacy id. | [
"Decodes",
"link",
"identity",
"from",
"legacy",
"id",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-api/src/main/java/com/guardtime/ksi/unisignature/inmemory/InMemoryAggregationChainLink.java#L188-L192 |
109,379 | guardtime/ksi-java-sdk | ksi-api/src/main/java/com/guardtime/ksi/unisignature/inmemory/InMemoryAggregationChainLink.java | InMemoryAggregationChainLink.hash | protected final DataHash hash(byte[] hash1, byte[] hash2, long level, HashAlgorithm algorithm) throws InvalidAggregationHashChainException {
if (!algorithm.isImplemented()) {
throw new InvalidAggregationHashChainException("Invalid aggregation hash chain. Hash algorithm " + algorithm.getName() + " is... | java | protected final DataHash hash(byte[] hash1, byte[] hash2, long level, HashAlgorithm algorithm) throws InvalidAggregationHashChainException {
if (!algorithm.isImplemented()) {
throw new InvalidAggregationHashChainException("Invalid aggregation hash chain. Hash algorithm " + algorithm.getName() + " is... | [
"protected",
"final",
"DataHash",
"hash",
"(",
"byte",
"[",
"]",
"hash1",
",",
"byte",
"[",
"]",
"hash2",
",",
"long",
"level",
",",
"HashAlgorithm",
"algorithm",
")",
"throws",
"InvalidAggregationHashChainException",
"{",
"if",
"(",
"!",
"algorithm",
".",
"... | Hash two hashes together.
@param hash1 first hash
@param hash2 second hash
@param level level
@param algorithm hash algorithm to use
@return instance of {@link DataHash} | [
"Hash",
"two",
"hashes",
"together",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-api/src/main/java/com/guardtime/ksi/unisignature/inmemory/InMemoryAggregationChainLink.java#L214-L223 |
109,380 | guardtime/ksi-java-sdk | ksi-common/src/main/java/com/guardtime/ksi/tlv/TLVInputStream.java | TLVInputStream.readElement | public TLVElement readElement() throws IOException, TLVParserException {
TlvHeader header = readHeader();
TLVElement element = new TLVElement(header.tlv16, header.nonCritical, header.forwarded, header.type);
int count = countNestedTlvElements(header);
if (count > 0) {
readNes... | java | public TLVElement readElement() throws IOException, TLVParserException {
TlvHeader header = readHeader();
TLVElement element = new TLVElement(header.tlv16, header.nonCritical, header.forwarded, header.type);
int count = countNestedTlvElements(header);
if (count > 0) {
readNes... | [
"public",
"TLVElement",
"readElement",
"(",
")",
"throws",
"IOException",
",",
"TLVParserException",
"{",
"TlvHeader",
"header",
"=",
"readHeader",
"(",
")",
";",
"TLVElement",
"element",
"=",
"new",
"TLVElement",
"(",
"header",
".",
"tlv16",
",",
"header",
".... | Reads the next TLV element from the stream.
@return Instance of {@link TLVElement}.
@throws IOException
when reading from underlying stream fails.
@throws TLVParserException
when input stream is null. | [
"Reads",
"the",
"next",
"TLV",
"element",
"from",
"the",
"stream",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-common/src/main/java/com/guardtime/ksi/tlv/TLVInputStream.java#L81-L91 |
109,381 | guardtime/ksi-java-sdk | ksi-common/src/main/java/com/guardtime/ksi/tlv/TLVInputStream.java | TLVInputStream.readTlvContent | private byte[] readTlvContent(TlvHeader header) throws IOException {
byte[] data = new byte[header.getDataLength()];
in.readFully(data);
return data;
} | java | private byte[] readTlvContent(TlvHeader header) throws IOException {
byte[] data = new byte[header.getDataLength()];
in.readFully(data);
return data;
} | [
"private",
"byte",
"[",
"]",
"readTlvContent",
"(",
"TlvHeader",
"header",
")",
"throws",
"IOException",
"{",
"byte",
"[",
"]",
"data",
"=",
"new",
"byte",
"[",
"header",
".",
"getDataLength",
"(",
")",
"]",
";",
"in",
".",
"readFully",
"(",
"data",
")... | Reads the TLV content bytes from the underlying stream.
@param header
instance of {@link TlvHeader}, not null.
@return TLV content bytes.
@throws IOException
if an I/O error occurs. | [
"Reads",
"the",
"TLV",
"content",
"bytes",
"from",
"the",
"underlying",
"stream",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-common/src/main/java/com/guardtime/ksi/tlv/TLVInputStream.java#L217-L221 |
109,382 | guardtime/ksi-java-sdk | ksi-api/src/main/java/com/guardtime/ksi/unisignature/verifier/policies/ContextAwarePolicyAdapter.java | ContextAwarePolicyAdapter.createPolicy | public static ContextAwarePolicy createPolicy(Policy policy, PublicationsHandler handler, KSIExtendingService extendingService) {
if(policy instanceof UserProvidedPublicationBasedVerificationPolicy){
throw new IllegalArgumentException("Unsupported verification policy.");
}
Util.notNu... | java | public static ContextAwarePolicy createPolicy(Policy policy, PublicationsHandler handler, KSIExtendingService extendingService) {
if(policy instanceof UserProvidedPublicationBasedVerificationPolicy){
throw new IllegalArgumentException("Unsupported verification policy.");
}
Util.notNu... | [
"public",
"static",
"ContextAwarePolicy",
"createPolicy",
"(",
"Policy",
"policy",
",",
"PublicationsHandler",
"handler",
",",
"KSIExtendingService",
"extendingService",
")",
"{",
"if",
"(",
"policy",
"instanceof",
"UserProvidedPublicationBasedVerificationPolicy",
")",
"{",... | Method creating context aware policy using user provided policy with needed components.
@param policy
Policy.
@param handler
Publications handler.
@param extendingService
Extender client.
@return Policy with suitable context. | [
"Method",
"creating",
"context",
"aware",
"policy",
"using",
"user",
"provided",
"policy",
"with",
"needed",
"components",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-api/src/main/java/com/guardtime/ksi/unisignature/verifier/policies/ContextAwarePolicyAdapter.java#L161-L168 |
109,383 | guardtime/ksi-java-sdk | ksi-api/src/main/java/com/guardtime/ksi/unisignature/verifier/policies/ContextAwarePolicyAdapter.java | ContextAwarePolicyAdapter.setFallbackPolicy | public void setFallbackPolicy(Policy fallbackPolicy) {
Policy p = fallbackPolicy;
while (p != null) {
if (!(p instanceof ContextAwarePolicy)) {
throw new IllegalArgumentException("Fallback policy must be instance of ContextAwarePolicy");
}
p = p.getFal... | java | public void setFallbackPolicy(Policy fallbackPolicy) {
Policy p = fallbackPolicy;
while (p != null) {
if (!(p instanceof ContextAwarePolicy)) {
throw new IllegalArgumentException("Fallback policy must be instance of ContextAwarePolicy");
}
p = p.getFal... | [
"public",
"void",
"setFallbackPolicy",
"(",
"Policy",
"fallbackPolicy",
")",
"{",
"Policy",
"p",
"=",
"fallbackPolicy",
";",
"while",
"(",
"p",
"!=",
"null",
")",
"{",
"if",
"(",
"!",
"(",
"p",
"instanceof",
"ContextAwarePolicy",
")",
")",
"{",
"throw",
... | Sets a fallback policy to be used when signature does not verify with given policy.
@param fallbackPolicy the fallback policy used when signature does not verify with given policy. All fallback
policies in he chain must be instances of {@link ContextAwarePolicy}. | [
"Sets",
"a",
"fallback",
"policy",
"to",
"be",
"used",
"when",
"signature",
"does",
"not",
"verify",
"with",
"given",
"policy",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-api/src/main/java/com/guardtime/ksi/unisignature/verifier/policies/ContextAwarePolicyAdapter.java#L195-L204 |
109,384 | guardtime/ksi-java-sdk | ksi-common/src/main/java/com/guardtime/ksi/util/Util.java | Util.decodeString | public static String decodeString(byte[] buf, int ofs, int len) throws CharacterCodingException {
if (ofs < 0 || len < 0 || ofs + len < 0 || ofs + len > buf.length) {
throw new IndexOutOfBoundsException();
}
CharsetDecoder decoder = Charset.forName("UTF-8").newDecoder().onMalformedI... | java | public static String decodeString(byte[] buf, int ofs, int len) throws CharacterCodingException {
if (ofs < 0 || len < 0 || ofs + len < 0 || ofs + len > buf.length) {
throw new IndexOutOfBoundsException();
}
CharsetDecoder decoder = Charset.forName("UTF-8").newDecoder().onMalformedI... | [
"public",
"static",
"String",
"decodeString",
"(",
"byte",
"[",
"]",
"buf",
",",
"int",
"ofs",
",",
"int",
"len",
")",
"throws",
"CharacterCodingException",
"{",
"if",
"(",
"ofs",
"<",
"0",
"||",
"len",
"<",
"0",
"||",
"ofs",
"+",
"len",
"<",
"0",
... | Decodes UTF-8 string from the given buffer.
@param buf
the buffer.
@param ofs
offset of the UTF-8 data in the buffer.
@param len
length of the UTF-8 data to decode.
@return The decoded string.
@throws CharacterCodingException
when the specified data is not in valid UTF-8 format. | [
"Decodes",
"UTF",
"-",
"8",
"string",
"from",
"the",
"given",
"buffer",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-common/src/main/java/com/guardtime/ksi/util/Util.java#L146-L154 |
109,385 | guardtime/ksi-java-sdk | ksi-common/src/main/java/com/guardtime/ksi/util/Util.java | Util.toByteArray | public static byte[] toByteArray(String value) {
if (value == null) {
return null;
}
try {
CharsetEncoder encoder = Charset.forName("UTF-8").newEncoder().onMalformedInput(CodingErrorAction.REPORT)
.onUnmappableCharacter(CodingErrorAction.REPORT);
... | java | public static byte[] toByteArray(String value) {
if (value == null) {
return null;
}
try {
CharsetEncoder encoder = Charset.forName("UTF-8").newEncoder().onMalformedInput(CodingErrorAction.REPORT)
.onUnmappableCharacter(CodingErrorAction.REPORT);
... | [
"public",
"static",
"byte",
"[",
"]",
"toByteArray",
"(",
"String",
"value",
")",
"{",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"try",
"{",
"CharsetEncoder",
"encoder",
"=",
"Charset",
".",
"forName",
"(",
"\"UTF-8\"",
")... | Encodes the given string in UTF-8.
@param value
the string to encode.
@return A newly allocated array containing the encoding result. | [
"Encodes",
"the",
"given",
"string",
"in",
"UTF",
"-",
"8",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-common/src/main/java/com/guardtime/ksi/util/Util.java#L164-L180 |
109,386 | guardtime/ksi-java-sdk | ksi-common/src/main/java/com/guardtime/ksi/util/Util.java | Util.copyOf | public static byte[] copyOf(byte[] b, int off, int len) throws NullPointerException, ArrayIndexOutOfBoundsException {
if (b == null) {
throw new NullPointerException();
}
if (off < 0 || len < 0 || off > b.length - len) {
throw new ArrayIndexOutOfBoundsException();
... | java | public static byte[] copyOf(byte[] b, int off, int len) throws NullPointerException, ArrayIndexOutOfBoundsException {
if (b == null) {
throw new NullPointerException();
}
if (off < 0 || len < 0 || off > b.length - len) {
throw new ArrayIndexOutOfBoundsException();
... | [
"public",
"static",
"byte",
"[",
"]",
"copyOf",
"(",
"byte",
"[",
"]",
"b",
",",
"int",
"off",
",",
"int",
"len",
")",
"throws",
"NullPointerException",
",",
"ArrayIndexOutOfBoundsException",
"{",
"if",
"(",
"b",
"==",
"null",
")",
"{",
"throw",
"new",
... | Creates a copy of a section of the given byte array.
@param b
the array to copy.
@param off
the start offset of the data within {@code b}.
@param len
the number of bytes to copy.
@return The copy of the requested section of {@code b}.
@throws NullPointerException
if {@code b} is null.
@throws ArrayIndexOutOfBoundsEx... | [
"Creates",
"a",
"copy",
"of",
"a",
"section",
"of",
"the",
"given",
"byte",
"array",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-common/src/main/java/com/guardtime/ksi/util/Util.java#L248-L259 |
109,387 | guardtime/ksi-java-sdk | ksi-common/src/main/java/com/guardtime/ksi/util/Util.java | Util.join | public static byte[] join(byte[] a, byte[] b) {
byte[] result = new byte[a.length + b.length];
System.arraycopy(a, 0, result, 0, a.length);
System.arraycopy(b, 0, result, a.length, b.length);
return result;
} | java | public static byte[] join(byte[] a, byte[] b) {
byte[] result = new byte[a.length + b.length];
System.arraycopy(a, 0, result, 0, a.length);
System.arraycopy(b, 0, result, a.length, b.length);
return result;
} | [
"public",
"static",
"byte",
"[",
"]",
"join",
"(",
"byte",
"[",
"]",
"a",
",",
"byte",
"[",
"]",
"b",
")",
"{",
"byte",
"[",
"]",
"result",
"=",
"new",
"byte",
"[",
"a",
".",
"length",
"+",
"b",
".",
"length",
"]",
";",
"System",
".",
"arrayc... | Joins two byte arrays into one.
@param a
first byte array to join, not null.
@param b
second byte array to join, not null.
@return Joined byte array. | [
"Joins",
"two",
"byte",
"arrays",
"into",
"one",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-common/src/main/java/com/guardtime/ksi/util/Util.java#L271-L276 |
109,388 | guardtime/ksi-java-sdk | ksi-common/src/main/java/com/guardtime/ksi/util/Util.java | Util.decodeUnsignedLong | public static long decodeUnsignedLong(byte[] buf, int ofs, int len) throws IllegalArgumentException {
if (ofs < 0 || len < 0 || ofs + len < 0 || ofs + len > buf.length) {
throw new IndexOutOfBoundsException();
}
if (len > 8 || len == 8 && buf[ofs] < 0) {
throw new Illegal... | java | public static long decodeUnsignedLong(byte[] buf, int ofs, int len) throws IllegalArgumentException {
if (ofs < 0 || len < 0 || ofs + len < 0 || ofs + len > buf.length) {
throw new IndexOutOfBoundsException();
}
if (len > 8 || len == 8 && buf[ofs] < 0) {
throw new Illegal... | [
"public",
"static",
"long",
"decodeUnsignedLong",
"(",
"byte",
"[",
"]",
"buf",
",",
"int",
"ofs",
",",
"int",
"len",
")",
"throws",
"IllegalArgumentException",
"{",
"if",
"(",
"ofs",
"<",
"0",
"||",
"len",
"<",
"0",
"||",
"ofs",
"+",
"len",
"<",
"0"... | Decodes an unsigned integer from the given buffer.
@param buf
the buffer.
@param ofs
offset of the data in the buffer.
@param len
length of the data to decode.
@return The decoded value.
@throws IllegalArgumentException
when result does not fit into 63-bit unsigned integer. | [
"Decodes",
"an",
"unsigned",
"integer",
"from",
"the",
"given",
"buffer",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-common/src/main/java/com/guardtime/ksi/util/Util.java#L489-L501 |
109,389 | guardtime/ksi-java-sdk | ksi-common/src/main/java/com/guardtime/ksi/util/Util.java | Util.calculateHMAC | public static byte[] calculateHMAC(byte[] message, byte[] keyBytes, String algorithm) throws NoSuchAlgorithmException, InvalidKeyException {
if (keyBytes == null) {
throw new IllegalArgumentException("Invalid HMAC key: null");
}
String hmacAlgorithmName = "Hmac" + algorithm.toUpperCa... | java | public static byte[] calculateHMAC(byte[] message, byte[] keyBytes, String algorithm) throws NoSuchAlgorithmException, InvalidKeyException {
if (keyBytes == null) {
throw new IllegalArgumentException("Invalid HMAC key: null");
}
String hmacAlgorithmName = "Hmac" + algorithm.toUpperCa... | [
"public",
"static",
"byte",
"[",
"]",
"calculateHMAC",
"(",
"byte",
"[",
"]",
"message",
",",
"byte",
"[",
"]",
"keyBytes",
",",
"String",
"algorithm",
")",
"throws",
"NoSuchAlgorithmException",
",",
"InvalidKeyException",
"{",
"if",
"(",
"keyBytes",
"==",
"... | Calculates the RFC 2104 compatible HMAC for the given message, key, and algorithm.
@param message
message for which the MAC is to be calculated.
@param keyBytes
key for calculation.
@param algorithm
algorithm to be used (MD5, SHA1, SHA256).
@return HMAC as byte array.
@throws NoSuchAlgorithmException
if invalid algo... | [
"Calculates",
"the",
"RFC",
"2104",
"compatible",
"HMAC",
"for",
"the",
"given",
"message",
"key",
"and",
"algorithm",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-common/src/main/java/com/guardtime/ksi/util/Util.java#L545-L555 |
109,390 | guardtime/ksi-java-sdk | ksi-common/src/main/java/com/guardtime/ksi/util/Util.java | Util.equalsIgnoreOrder | public static boolean equalsIgnoreOrder(Collection<?> c1, Collection<?> c2) {
return (c1 == null && c2 == null) || (c1 != null && c2 != null && c1.size() == c2.size() && c1.containsAll(c2) && c2.containsAll(c1));
} | java | public static boolean equalsIgnoreOrder(Collection<?> c1, Collection<?> c2) {
return (c1 == null && c2 == null) || (c1 != null && c2 != null && c1.size() == c2.size() && c1.containsAll(c2) && c2.containsAll(c1));
} | [
"public",
"static",
"boolean",
"equalsIgnoreOrder",
"(",
"Collection",
"<",
"?",
">",
"c1",
",",
"Collection",
"<",
"?",
">",
"c2",
")",
"{",
"return",
"(",
"c1",
"==",
"null",
"&&",
"c2",
"==",
"null",
")",
"||",
"(",
"c1",
"!=",
"null",
"&&",
"c2... | Checks if two collections are equal ignoring the order of components. It's safe to pass collections that might be null.
@param c1 first collection.
@param c2 second collection.
@return True, if both lists are null or if they have exactly the same components. | [
"Checks",
"if",
"two",
"collections",
"are",
"equal",
"ignoring",
"the",
"order",
"of",
"components",
".",
"It",
"s",
"safe",
"to",
"pass",
"collections",
"that",
"might",
"be",
"null",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-common/src/main/java/com/guardtime/ksi/util/Util.java#L728-L730 |
109,391 | guardtime/ksi-java-sdk | ksi-common/src/main/java/com/guardtime/ksi/tlv/TLVStructure.java | TLVStructure.verifyCriticalFlag | protected void verifyCriticalFlag(TLVElement element) throws TLVParserException {
if (!element.isNonCritical()) {
throw new TLVParserException("Unknown critical TLV element with tag=0x" + Integer.toHexString(element.getType()) + " encountered");
}
} | java | protected void verifyCriticalFlag(TLVElement element) throws TLVParserException {
if (!element.isNonCritical()) {
throw new TLVParserException("Unknown critical TLV element with tag=0x" + Integer.toHexString(element.getType()) + " encountered");
}
} | [
"protected",
"void",
"verifyCriticalFlag",
"(",
"TLVElement",
"element",
")",
"throws",
"TLVParserException",
"{",
"if",
"(",
"!",
"element",
".",
"isNonCritical",
"(",
")",
")",
"{",
"throw",
"new",
"TLVParserException",
"(",
"\"Unknown critical TLV element with tag=... | Checks if the TLV element is critical or not.
@param element
TLV element to check.
@throws TLVParserException
when unknown critical TLV element is encountered. | [
"Checks",
"if",
"the",
"TLV",
"element",
"is",
"critical",
"or",
"not",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-common/src/main/java/com/guardtime/ksi/tlv/TLVStructure.java#L70-L74 |
109,392 | guardtime/ksi-java-sdk | ksi-service-ha/src/main/java/com/guardtime/ksi/service/ha/SigningHAService.java | SigningHAService.sign | public Future<AggregationResponse> sign(DataHash dataHash, Long level) throws KSIException {
Util.notNull(dataHash, "dataHash");
Util.notNull(level, "level");
final Collection<Callable<AggregationResponse>> tasks = new ArrayList<>(subservices.size());
for (KSISigningService subservice : ... | java | public Future<AggregationResponse> sign(DataHash dataHash, Long level) throws KSIException {
Util.notNull(dataHash, "dataHash");
Util.notNull(level, "level");
final Collection<Callable<AggregationResponse>> tasks = new ArrayList<>(subservices.size());
for (KSISigningService subservice : ... | [
"public",
"Future",
"<",
"AggregationResponse",
">",
"sign",
"(",
"DataHash",
"dataHash",
",",
"Long",
"level",
")",
"throws",
"KSIException",
"{",
"Util",
".",
"notNull",
"(",
"dataHash",
",",
"\"dataHash\"",
")",
";",
"Util",
".",
"notNull",
"(",
"level",
... | Creates a non-blocking signing request. Sends the request to all the subservices in parallel. First successful response is
used, others are cancelled. Request fails only if all the subservices fail.
@see KSISigningService#sign(DataHash, Long) | [
"Creates",
"a",
"non",
"-",
"blocking",
"signing",
"request",
".",
"Sends",
"the",
"request",
"to",
"all",
"the",
"subservices",
"in",
"parallel",
".",
"First",
"successful",
"response",
"is",
"used",
"others",
"are",
"cancelled",
".",
"Request",
"fails",
"o... | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-service-ha/src/main/java/com/guardtime/ksi/service/ha/SigningHAService.java#L71-L81 |
109,393 | guardtime/ksi-java-sdk | ksi-common/src/main/java/com/guardtime/ksi/hashing/DataHasher.java | DataHasher.addData | public final DataHasher addData(byte[] data) {
Util.notNull(data, "Date");
return addData(data, 0, data.length);
} | java | public final DataHasher addData(byte[] data) {
Util.notNull(data, "Date");
return addData(data, 0, data.length);
} | [
"public",
"final",
"DataHasher",
"addData",
"(",
"byte",
"[",
"]",
"data",
")",
"{",
"Util",
".",
"notNull",
"(",
"data",
",",
"\"Date\"",
")",
";",
"return",
"addData",
"(",
"data",
",",
"0",
",",
"data",
".",
"length",
")",
";",
"}"
] | Adds data to the digest using the specified array of bytes, starting at an offset of 0.
@param data the array of bytes.
@return The same {@link DataHasher} object for chaining calls.
@throws NullPointerException when input data is null. | [
"Adds",
"data",
"to",
"the",
"digest",
"using",
"the",
"specified",
"array",
"of",
"bytes",
"starting",
"at",
"an",
"offset",
"of",
"0",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-common/src/main/java/com/guardtime/ksi/hashing/DataHasher.java#L161-L165 |
109,394 | guardtime/ksi-java-sdk | ksi-common/src/main/java/com/guardtime/ksi/hashing/DataHasher.java | DataHasher.addData | public final DataHasher addData(InputStream inStream, int bufferSize) {
Util.notNull(inStream, "Input stream");
try {
byte[] buffer = new byte[bufferSize];
while (true) {
int bytesRead = inStream.read(buffer);
if (bytesRead == -1) {
... | java | public final DataHasher addData(InputStream inStream, int bufferSize) {
Util.notNull(inStream, "Input stream");
try {
byte[] buffer = new byte[bufferSize];
while (true) {
int bytesRead = inStream.read(buffer);
if (bytesRead == -1) {
... | [
"public",
"final",
"DataHasher",
"addData",
"(",
"InputStream",
"inStream",
",",
"int",
"bufferSize",
")",
"{",
"Util",
".",
"notNull",
"(",
"inStream",
",",
"\"Input stream\"",
")",
";",
"try",
"{",
"byte",
"[",
"]",
"buffer",
"=",
"new",
"byte",
"[",
"... | Adds data to the digest using the specified input stream of bytes, starting at an offset of 0.
@param inStream input stream of bytes.
@param bufferSize maximum allowed buffer size for reading data.
@return The same {@link DataHasher} object for chaining calls.
@throws HashException when hash calculation fai... | [
"Adds",
"data",
"to",
"the",
"digest",
"using",
"the",
"specified",
"input",
"stream",
"of",
"bytes",
"starting",
"at",
"an",
"offset",
"of",
"0",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-common/src/main/java/com/guardtime/ksi/hashing/DataHasher.java#L218-L233 |
109,395 | guardtime/ksi-java-sdk | ksi-common/src/main/java/com/guardtime/ksi/hashing/DataHasher.java | DataHasher.addData | public final DataHasher addData(File file, int bufferSize) {
Util.notNull(file, "File");
FileInputStream inStream = null;
try {
inStream = new FileInputStream(file);
return addData(inStream, bufferSize);
} catch (FileNotFoundException e) {
throw new Il... | java | public final DataHasher addData(File file, int bufferSize) {
Util.notNull(file, "File");
FileInputStream inStream = null;
try {
inStream = new FileInputStream(file);
return addData(inStream, bufferSize);
} catch (FileNotFoundException e) {
throw new Il... | [
"public",
"final",
"DataHasher",
"addData",
"(",
"File",
"file",
",",
"int",
"bufferSize",
")",
"{",
"Util",
".",
"notNull",
"(",
"file",
",",
"\"File\"",
")",
";",
"FileInputStream",
"inStream",
"=",
"null",
";",
"try",
"{",
"inStream",
"=",
"new",
"Fil... | Adds data to the digest using the specified file, starting at the offset 0.
@param file input file.
@param bufferSize size of buffer for reading data.
@return The same {@link DataHasher} object for chaining calls.
@throws HashException when hash calculation fails.
@throws NullPointerException when input... | [
"Adds",
"data",
"to",
"the",
"digest",
"using",
"the",
"specified",
"file",
"starting",
"at",
"the",
"offset",
"0",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-common/src/main/java/com/guardtime/ksi/hashing/DataHasher.java#L246-L257 |
109,396 | guardtime/ksi-java-sdk | ksi-common/src/main/java/com/guardtime/ksi/util/BaseX.java | BaseX.addChars | private void addChars(String chars) {
for (int i = 0; i < chars.length(); i++) {
int c = chars.codePointAt(i) - min;
if (values[c] != -1 && values[c] != i) {
throw new IllegalArgumentException("Duplicate characters in the encoding alphabet");
}
val... | java | private void addChars(String chars) {
for (int i = 0; i < chars.length(); i++) {
int c = chars.codePointAt(i) - min;
if (values[c] != -1 && values[c] != i) {
throw new IllegalArgumentException("Duplicate characters in the encoding alphabet");
}
val... | [
"private",
"void",
"addChars",
"(",
"String",
"chars",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"chars",
".",
"length",
"(",
")",
";",
"i",
"++",
")",
"{",
"int",
"c",
"=",
"chars",
".",
"codePointAt",
"(",
"i",
")",
"-",
"m... | Adds the values for the given characters to the value lookup table.
@param chars
the list of characters to process. | [
"Adds",
"the",
"values",
"for",
"the",
"given",
"characters",
"to",
"the",
"value",
"lookup",
"table",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-common/src/main/java/com/guardtime/ksi/util/BaseX.java#L149-L157 |
109,397 | guardtime/ksi-java-sdk | ksi-common/src/main/java/com/guardtime/ksi/util/BaseX.java | BaseX.encode | public final StringBuffer encode(byte[] in, int off, int len, String sep, int freq) {
// sanitize the parameters
if (in == null) {
throw new NullPointerException();
}
if (off < 0 || len < 0 || off + len < 0 || off + len > in.length) {
throw new ArrayIndexOutOfBou... | java | public final StringBuffer encode(byte[] in, int off, int len, String sep, int freq) {
// sanitize the parameters
if (in == null) {
throw new NullPointerException();
}
if (off < 0 || len < 0 || off + len < 0 || off + len > in.length) {
throw new ArrayIndexOutOfBou... | [
"public",
"final",
"StringBuffer",
"encode",
"(",
"byte",
"[",
"]",
"in",
",",
"int",
"off",
",",
"int",
"len",
",",
"String",
"sep",
",",
"int",
"freq",
")",
"{",
"// sanitize the parameters",
"if",
"(",
"in",
"==",
"null",
")",
"{",
"throw",
"new",
... | Encodes the given bytes into a base-X string, optionally inserting a
separator into the result with given frequency.
@param in
an array containing the bytes to encode.
@param off
the start offset of the data within {@code in}.
@param len
the number of bytes to encode.
@param sep
if {@code sep} is not {@code null} and ... | [
"Encodes",
"the",
"given",
"bytes",
"into",
"a",
"base",
"-",
"X",
"string",
"optionally",
"inserting",
"a",
"separator",
"into",
"the",
"result",
"with",
"given",
"frequency",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-common/src/main/java/com/guardtime/ksi/util/BaseX.java#L180-L241 |
109,398 | guardtime/ksi-java-sdk | ksi-common/src/main/java/com/guardtime/ksi/util/BaseX.java | BaseX.decode | public final byte[] decode(String in) {
// sanitize the parameters
if (in == null) {
throw new NullPointerException();
}
// create the result buffer
byte[] out = new byte[in.length() * bits / 8];
// decode
int outCount = 0; // number of output bytes... | java | public final byte[] decode(String in) {
// sanitize the parameters
if (in == null) {
throw new NullPointerException();
}
// create the result buffer
byte[] out = new byte[in.length() * bits / 8];
// decode
int outCount = 0; // number of output bytes... | [
"public",
"final",
"byte",
"[",
"]",
"decode",
"(",
"String",
"in",
")",
"{",
"// sanitize the parameters",
"if",
"(",
"in",
"==",
"null",
")",
"{",
"throw",
"new",
"NullPointerException",
"(",
")",
";",
"}",
"// create the result buffer",
"byte",
"[",
"]",
... | Decodes the given base-X string into bytes, silently ignoring any
non-base-X characters.
@param in
the string to decode.
@return The decoded bytes. | [
"Decodes",
"the",
"given",
"base",
"-",
"X",
"string",
"into",
"bytes",
"silently",
"ignoring",
"any",
"non",
"-",
"base",
"-",
"X",
"characters",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-common/src/main/java/com/guardtime/ksi/util/BaseX.java#L252-L293 |
109,399 | guardtime/ksi-java-sdk | ksi-api/src/main/java/com/guardtime/ksi/publication/inmemory/InMemoryPublicationsFile.java | InMemoryPublicationsFile.decodePublicationsFile | private void decodePublicationsFile(TLVInputStream input) throws KSIException, IOException {
while (input.hasNextElement()) {
TLVElement element = input.readElement();
switch (element.getType()) {
case PublicationsFileHeader.ELEMENT_TYPE:
if (header !=... | java | private void decodePublicationsFile(TLVInputStream input) throws KSIException, IOException {
while (input.hasNextElement()) {
TLVElement element = input.readElement();
switch (element.getType()) {
case PublicationsFileHeader.ELEMENT_TYPE:
if (header !=... | [
"private",
"void",
"decodePublicationsFile",
"(",
"TLVInputStream",
"input",
")",
"throws",
"KSIException",
",",
"IOException",
"{",
"while",
"(",
"input",
".",
"hasNextElement",
"(",
")",
")",
"{",
"TLVElement",
"element",
"=",
"input",
".",
"readElement",
"(",... | Decodes publications file. Reads publications data from given input stream.
@param input
input stream to createSignature. not null.
@throws InvalidPublicationsFileException
@throws IOException | [
"Decodes",
"publications",
"file",
".",
"Reads",
"publications",
"data",
"from",
"given",
"input",
"stream",
"."
] | b2cd877050f0f392657c724452318d10a1002171 | https://github.com/guardtime/ksi-java-sdk/blob/b2cd877050f0f392657c724452318d10a1002171/ksi-api/src/main/java/com/guardtime/ksi/publication/inmemory/InMemoryPublicationsFile.java#L112-L137 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.