repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
partition
stringclasses
1 value
vatbub/common
internet/src/main/java/com/github/vatbub/common/internet/Internet.java
Internet.webread
@SuppressWarnings("UnusedReturnValue") public static String webread(URL url) throws IOException { StringBuilder result = new StringBuilder(); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("GET"); BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream())); String line; while ((line = rd.readLine()) != null) { result.append(line); } rd.close(); return result.toString(); }
java
@SuppressWarnings("UnusedReturnValue") public static String webread(URL url) throws IOException { StringBuilder result = new StringBuilder(); HttpURLConnection conn = (HttpURLConnection) url.openConnection(); conn.setRequestMethod("GET"); BufferedReader rd = new BufferedReader(new InputStreamReader(conn.getInputStream())); String line; while ((line = rd.readLine()) != null) { result.append(line); } rd.close(); return result.toString(); }
[ "@", "SuppressWarnings", "(", "\"UnusedReturnValue\"", ")", "public", "static", "String", "webread", "(", "URL", "url", ")", "throws", "IOException", "{", "StringBuilder", "result", "=", "new", "StringBuilder", "(", ")", ";", "HttpURLConnection", "conn", "=", "(...
Sends a GET request to url and retrieves the server response @param url The url to call. @return The server response @throws IOException No Internet connection
[ "Sends", "a", "GET", "request", "to", "url", "and", "retrieves", "the", "server", "response" ]
8b9fd2ece0a23d520ce53b66c84cbd094e378443
https://github.com/vatbub/common/blob/8b9fd2ece0a23d520ce53b66c84cbd094e378443/internet/src/main/java/com/github/vatbub/common/internet/Internet.java#L179-L191
train
vatbub/common
internet/src/main/java/com/github/vatbub/common/internet/Internet.java
Internet.openInDefaultBrowser
public static void openInDefaultBrowser(URL url) throws IOException { Runtime rt = Runtime.getRuntime(); if (SystemUtils.IS_OS_WINDOWS) { rt.exec("rundll32 url.dll,FileProtocolHandler " + url); } else if (SystemUtils.IS_OS_MAC) { rt.exec("open" + url); } else { String[] browsers = {"epiphany", "firefox", "mozilla", "konqueror", "netscape", "opera", "links", "lynx"}; StringBuilder cmd = new StringBuilder(); for (int i = 0; i < browsers.length; i++) cmd.append(i == 0 ? "" : " || ").append(browsers[i]).append(" \"").append(url).append("\" "); rt.exec(new String[]{"sh", "-c", cmd.toString()}); } }
java
public static void openInDefaultBrowser(URL url) throws IOException { Runtime rt = Runtime.getRuntime(); if (SystemUtils.IS_OS_WINDOWS) { rt.exec("rundll32 url.dll,FileProtocolHandler " + url); } else if (SystemUtils.IS_OS_MAC) { rt.exec("open" + url); } else { String[] browsers = {"epiphany", "firefox", "mozilla", "konqueror", "netscape", "opera", "links", "lynx"}; StringBuilder cmd = new StringBuilder(); for (int i = 0; i < browsers.length; i++) cmd.append(i == 0 ? "" : " || ").append(browsers[i]).append(" \"").append(url).append("\" "); rt.exec(new String[]{"sh", "-c", cmd.toString()}); } }
[ "public", "static", "void", "openInDefaultBrowser", "(", "URL", "url", ")", "throws", "IOException", "{", "Runtime", "rt", "=", "Runtime", ".", "getRuntime", "(", ")", ";", "if", "(", "SystemUtils", ".", "IS_OS_WINDOWS", ")", "{", "rt", ".", "exec", "(", ...
OPens the specified url in the default browser. @param url The url to open @throws IOException If the URL cannot be opened
[ "OPens", "the", "specified", "url", "in", "the", "default", "browser", "." ]
8b9fd2ece0a23d520ce53b66c84cbd094e378443
https://github.com/vatbub/common/blob/8b9fd2ece0a23d520ce53b66c84cbd094e378443/internet/src/main/java/com/github/vatbub/common/internet/Internet.java#L440-L457
train
lastaflute/lasta-thymeleaf
src/main/java/org/lastaflute/thymeleaf/expression/HandyDateExpressionObject.java
HandyDateExpressionObject.format
public String format(Object expression, Object objPattern) { if (objPattern instanceof String) { final String pattern = filterPattern((String) objPattern); if (expression == null) { return null; } if (expression instanceof LocalDate) { return create((LocalDate) expression).toDisp(pattern); } if (expression instanceof LocalDateTime) { return create((LocalDateTime) expression).toDisp(pattern); } if (expression instanceof java.util.Date) { return create((java.util.Date) expression).toDisp(pattern); } if (expression instanceof String) { return create((String) expression).toDisp(pattern); } String msg = "First argument as two arguments should be LocalDate or LocalDateTime or Date or String(expression): " + expression; throw new TemplateProcessingException(msg); } String msg = "Second argument as two arguments should be String(pattern): objPattern=" + objPattern; throw new TemplateProcessingException(msg); }
java
public String format(Object expression, Object objPattern) { if (objPattern instanceof String) { final String pattern = filterPattern((String) objPattern); if (expression == null) { return null; } if (expression instanceof LocalDate) { return create((LocalDate) expression).toDisp(pattern); } if (expression instanceof LocalDateTime) { return create((LocalDateTime) expression).toDisp(pattern); } if (expression instanceof java.util.Date) { return create((java.util.Date) expression).toDisp(pattern); } if (expression instanceof String) { return create((String) expression).toDisp(pattern); } String msg = "First argument as two arguments should be LocalDate or LocalDateTime or Date or String(expression): " + expression; throw new TemplateProcessingException(msg); } String msg = "Second argument as two arguments should be String(pattern): objPattern=" + objPattern; throw new TemplateProcessingException(msg); }
[ "public", "String", "format", "(", "Object", "expression", ",", "Object", "objPattern", ")", "{", "if", "(", "objPattern", "instanceof", "String", ")", "{", "final", "String", "pattern", "=", "filterPattern", "(", "(", "String", ")", "objPattern", ")", ";", ...
Get formatted date string. @param expression Date expression. (NullAllowed: if null, returns null) @param objPattern date format pattern. (NotNull) @return formatted date string. (NullAllowed: if expression is null.)
[ "Get", "formatted", "date", "string", "." ]
d340a6e7eeddfcc9177052958c383fecd4a7fefa
https://github.com/lastaflute/lasta-thymeleaf/blob/d340a6e7eeddfcc9177052958c383fecd4a7fefa/src/main/java/org/lastaflute/thymeleaf/expression/HandyDateExpressionObject.java#L230-L254
train
cloudiator/sword
drivers/jclouds/src/main/java/de/uniulm/omi/cloudiator/sword/drivers/jclouds/strategy/JCloudsCreateVirtualMachineStrategy.java
JCloudsCreateVirtualMachineStrategy.enrich
private NodeMetadata enrich(NodeMetadata nodeMetadata, Template template) { final NodeMetadataBuilder nodeMetadataBuilder = NodeMetadataBuilder .fromNodeMetadata(nodeMetadata); if (nodeMetadata.getHardware() == null) { nodeMetadataBuilder.hardware(template.getHardware()); } if (nodeMetadata.getImageId() == null) { nodeMetadataBuilder.imageId(template.getImage().getId()); } if (nodeMetadata.getLocation() == null) { nodeMetadataBuilder.location(template.getLocation()); } return nodeMetadataBuilder.build(); }
java
private NodeMetadata enrich(NodeMetadata nodeMetadata, Template template) { final NodeMetadataBuilder nodeMetadataBuilder = NodeMetadataBuilder .fromNodeMetadata(nodeMetadata); if (nodeMetadata.getHardware() == null) { nodeMetadataBuilder.hardware(template.getHardware()); } if (nodeMetadata.getImageId() == null) { nodeMetadataBuilder.imageId(template.getImage().getId()); } if (nodeMetadata.getLocation() == null) { nodeMetadataBuilder.location(template.getLocation()); } return nodeMetadataBuilder.build(); }
[ "private", "NodeMetadata", "enrich", "(", "NodeMetadata", "nodeMetadata", ",", "Template", "template", ")", "{", "final", "NodeMetadataBuilder", "nodeMetadataBuilder", "=", "NodeMetadataBuilder", ".", "fromNodeMetadata", "(", "nodeMetadata", ")", ";", "if", "(", "node...
Enriches the spawned vm with information of the template if the spawned vm does not contain information about hardware, image or location @param nodeMetadata the node to enrich @param template the template used to spawn the node @return the enriched node
[ "Enriches", "the", "spawned", "vm", "with", "information", "of", "the", "template", "if", "the", "spawned", "vm", "does", "not", "contain", "information", "about", "hardware", "image", "or", "location" ]
b7808ea2776c6d70d439342c403369dfc5bb26bc
https://github.com/cloudiator/sword/blob/b7808ea2776c6d70d439342c403369dfc5bb26bc/drivers/jclouds/src/main/java/de/uniulm/omi/cloudiator/sword/drivers/jclouds/strategy/JCloudsCreateVirtualMachineStrategy.java#L117-L134
train
cloudiator/sword
drivers/jclouds/src/main/java/de/uniulm/omi/cloudiator/sword/drivers/jclouds/strategy/JCloudsCreateVirtualMachineStrategy.java
JCloudsCreateVirtualMachineStrategy.modifyTemplateOptions
protected org.jclouds.compute.options.TemplateOptions modifyTemplateOptions( VirtualMachineTemplate originalVirtualMachineTemplate, org.jclouds.compute.options.TemplateOptions originalTemplateOptions) { return originalTemplateOptions; }
java
protected org.jclouds.compute.options.TemplateOptions modifyTemplateOptions( VirtualMachineTemplate originalVirtualMachineTemplate, org.jclouds.compute.options.TemplateOptions originalTemplateOptions) { return originalTemplateOptions; }
[ "protected", "org", ".", "jclouds", ".", "compute", ".", "options", ".", "TemplateOptions", "modifyTemplateOptions", "(", "VirtualMachineTemplate", "originalVirtualMachineTemplate", ",", "org", ".", "jclouds", ".", "compute", ".", "options", ".", "TemplateOptions", "o...
Extension point for the template options. Allows the subclass to replace the jclouds template options object with a new one before it is passed to the template builder. @param originalVirtualMachineTemplate the original virtual machine template @param originalTemplateOptions the original template options @return the replaced template options.
[ "Extension", "point", "for", "the", "template", "options", ".", "Allows", "the", "subclass", "to", "replace", "the", "jclouds", "template", "options", "object", "with", "a", "new", "one", "before", "it", "is", "passed", "to", "the", "template", "builder", "....
b7808ea2776c6d70d439342c403369dfc5bb26bc
https://github.com/cloudiator/sword/blob/b7808ea2776c6d70d439342c403369dfc5bb26bc/drivers/jclouds/src/main/java/de/uniulm/omi/cloudiator/sword/drivers/jclouds/strategy/JCloudsCreateVirtualMachineStrategy.java#L156-L160
train
duracloud/snapshot
snapshot-service-impl/src/main/java/org/duracloud/snapshot/service/impl/SpaceManifestSnapshotManifestVerifier.java
SpaceManifestSnapshotManifestVerifier.verify
public boolean verify() { this.errors = new LinkedList<>(); try (BufferedReader reader = new BufferedReader(new InputStreamReader(generator.generate(spaceId, ManifestFormat.TSV)))) { WriteOnlyStringSet snapshotManifest = ManifestFileHelper.loadManifestSetFromFile(this.md5Manifest); log.info("loaded manifest set into memory."); ManifestFormatter formatter = new TsvManifestFormatter(); // skip header if (formatter.getHeader() != null) { reader.readLine(); } String line = null; int stitchedManifestCount = 0; while ((line = reader.readLine()) != null) { ManifestItem item = formatter.parseLine(line); String contentId = item.getContentId(); if (!contentId.equals(Constants.SNAPSHOT_PROPS_FILENAME)) { if (!snapshotManifest.contains(ManifestFileHelper.formatManifestSetString(contentId, item.getContentChecksum()))) { String message = "Snapshot manifest does not contain content id/checksum combination (" + contentId + ", " + item.getContentChecksum(); errors.add(message); } stitchedManifestCount++; } } int snapshotCount = snapshotManifest.size(); if (stitchedManifestCount != snapshotCount) { String message = "Snapshot Manifest size (" + snapshotCount + ") does not equal DuraCloud Manifest (" + stitchedManifestCount + ")"; errors.add(message); log.error(message); } } catch (Exception e) { String message = "Failed to verify space manifest against snapshot manifest:" + e.getMessage(); errors.add(message); log.error(message, e); } log.info("verification complete. error count = {}", errors.size()); return getResult(errors); }
java
public boolean verify() { this.errors = new LinkedList<>(); try (BufferedReader reader = new BufferedReader(new InputStreamReader(generator.generate(spaceId, ManifestFormat.TSV)))) { WriteOnlyStringSet snapshotManifest = ManifestFileHelper.loadManifestSetFromFile(this.md5Manifest); log.info("loaded manifest set into memory."); ManifestFormatter formatter = new TsvManifestFormatter(); // skip header if (formatter.getHeader() != null) { reader.readLine(); } String line = null; int stitchedManifestCount = 0; while ((line = reader.readLine()) != null) { ManifestItem item = formatter.parseLine(line); String contentId = item.getContentId(); if (!contentId.equals(Constants.SNAPSHOT_PROPS_FILENAME)) { if (!snapshotManifest.contains(ManifestFileHelper.formatManifestSetString(contentId, item.getContentChecksum()))) { String message = "Snapshot manifest does not contain content id/checksum combination (" + contentId + ", " + item.getContentChecksum(); errors.add(message); } stitchedManifestCount++; } } int snapshotCount = snapshotManifest.size(); if (stitchedManifestCount != snapshotCount) { String message = "Snapshot Manifest size (" + snapshotCount + ") does not equal DuraCloud Manifest (" + stitchedManifestCount + ")"; errors.add(message); log.error(message); } } catch (Exception e) { String message = "Failed to verify space manifest against snapshot manifest:" + e.getMessage(); errors.add(message); log.error(message, e); } log.info("verification complete. error count = {}", errors.size()); return getResult(errors); }
[ "public", "boolean", "verify", "(", ")", "{", "this", ".", "errors", "=", "new", "LinkedList", "<>", "(", ")", ";", "try", "(", "BufferedReader", "reader", "=", "new", "BufferedReader", "(", "new", "InputStreamReader", "(", "generator", ".", "generate", "(...
Performs the verification. @return true if verification was a success. Otherwise false. Errors can be obtained by calling getErrors() after execution completes.
[ "Performs", "the", "verification", "." ]
7cb387b22fd4a9425087f654276138727c2c0b73
https://github.com/duracloud/snapshot/blob/7cb387b22fd4a9425087f654276138727c2c0b73/snapshot-service-impl/src/main/java/org/duracloud/snapshot/service/impl/SpaceManifestSnapshotManifestVerifier.java#L60-L106
train
cloudiator/sword
drivers/openstack4j/src/main/java/de/uniulm/omi/cloudiator/sword/drivers/openstack4j/internal/OsClientV3Factory.java
OsClientV3Factory.handleIdentifiers
@Nullable private static Identifiers handleIdentifiers(String domainIdOrName, String projectIdOrName, String endpoint, String userId, String password) { //we try all four cases and return the one that works Set<Identifiers> possibleIdentifiers = new HashSet<Identifiers>() {{ add(new Identifiers(Identifier.byName(domainIdOrName), Identifier.byName(projectIdOrName))); add(new Identifiers(Identifier.byId(domainIdOrName), Identifier.byId(projectIdOrName))); add(new Identifiers(Identifier.byId(domainIdOrName), Identifier.byName(projectIdOrName))); add(new Identifiers(Identifier.byName(domainIdOrName), Identifier.byId(projectIdOrName))); }}; for (Identifiers candidate : possibleIdentifiers) { try { authenticate(endpoint, userId, password, candidate.getDomain(), candidate.getProject()); } catch (AuthenticationException | ClientResponseException e) { continue; } return candidate; } return null; }
java
@Nullable private static Identifiers handleIdentifiers(String domainIdOrName, String projectIdOrName, String endpoint, String userId, String password) { //we try all four cases and return the one that works Set<Identifiers> possibleIdentifiers = new HashSet<Identifiers>() {{ add(new Identifiers(Identifier.byName(domainIdOrName), Identifier.byName(projectIdOrName))); add(new Identifiers(Identifier.byId(domainIdOrName), Identifier.byId(projectIdOrName))); add(new Identifiers(Identifier.byId(domainIdOrName), Identifier.byName(projectIdOrName))); add(new Identifiers(Identifier.byName(domainIdOrName), Identifier.byId(projectIdOrName))); }}; for (Identifiers candidate : possibleIdentifiers) { try { authenticate(endpoint, userId, password, candidate.getDomain(), candidate.getProject()); } catch (AuthenticationException | ClientResponseException e) { continue; } return candidate; } return null; }
[ "@", "Nullable", "private", "static", "Identifiers", "handleIdentifiers", "(", "String", "domainIdOrName", ",", "String", "projectIdOrName", ",", "String", "endpoint", ",", "String", "userId", ",", "String", "password", ")", "{", "//we try all four cases and return the ...
This method tries to determine if the authentication should happen by using the user provided information as domain ID or domain name resp. project ID or project name. It does so by brute forcing the four different possible combinations. Returns early on success. @param domainIdOrName the domain id or name @param projectIdOrName the project id or name @param endpoint the endpoint @param userId the user @param password the password of the user @return The valid identifiers if a valid combination exists or null if all combinations failed.
[ "This", "method", "tries", "to", "determine", "if", "the", "authentication", "should", "happen", "by", "using", "the", "user", "provided", "information", "as", "domain", "ID", "or", "domain", "name", "resp", ".", "project", "ID", "or", "project", "name", "."...
b7808ea2776c6d70d439342c403369dfc5bb26bc
https://github.com/cloudiator/sword/blob/b7808ea2776c6d70d439342c403369dfc5bb26bc/drivers/openstack4j/src/main/java/de/uniulm/omi/cloudiator/sword/drivers/openstack4j/internal/OsClientV3Factory.java#L67-L88
train
cloudiator/sword
core/src/main/java/de/uniulm/omi/cloudiator/sword/config/AbstractComputeModule.java
AbstractComputeModule.configure
@Override protected void configure() { bind(DiscoveryService.class).to(BaseDiscoveryService.class); bind(OperatingSystemDetectionStrategy.class) .to(NameSubstringBasedOperatingSystemDetectionStrategy.class); }
java
@Override protected void configure() { bind(DiscoveryService.class).to(BaseDiscoveryService.class); bind(OperatingSystemDetectionStrategy.class) .to(NameSubstringBasedOperatingSystemDetectionStrategy.class); }
[ "@", "Override", "protected", "void", "configure", "(", ")", "{", "bind", "(", "DiscoveryService", ".", "class", ")", ".", "to", "(", "BaseDiscoveryService", ".", "class", ")", ";", "bind", "(", "OperatingSystemDetectionStrategy", ".", "class", ")", ".", "to...
Can be extended to load own implementation of classes.
[ "Can", "be", "extended", "to", "load", "own", "implementation", "of", "classes", "." ]
b7808ea2776c6d70d439342c403369dfc5bb26bc
https://github.com/cloudiator/sword/blob/b7808ea2776c6d70d439342c403369dfc5bb26bc/core/src/main/java/de/uniulm/omi/cloudiator/sword/config/AbstractComputeModule.java#L57-L64
train
Jsondb/jsondb-core
src/main/java/io/jsondb/query/Update.java
Update.update
public static Update update(String key, Object value) { return new Update().set(key, value); }
java
public static Update update(String key, Object value) { return new Update().set(key, value); }
[ "public", "static", "Update", "update", "(", "String", "key", ",", "Object", "value", ")", "{", "return", "new", "Update", "(", ")", ".", "set", "(", "key", ",", "value", ")", ";", "}" ]
Static factory method to create an Update using the provided key @param key the field name for the update operation @param value the value to set for the field @return Updated object
[ "Static", "factory", "method", "to", "create", "an", "Update", "using", "the", "provided", "key" ]
c49654d1eee2ace4d5ca5be19730652a966ce7f4
https://github.com/Jsondb/jsondb-core/blob/c49654d1eee2ace4d5ca5be19730652a966ce7f4/src/main/java/io/jsondb/query/Update.java#L45-L47
train
Jsondb/jsondb-core
src/main/java/io/jsondb/crypto/CryptoUtil.java
CryptoUtil.encryptFields
public static void encryptFields(Object object, CollectionMetaData cmd, ICipher cipher) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException { for (String secretAnnotatedFieldName: cmd.getSecretAnnotatedFieldNames()) { Method getterMethod = cmd.getGetterMethodForFieldName(secretAnnotatedFieldName); Method setterMethod = cmd.getSetterMethodForFieldName(secretAnnotatedFieldName); String value; String encryptedValue = null; try { value = (String)getterMethod.invoke(object); if (null != value) { encryptedValue = cipher.encrypt(value); setterMethod.invoke(object, encryptedValue); } } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { logger.error("Error when invoking method for a @Secret annotated field", e); throw e; } } }
java
public static void encryptFields(Object object, CollectionMetaData cmd, ICipher cipher) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException { for (String secretAnnotatedFieldName: cmd.getSecretAnnotatedFieldNames()) { Method getterMethod = cmd.getGetterMethodForFieldName(secretAnnotatedFieldName); Method setterMethod = cmd.getSetterMethodForFieldName(secretAnnotatedFieldName); String value; String encryptedValue = null; try { value = (String)getterMethod.invoke(object); if (null != value) { encryptedValue = cipher.encrypt(value); setterMethod.invoke(object, encryptedValue); } } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { logger.error("Error when invoking method for a @Secret annotated field", e); throw e; } } }
[ "public", "static", "void", "encryptFields", "(", "Object", "object", ",", "CollectionMetaData", "cmd", ",", "ICipher", "cipher", ")", "throws", "IllegalAccessException", ",", "IllegalArgumentException", ",", "InvocationTargetException", "{", "for", "(", "String", "se...
A utility method to encrypt the value of field marked by the @Secret annotation using its setter/mutator method. @param object the actual Object representing the POJO we want the Id of. @param cmd the CollectionMetaData object from which we can obtain the list containing names of fields which have the @Secret annotation @param cipher the actual cipher implementation to use @throws IllegalAccessException Error when invoking method for a @Secret annotated field due to permissions @throws IllegalArgumentException Error when invoking method for a @Secret annotated field due to wrong arguments @throws InvocationTargetException Error when invoking method for a @Secret annotated field, the method threw a exception
[ "A", "utility", "method", "to", "encrypt", "the", "value", "of", "field", "marked", "by", "the" ]
c49654d1eee2ace4d5ca5be19730652a966ce7f4
https://github.com/Jsondb/jsondb-core/blob/c49654d1eee2ace4d5ca5be19730652a966ce7f4/src/main/java/io/jsondb/crypto/CryptoUtil.java#L58-L77
train
Jsondb/jsondb-core
src/main/java/io/jsondb/crypto/CryptoUtil.java
CryptoUtil.decryptFields
public static void decryptFields(Object object, CollectionMetaData cmd, ICipher cipher) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException { for (String secretAnnotatedFieldName: cmd.getSecretAnnotatedFieldNames()) { Method getterMethod = cmd.getGetterMethodForFieldName(secretAnnotatedFieldName); Method setterMethod = cmd.getSetterMethodForFieldName(secretAnnotatedFieldName); String value; String decryptedValue = null; try { value = (String)getterMethod.invoke(object); if (null != value) { decryptedValue = cipher.decrypt(value); setterMethod.invoke(object, decryptedValue); } } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { logger.error("Error when invoking method for a @Secret annotated field", e); throw e; } } }
java
public static void decryptFields(Object object, CollectionMetaData cmd, ICipher cipher) throws IllegalAccessException, IllegalArgumentException, InvocationTargetException { for (String secretAnnotatedFieldName: cmd.getSecretAnnotatedFieldNames()) { Method getterMethod = cmd.getGetterMethodForFieldName(secretAnnotatedFieldName); Method setterMethod = cmd.getSetterMethodForFieldName(secretAnnotatedFieldName); String value; String decryptedValue = null; try { value = (String)getterMethod.invoke(object); if (null != value) { decryptedValue = cipher.decrypt(value); setterMethod.invoke(object, decryptedValue); } } catch (IllegalAccessException | IllegalArgumentException | InvocationTargetException e) { logger.error("Error when invoking method for a @Secret annotated field", e); throw e; } } }
[ "public", "static", "void", "decryptFields", "(", "Object", "object", ",", "CollectionMetaData", "cmd", ",", "ICipher", "cipher", ")", "throws", "IllegalAccessException", ",", "IllegalArgumentException", ",", "InvocationTargetException", "{", "for", "(", "String", "se...
A utility method to decrypt the value of field marked by the @Secret annotation using its setter/mutator method. @param object the actual Object representing the POJO we want the Id of. @param cmd the CollectionMetaData object from which we can obtain the list containing names of fields which have the @Secret annotation @param cipher the actual cipher implementation to use @throws IllegalAccessException Error when invoking method for a @Secret annotated field due to permissions @throws IllegalArgumentException Error when invoking method for a @Secret annotated field due to wrong arguments @throws InvocationTargetException Error when invoking method for a @Secret annotated field, the method threw a exception
[ "A", "utility", "method", "to", "decrypt", "the", "value", "of", "field", "marked", "by", "the" ]
c49654d1eee2ace4d5ca5be19730652a966ce7f4
https://github.com/Jsondb/jsondb-core/blob/c49654d1eee2ace4d5ca5be19730652a966ce7f4/src/main/java/io/jsondb/crypto/CryptoUtil.java#L90-L110
train
Jsondb/jsondb-core
src/main/java/io/jsondb/crypto/CryptoUtil.java
CryptoUtil.generate128BitKey
public static String generate128BitKey(String password, String salt) throws NoSuchAlgorithmException, UnsupportedEncodingException, InvalidKeySpecException { SecretKeyFactory factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA256"); KeySpec spec = new PBEKeySpec(password.toCharArray(), salt.getBytes(), 65536, 128); SecretKey key = factory.generateSecret(spec); byte[] keybyte = key.getEncoded(); return Base64.getEncoder().encodeToString(keybyte); }
java
public static String generate128BitKey(String password, String salt) throws NoSuchAlgorithmException, UnsupportedEncodingException, InvalidKeySpecException { SecretKeyFactory factory = SecretKeyFactory.getInstance("PBKDF2WithHmacSHA256"); KeySpec spec = new PBEKeySpec(password.toCharArray(), salt.getBytes(), 65536, 128); SecretKey key = factory.generateSecret(spec); byte[] keybyte = key.getEncoded(); return Base64.getEncoder().encodeToString(keybyte); }
[ "public", "static", "String", "generate128BitKey", "(", "String", "password", ",", "String", "salt", ")", "throws", "NoSuchAlgorithmException", ",", "UnsupportedEncodingException", ",", "InvalidKeySpecException", "{", "SecretKeyFactory", "factory", "=", "SecretKeyFactory", ...
Utility method to help generate a strong 128 bit Key to be used for the DefaultAESCBCCipher. Note: This function is only provided as a utility to generate strong password it should be used statically to generate a key and then the key should be captured and used in your program. This function defaults to using 65536 iterations and 128 bits for key size. If you wish to use 256 bits key size then ensure that you have Java Cryptography Extension (JCE) Unlimited Strength Jurisdiction Policy installed and change the last argument to {@link javax.crypto.spec.PBEKeySpec} below to 256 @param password A password which acts as a seed for generation of the key @param salt A salt used in combination with the password for the generation of the key @return A Base64 Encoded string representing the 128 bit key @throws NoSuchAlgorithmException if the KeyFactory algorithm is not found in available crypto providers @throws UnsupportedEncodingException if the char encoding of the salt is not known. @throws InvalidKeySpecException invalid generated key
[ "Utility", "method", "to", "help", "generate", "a", "strong", "128", "bit", "Key", "to", "be", "used", "for", "the", "DefaultAESCBCCipher", "." ]
c49654d1eee2ace4d5ca5be19730652a966ce7f4
https://github.com/Jsondb/jsondb-core/blob/c49654d1eee2ace4d5ca5be19730652a966ce7f4/src/main/java/io/jsondb/crypto/CryptoUtil.java#L131-L140
train
Jsondb/jsondb-core
src/main/java/io/jsondb/query/ddl/CollectionSchemaUpdate.java
CollectionSchemaUpdate.update
public static CollectionSchemaUpdate update(String key, IOperation operation) { return new CollectionSchemaUpdate().set(key, operation); }
java
public static CollectionSchemaUpdate update(String key, IOperation operation) { return new CollectionSchemaUpdate().set(key, operation); }
[ "public", "static", "CollectionSchemaUpdate", "update", "(", "String", "key", ",", "IOperation", "operation", ")", "{", "return", "new", "CollectionSchemaUpdate", "(", ")", ".", "set", "(", "key", ",", "operation", ")", ";", "}" ]
Static factory method to create an CollectionUpdate for the specified key @param key: JSON attribute to update @param operation: operation to carry out on the attribute @return the updated CollectionSchemaUpdate
[ "Static", "factory", "method", "to", "create", "an", "CollectionUpdate", "for", "the", "specified", "key" ]
c49654d1eee2ace4d5ca5be19730652a966ce7f4
https://github.com/Jsondb/jsondb-core/blob/c49654d1eee2ace4d5ca5be19730652a966ce7f4/src/main/java/io/jsondb/query/ddl/CollectionSchemaUpdate.java#L48-L50
train
Jsondb/jsondb-core
src/main/java/io/jsondb/query/ddl/CollectionSchemaUpdate.java
CollectionSchemaUpdate.set
public CollectionSchemaUpdate set(String key, IOperation operation) { collectionUpdateData.put(key, operation); return this; }
java
public CollectionSchemaUpdate set(String key, IOperation operation) { collectionUpdateData.put(key, operation); return this; }
[ "public", "CollectionSchemaUpdate", "set", "(", "String", "key", ",", "IOperation", "operation", ")", "{", "collectionUpdateData", ".", "put", "(", "key", ",", "operation", ")", ";", "return", "this", ";", "}" ]
A method to set a new Operation for a key. It may be of type ADD, RENAME or DELETE. Only one operation per key can be specified. Attempt to add a second operation for a any key will override the first one. Attempt to add a ADD operation for a key which already exists will have no effect. Attempt to add a DELETE operation for akey which does not exist will have no effect. @param key (a.k.a JSON Field name) for which operation is being added @param operation operation to perform @return the updated CollectionSchemaUpdate
[ "A", "method", "to", "set", "a", "new", "Operation", "for", "a", "key", ".", "It", "may", "be", "of", "type", "ADD", "RENAME", "or", "DELETE", ".", "Only", "one", "operation", "per", "key", "can", "be", "specified", ".", "Attempt", "to", "add", "a", ...
c49654d1eee2ace4d5ca5be19730652a966ce7f4
https://github.com/Jsondb/jsondb-core/blob/c49654d1eee2ace4d5ca5be19730652a966ce7f4/src/main/java/io/jsondb/query/ddl/CollectionSchemaUpdate.java#L62-L65
train
Jsondb/jsondb-core
src/main/java/io/jsondb/query/ddl/CollectionSchemaUpdate.java
CollectionSchemaUpdate.getAddOperations
public Map<String, AddOperation> getAddOperations() { Map<String, AddOperation> addOperations = new TreeMap<String, AddOperation>(); for (Entry<String, IOperation> entry : collectionUpdateData.entrySet()) { String key = entry.getKey(); IOperation op = entry.getValue(); if (op.getOperationType().equals(Type.ADD)) { AddOperation aop = (AddOperation)op; if (null != aop.getDefaultValue()) { addOperations.put(key, aop); } } } return addOperations; }
java
public Map<String, AddOperation> getAddOperations() { Map<String, AddOperation> addOperations = new TreeMap<String, AddOperation>(); for (Entry<String, IOperation> entry : collectionUpdateData.entrySet()) { String key = entry.getKey(); IOperation op = entry.getValue(); if (op.getOperationType().equals(Type.ADD)) { AddOperation aop = (AddOperation)op; if (null != aop.getDefaultValue()) { addOperations.put(key, aop); } } } return addOperations; }
[ "public", "Map", "<", "String", ",", "AddOperation", ">", "getAddOperations", "(", ")", "{", "Map", "<", "String", ",", "AddOperation", ">", "addOperations", "=", "new", "TreeMap", "<", "String", ",", "AddOperation", ">", "(", ")", ";", "for", "(", "Entr...
Returns a Map of ADD operations which have a non-null default value specified. @return Map of ADD operations which have a non-null default value specified
[ "Returns", "a", "Map", "of", "ADD", "operations", "which", "have", "a", "non", "-", "null", "default", "value", "specified", "." ]
c49654d1eee2ace4d5ca5be19730652a966ce7f4
https://github.com/Jsondb/jsondb-core/blob/c49654d1eee2ace4d5ca5be19730652a966ce7f4/src/main/java/io/jsondb/query/ddl/CollectionSchemaUpdate.java#L76-L89
train
Jsondb/jsondb-core
src/main/java/io/jsondb/query/ddl/CollectionSchemaUpdate.java
CollectionSchemaUpdate.getRenameOperations
public Map<String, RenameOperation> getRenameOperations() { Map<String, RenameOperation> renOperations = new TreeMap<String, RenameOperation>(); for (Entry<String, IOperation> entry : collectionUpdateData.entrySet()) { String key = entry.getKey(); IOperation op = entry.getValue(); if (op.getOperationType().equals(Type.RENAME)) { renOperations.put(key, (RenameOperation)op); } } return renOperations; }
java
public Map<String, RenameOperation> getRenameOperations() { Map<String, RenameOperation> renOperations = new TreeMap<String, RenameOperation>(); for (Entry<String, IOperation> entry : collectionUpdateData.entrySet()) { String key = entry.getKey(); IOperation op = entry.getValue(); if (op.getOperationType().equals(Type.RENAME)) { renOperations.put(key, (RenameOperation)op); } } return renOperations; }
[ "public", "Map", "<", "String", ",", "RenameOperation", ">", "getRenameOperations", "(", ")", "{", "Map", "<", "String", ",", "RenameOperation", ">", "renOperations", "=", "new", "TreeMap", "<", "String", ",", "RenameOperation", ">", "(", ")", ";", "for", ...
Returns a Map of RENAME operations. @return Map of RENAME operations which have a non-null default value specified
[ "Returns", "a", "Map", "of", "RENAME", "operations", "." ]
c49654d1eee2ace4d5ca5be19730652a966ce7f4
https://github.com/Jsondb/jsondb-core/blob/c49654d1eee2ace4d5ca5be19730652a966ce7f4/src/main/java/io/jsondb/query/ddl/CollectionSchemaUpdate.java#L96-L106
train
Jsondb/jsondb-core
src/main/java/io/jsondb/query/ddl/CollectionSchemaUpdate.java
CollectionSchemaUpdate.getDeleteOperations
public Map<String, DeleteOperation> getDeleteOperations() { Map<String, DeleteOperation> delOperations = new TreeMap<String, DeleteOperation>(); for (Entry<String, IOperation> entry : collectionUpdateData.entrySet()) { String key = entry.getKey(); IOperation op = entry.getValue(); if (op.getOperationType().equals(Type.DELETE)) { delOperations.put(key, (DeleteOperation)op); } } return delOperations; }
java
public Map<String, DeleteOperation> getDeleteOperations() { Map<String, DeleteOperation> delOperations = new TreeMap<String, DeleteOperation>(); for (Entry<String, IOperation> entry : collectionUpdateData.entrySet()) { String key = entry.getKey(); IOperation op = entry.getValue(); if (op.getOperationType().equals(Type.DELETE)) { delOperations.put(key, (DeleteOperation)op); } } return delOperations; }
[ "public", "Map", "<", "String", ",", "DeleteOperation", ">", "getDeleteOperations", "(", ")", "{", "Map", "<", "String", ",", "DeleteOperation", ">", "delOperations", "=", "new", "TreeMap", "<", "String", ",", "DeleteOperation", ">", "(", ")", ";", "for", ...
Returns a Map of DELETE operations. @return Map of DELETE operations which have a non-null default value specified
[ "Returns", "a", "Map", "of", "DELETE", "operations", "." ]
c49654d1eee2ace4d5ca5be19730652a966ce7f4
https://github.com/Jsondb/jsondb-core/blob/c49654d1eee2ace4d5ca5be19730652a966ce7f4/src/main/java/io/jsondb/query/ddl/CollectionSchemaUpdate.java#L113-L123
train
Jsondb/jsondb-core
src/main/java/io/jsondb/Util.java
Util.getIdForEntity
protected static Object getIdForEntity(Object document, Method getterMethodForId) { Object id = null; if (null != getterMethodForId) { try { id = getterMethodForId.invoke(document); } catch (IllegalAccessException e) { logger.error("Failed to invoke getter method for a idAnnotated field due to permissions", e); throw new InvalidJsonDbApiUsageException("Failed to invoke getter method for a idAnnotated field due to permissions", e); } catch (IllegalArgumentException e) { logger.error("Failed to invoke getter method for a idAnnotated field due to wrong arguments", e); throw new InvalidJsonDbApiUsageException("Failed to invoke getter method for a idAnnotated field due to wrong arguments", e); } catch (InvocationTargetException e) { logger.error("Failed to invoke getter method for a idAnnotated field, the method threw a exception", e); throw new InvalidJsonDbApiUsageException("Failed to invoke getter method for a idAnnotated field, the method threw a exception", e); } } return id; }
java
protected static Object getIdForEntity(Object document, Method getterMethodForId) { Object id = null; if (null != getterMethodForId) { try { id = getterMethodForId.invoke(document); } catch (IllegalAccessException e) { logger.error("Failed to invoke getter method for a idAnnotated field due to permissions", e); throw new InvalidJsonDbApiUsageException("Failed to invoke getter method for a idAnnotated field due to permissions", e); } catch (IllegalArgumentException e) { logger.error("Failed to invoke getter method for a idAnnotated field due to wrong arguments", e); throw new InvalidJsonDbApiUsageException("Failed to invoke getter method for a idAnnotated field due to wrong arguments", e); } catch (InvocationTargetException e) { logger.error("Failed to invoke getter method for a idAnnotated field, the method threw a exception", e); throw new InvalidJsonDbApiUsageException("Failed to invoke getter method for a idAnnotated field, the method threw a exception", e); } } return id; }
[ "protected", "static", "Object", "getIdForEntity", "(", "Object", "document", ",", "Method", "getterMethodForId", ")", "{", "Object", "id", "=", "null", ";", "if", "(", "null", "!=", "getterMethodForId", ")", "{", "try", "{", "id", "=", "getterMethodForId", ...
A utility method to extract the value of field marked by the @Id annotation using its getter/accessor method. @param document the actual Object representing the POJO we want the Id of. @param getterMethodForId the Method that is the accessor for the attributed with @Id annotation @return the actual Id or if none exists then a new random UUID
[ "A", "utility", "method", "to", "extract", "the", "value", "of", "field", "marked", "by", "the" ]
c49654d1eee2ace4d5ca5be19730652a966ce7f4
https://github.com/Jsondb/jsondb-core/blob/c49654d1eee2ace4d5ca5be19730652a966ce7f4/src/main/java/io/jsondb/Util.java#L107-L124
train
Jsondb/jsondb-core
src/main/java/io/jsondb/Util.java
Util.deepCopy
protected static Object deepCopy(Object fromBean) { ByteArrayOutputStream bos = new ByteArrayOutputStream(); XMLEncoder out = new XMLEncoder(bos); out.writeObject(fromBean); out.close(); ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray()); XMLDecoder in = new XMLDecoder(bis, null, null, JsonDBTemplate.class.getClassLoader()); Object toBean = in.readObject(); in.close(); return toBean; }
java
protected static Object deepCopy(Object fromBean) { ByteArrayOutputStream bos = new ByteArrayOutputStream(); XMLEncoder out = new XMLEncoder(bos); out.writeObject(fromBean); out.close(); ByteArrayInputStream bis = new ByteArrayInputStream(bos.toByteArray()); XMLDecoder in = new XMLDecoder(bis, null, null, JsonDBTemplate.class.getClassLoader()); Object toBean = in.readObject(); in.close(); return toBean; }
[ "protected", "static", "Object", "deepCopy", "(", "Object", "fromBean", ")", "{", "ByteArrayOutputStream", "bos", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "XMLEncoder", "out", "=", "new", "XMLEncoder", "(", "bos", ")", ";", "out", ".", "writeObject"...
A utility method that creates a deep clone of the specified object. There is no other way of doing this reliably. @param fromBean java bean to be cloned. @return a new java bean cloned from fromBean.
[ "A", "utility", "method", "that", "creates", "a", "deep", "clone", "of", "the", "specified", "object", ".", "There", "is", "no", "other", "way", "of", "doing", "this", "reliably", "." ]
c49654d1eee2ace4d5ca5be19730652a966ce7f4
https://github.com/Jsondb/jsondb-core/blob/c49654d1eee2ace4d5ca5be19730652a966ce7f4/src/main/java/io/jsondb/Util.java#L177-L188
train
Jsondb/jsondb-core
src/main/java/io/jsondb/Util.java
Util.stampVersion
public static boolean stampVersion(JsonDBConfig dbConfig, File f, String version) { FileOutputStream fos = null; OutputStreamWriter osr = null; BufferedWriter writer = null; try { fos = new FileOutputStream(f); osr = new OutputStreamWriter(fos, dbConfig.getCharset()); writer = new BufferedWriter(osr); String versionData = dbConfig.getObjectMapper().writeValueAsString(new SchemaVersion(version)); writer.write(versionData); writer.newLine(); } catch (JsonProcessingException e) { logger.error("Failed to serialize SchemaVersion to Json string", e); return false; } catch (IOException e) { logger.error("Failed to write SchemaVersion to the new .json file {}", f, e); return false; } finally { try { writer.close(); } catch (IOException e) { logger.error("Failed to close BufferedWriter for new collection file {}", f, e); } try { osr.close(); } catch (IOException e) { logger.error("Failed to close OutputStreamWriter for new collection file {}", f, e); } try { fos.close(); } catch (IOException e) { logger.error("Failed to close FileOutputStream for new collection file {}", f, e); } } return true; }
java
public static boolean stampVersion(JsonDBConfig dbConfig, File f, String version) { FileOutputStream fos = null; OutputStreamWriter osr = null; BufferedWriter writer = null; try { fos = new FileOutputStream(f); osr = new OutputStreamWriter(fos, dbConfig.getCharset()); writer = new BufferedWriter(osr); String versionData = dbConfig.getObjectMapper().writeValueAsString(new SchemaVersion(version)); writer.write(versionData); writer.newLine(); } catch (JsonProcessingException e) { logger.error("Failed to serialize SchemaVersion to Json string", e); return false; } catch (IOException e) { logger.error("Failed to write SchemaVersion to the new .json file {}", f, e); return false; } finally { try { writer.close(); } catch (IOException e) { logger.error("Failed to close BufferedWriter for new collection file {}", f, e); } try { osr.close(); } catch (IOException e) { logger.error("Failed to close OutputStreamWriter for new collection file {}", f, e); } try { fos.close(); } catch (IOException e) { logger.error("Failed to close FileOutputStream for new collection file {}", f, e); } } return true; }
[ "public", "static", "boolean", "stampVersion", "(", "JsonDBConfig", "dbConfig", ",", "File", "f", ",", "String", "version", ")", "{", "FileOutputStream", "fos", "=", "null", ";", "OutputStreamWriter", "osr", "=", "null", ";", "BufferedWriter", "writer", "=", "...
Utility to stamp the version into a newly created .json File This method is expected to be invoked on a newly created .json file before it is usable. So no locking code required. @param dbConfig all the settings used by Json DB @param f the target .json file on which to stamp the version @param version the actual version string to stamp @return true if success.
[ "Utility", "to", "stamp", "the", "version", "into", "a", "newly", "created", ".", "json", "File", "This", "method", "is", "expected", "to", "be", "invoked", "on", "a", "newly", "created", ".", "json", "file", "before", "it", "is", "usable", ".", "So", ...
c49654d1eee2ace4d5ca5be19730652a966ce7f4
https://github.com/Jsondb/jsondb-core/blob/c49654d1eee2ace4d5ca5be19730652a966ce7f4/src/main/java/io/jsondb/Util.java#L200-L237
train
Jsondb/jsondb-core
src/main/java/io/jsondb/crypto/DefaultAESCBCCipher.java
DefaultAESCBCCipher.decrypt
@Override public String decrypt(String cipherText) { this.decryptionLock.lock(); try{ String decryptedValue = null; try { byte[] bytes = Base64.getDecoder().decode(cipherText); decryptedValue = new String(decryptCipher.doFinal(bytes), charset); } catch (UnsupportedEncodingException | IllegalBlockSizeException | BadPaddingException e) { logger.error("DefaultAESCBCCipher failed to decrypt text", e); throw new JsonDBException("DefaultAESCBCCipher failed to decrypt text", e); } return decryptedValue; } finally{ this.decryptionLock.unlock(); } }
java
@Override public String decrypt(String cipherText) { this.decryptionLock.lock(); try{ String decryptedValue = null; try { byte[] bytes = Base64.getDecoder().decode(cipherText); decryptedValue = new String(decryptCipher.doFinal(bytes), charset); } catch (UnsupportedEncodingException | IllegalBlockSizeException | BadPaddingException e) { logger.error("DefaultAESCBCCipher failed to decrypt text", e); throw new JsonDBException("DefaultAESCBCCipher failed to decrypt text", e); } return decryptedValue; } finally{ this.decryptionLock.unlock(); } }
[ "@", "Override", "public", "String", "decrypt", "(", "String", "cipherText", ")", "{", "this", ".", "decryptionLock", ".", "lock", "(", ")", ";", "try", "{", "String", "decryptedValue", "=", "null", ";", "try", "{", "byte", "[", "]", "bytes", "=", "Bas...
A method to decrypt the provided cipher text. @param cipherText AES encrypted cipherText @return decrypted text
[ "A", "method", "to", "decrypt", "the", "provided", "cipher", "text", "." ]
c49654d1eee2ace4d5ca5be19730652a966ce7f4
https://github.com/Jsondb/jsondb-core/blob/c49654d1eee2ace4d5ca5be19730652a966ce7f4/src/main/java/io/jsondb/crypto/DefaultAESCBCCipher.java#L180-L196
train
Jsondb/jsondb-core
src/main/java/io/jsondb/DefaultSchemaVersionComparator.java
DefaultSchemaVersionComparator.compare
@Override public int compare(String expected, String actual) { String[] vals1 = expected.split("\\."); String[] vals2 = actual.split("\\."); int i = 0; while (i < vals1.length && i < vals2.length && vals1[i].equals(vals2[i])) { i++; } if (i < vals1.length && i < vals2.length) { int diff = Integer.valueOf(vals1[i]).compareTo(Integer.valueOf(vals2[i])); return Integer.signum(diff); } else { return Integer.signum(vals1.length - vals2.length); } }
java
@Override public int compare(String expected, String actual) { String[] vals1 = expected.split("\\."); String[] vals2 = actual.split("\\."); int i = 0; while (i < vals1.length && i < vals2.length && vals1[i].equals(vals2[i])) { i++; } if (i < vals1.length && i < vals2.length) { int diff = Integer.valueOf(vals1[i]).compareTo(Integer.valueOf(vals2[i])); return Integer.signum(diff); } else { return Integer.signum(vals1.length - vals2.length); } }
[ "@", "Override", "public", "int", "compare", "(", "String", "expected", ",", "String", "actual", ")", "{", "String", "[", "]", "vals1", "=", "expected", ".", "split", "(", "\"\\\\.\"", ")", ";", "String", "[", "]", "vals2", "=", "actual", ".", "split",...
compare the expected version with the actual version. Checkout: http://stackoverflow.com/questions/6701948/efficient-way-to-compare-version-strings-in-java @param expected the version that is obtained from @Document annotation @param actual the version that is read from the .json file @return a negative integer, zero, or a positive integer as the first argument is less than, equal to, or greater than the second.
[ "compare", "the", "expected", "version", "with", "the", "actual", "version", "." ]
c49654d1eee2ace4d5ca5be19730652a966ce7f4
https://github.com/Jsondb/jsondb-core/blob/c49654d1eee2ace4d5ca5be19730652a966ce7f4/src/main/java/io/jsondb/DefaultSchemaVersionComparator.java#L44-L60
train
cognitect/transit-java
src/main/java/com/cognitect/transit/TransitFactory.java
TransitFactory.keyword
public static Keyword keyword(Object o) { if (o instanceof Keyword) return (Keyword) o; else if (o instanceof String) { String s = (String) o; if (s.charAt(0) == ':') return new KeywordImpl(s.substring(1)); else return new KeywordImpl(s); } else throw new IllegalArgumentException("Cannot make keyword from " + o.getClass().getSimpleName()); }
java
public static Keyword keyword(Object o) { if (o instanceof Keyword) return (Keyword) o; else if (o instanceof String) { String s = (String) o; if (s.charAt(0) == ':') return new KeywordImpl(s.substring(1)); else return new KeywordImpl(s); } else throw new IllegalArgumentException("Cannot make keyword from " + o.getClass().getSimpleName()); }
[ "public", "static", "Keyword", "keyword", "(", "Object", "o", ")", "{", "if", "(", "o", "instanceof", "Keyword", ")", "return", "(", "Keyword", ")", "o", ";", "else", "if", "(", "o", "instanceof", "String", ")", "{", "String", "s", "=", "(", "String"...
Converts a string or keyword to a keyword @param o A string or a keyword @return a keyword
[ "Converts", "a", "string", "or", "keyword", "to", "a", "keyword" ]
a1d5edc2862fe9469c51483b9c53dbf6534e9c43
https://github.com/cognitect/transit-java/blob/a1d5edc2862fe9469c51483b9c53dbf6534e9c43/src/main/java/com/cognitect/transit/TransitFactory.java#L177-L188
train
cognitect/transit-java
src/main/java/com/cognitect/transit/TransitFactory.java
TransitFactory.symbol
public static Symbol symbol(Object o) { if (o instanceof Symbol) return (Symbol) o; else if (o instanceof String) { String s = (String) o; if (s.charAt(0) == ':') return new SymbolImpl(s.substring(1)); else return new SymbolImpl(s); } else throw new IllegalArgumentException("Cannot make symbol from " + o.getClass().getSimpleName()); }
java
public static Symbol symbol(Object o) { if (o instanceof Symbol) return (Symbol) o; else if (o instanceof String) { String s = (String) o; if (s.charAt(0) == ':') return new SymbolImpl(s.substring(1)); else return new SymbolImpl(s); } else throw new IllegalArgumentException("Cannot make symbol from " + o.getClass().getSimpleName()); }
[ "public", "static", "Symbol", "symbol", "(", "Object", "o", ")", "{", "if", "(", "o", "instanceof", "Symbol", ")", "return", "(", "Symbol", ")", "o", ";", "else", "if", "(", "o", "instanceof", "String", ")", "{", "String", "s", "=", "(", "String", ...
Converts a string or a symbol to a symbol @param o a string or a symbol @return a symbol
[ "Converts", "a", "string", "or", "a", "symbol", "to", "a", "symbol" ]
a1d5edc2862fe9469c51483b9c53dbf6534e9c43
https://github.com/cognitect/transit-java/blob/a1d5edc2862fe9469c51483b9c53dbf6534e9c43/src/main/java/com/cognitect/transit/TransitFactory.java#L195-L206
train
cognitect/transit-java
src/main/java/com/cognitect/transit/TransitFactory.java
TransitFactory.taggedValue
public static <T> TaggedValue<T> taggedValue(String tag, T rep) { return new TaggedValueImpl<T>(tag, rep); }
java
public static <T> TaggedValue<T> taggedValue(String tag, T rep) { return new TaggedValueImpl<T>(tag, rep); }
[ "public", "static", "<", "T", ">", "TaggedValue", "<", "T", ">", "taggedValue", "(", "String", "tag", ",", "T", "rep", ")", "{", "return", "new", "TaggedValueImpl", "<", "T", ">", "(", "tag", ",", "rep", ")", ";", "}" ]
Creates a TaggedValue @param tag tag string @param rep value representation @return a tagged value
[ "Creates", "a", "TaggedValue" ]
a1d5edc2862fe9469c51483b9c53dbf6534e9c43
https://github.com/cognitect/transit-java/blob/a1d5edc2862fe9469c51483b9c53dbf6534e9c43/src/main/java/com/cognitect/transit/TransitFactory.java#L214-L216
train
yonik/noggit
src/main/java/org/noggit/JSONParser.java
JSONParser.readNumber
private long readNumber(int firstChar, boolean isNeg) throws IOException { out.unsafeWrite(firstChar); // unsafe OK since we know output is big enough // We build up the number in the negative plane since it's larger (by one) than // the positive plane. long v = '0' - firstChar; // can't overflow a long in 18 decimal digits (i.e. 17 additional after the first). // we also need 22 additional to handle double so we'll handle in 2 separate loops. int i; for (i=0; i<17; i++) { int ch = getChar(); // TODO: is this switch faster as an if-then-else? switch(ch) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': v = v*10 - (ch-'0'); out.unsafeWrite(ch); continue; case '.': out.unsafeWrite('.'); valstate = readFrac(out,22-i); return 0; case 'e': case 'E': out.unsafeWrite(ch); nstate=0; valstate = readExp(out,22-i); return 0; default: // return the number, relying on nextEvent() to return an error // for invalid chars following the number. if (ch!=-1) --start; // push back last char if not EOF valstate = LONG; return isNeg ? v : -v; } } // after this, we could overflow a long and need to do extra checking boolean overflow = false; long maxval = isNeg ? Long.MIN_VALUE : -Long.MAX_VALUE; for (; i<22; i++) { int ch = getChar(); switch(ch) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': if (v < (0x8000000000000000L/10)) overflow=true; // can't multiply by 10 w/o overflowing v *= 10; int digit = ch - '0'; if (v < maxval + digit) overflow=true; // can't add digit w/o overflowing v -= digit; out.unsafeWrite(ch); continue; case '.': out.unsafeWrite('.'); valstate = readFrac(out,22-i); return 0; case 'e': case 'E': out.unsafeWrite(ch); nstate=0; valstate = readExp(out,22-i); return 0; default: // return the number, relying on nextEvent() to return an error // for invalid chars following the number. if (ch!=-1) --start; // push back last char if not EOF valstate = overflow ? BIGNUMBER : LONG; return isNeg ? v : -v; } } nstate=0; valstate = BIGNUMBER; return 0; }
java
private long readNumber(int firstChar, boolean isNeg) throws IOException { out.unsafeWrite(firstChar); // unsafe OK since we know output is big enough // We build up the number in the negative plane since it's larger (by one) than // the positive plane. long v = '0' - firstChar; // can't overflow a long in 18 decimal digits (i.e. 17 additional after the first). // we also need 22 additional to handle double so we'll handle in 2 separate loops. int i; for (i=0; i<17; i++) { int ch = getChar(); // TODO: is this switch faster as an if-then-else? switch(ch) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': v = v*10 - (ch-'0'); out.unsafeWrite(ch); continue; case '.': out.unsafeWrite('.'); valstate = readFrac(out,22-i); return 0; case 'e': case 'E': out.unsafeWrite(ch); nstate=0; valstate = readExp(out,22-i); return 0; default: // return the number, relying on nextEvent() to return an error // for invalid chars following the number. if (ch!=-1) --start; // push back last char if not EOF valstate = LONG; return isNeg ? v : -v; } } // after this, we could overflow a long and need to do extra checking boolean overflow = false; long maxval = isNeg ? Long.MIN_VALUE : -Long.MAX_VALUE; for (; i<22; i++) { int ch = getChar(); switch(ch) { case '0': case '1': case '2': case '3': case '4': case '5': case '6': case '7': case '8': case '9': if (v < (0x8000000000000000L/10)) overflow=true; // can't multiply by 10 w/o overflowing v *= 10; int digit = ch - '0'; if (v < maxval + digit) overflow=true; // can't add digit w/o overflowing v -= digit; out.unsafeWrite(ch); continue; case '.': out.unsafeWrite('.'); valstate = readFrac(out,22-i); return 0; case 'e': case 'E': out.unsafeWrite(ch); nstate=0; valstate = readExp(out,22-i); return 0; default: // return the number, relying on nextEvent() to return an error // for invalid chars following the number. if (ch!=-1) --start; // push back last char if not EOF valstate = overflow ? BIGNUMBER : LONG; return isNeg ? v : -v; } } nstate=0; valstate = BIGNUMBER; return 0; }
[ "private", "long", "readNumber", "(", "int", "firstChar", ",", "boolean", "isNeg", ")", "throws", "IOException", "{", "out", ".", "unsafeWrite", "(", "firstChar", ")", ";", "// unsafe OK since we know output is big enough", "// We build up the number in the negative plane s...
Returns the long read... only significant if valstate==LONG after this call. firstChar should be the first numeric digit read.
[ "Returns", "the", "long", "read", "...", "only", "significant", "if", "valstate", "==", "LONG", "after", "this", "call", ".", "firstChar", "should", "be", "the", "first", "numeric", "digit", "read", "." ]
8febcdc7f88126bde8a1909519b4644655f78106
https://github.com/yonik/noggit/blob/8febcdc7f88126bde8a1909519b4644655f78106/src/main/java/org/noggit/JSONParser.java#L449-L542
train
yonik/noggit
src/main/java/org/noggit/JSONParser.java
JSONParser.readFrac
private int readFrac(CharArr arr, int lim) throws IOException { nstate = HAS_FRACTION; // deliberate set instead of '|' while(--lim>=0) { int ch = getChar(); if (ch>='0' && ch<='9') { arr.write(ch); } else if (ch=='e' || ch=='E') { arr.write(ch); return readExp(arr,lim); } else { if (ch!=-1) start--; // back up return NUMBER; } } return BIGNUMBER; }
java
private int readFrac(CharArr arr, int lim) throws IOException { nstate = HAS_FRACTION; // deliberate set instead of '|' while(--lim>=0) { int ch = getChar(); if (ch>='0' && ch<='9') { arr.write(ch); } else if (ch=='e' || ch=='E') { arr.write(ch); return readExp(arr,lim); } else { if (ch!=-1) start--; // back up return NUMBER; } } return BIGNUMBER; }
[ "private", "int", "readFrac", "(", "CharArr", "arr", ",", "int", "lim", ")", "throws", "IOException", "{", "nstate", "=", "HAS_FRACTION", ";", "// deliberate set instead of '|'", "while", "(", "--", "lim", ">=", "0", ")", "{", "int", "ch", "=", "getChar", ...
read digits right of decimal point
[ "read", "digits", "right", "of", "decimal", "point" ]
8febcdc7f88126bde8a1909519b4644655f78106
https://github.com/yonik/noggit/blob/8febcdc7f88126bde8a1909519b4644655f78106/src/main/java/org/noggit/JSONParser.java#L546-L561
train
yonik/noggit
src/main/java/org/noggit/JSONParser.java
JSONParser.readExp
private int readExp(CharArr arr, int lim) throws IOException { nstate |= HAS_EXPONENT; int ch = getChar(); lim--; if (ch=='+' || ch=='-') { arr.write(ch); ch = getChar(); lim--; } // make sure at least one digit is read. if (ch<'0' || ch>'9') { throw err("missing exponent number"); } arr.write(ch); return readExpDigits(arr,lim); }
java
private int readExp(CharArr arr, int lim) throws IOException { nstate |= HAS_EXPONENT; int ch = getChar(); lim--; if (ch=='+' || ch=='-') { arr.write(ch); ch = getChar(); lim--; } // make sure at least one digit is read. if (ch<'0' || ch>'9') { throw err("missing exponent number"); } arr.write(ch); return readExpDigits(arr,lim); }
[ "private", "int", "readExp", "(", "CharArr", "arr", ",", "int", "lim", ")", "throws", "IOException", "{", "nstate", "|=", "HAS_EXPONENT", ";", "int", "ch", "=", "getChar", "(", ")", ";", "lim", "--", ";", "if", "(", "ch", "==", "'", "'", "||", "ch"...
call after 'e' or 'E' has been seen to read the rest of the exponent
[ "call", "after", "e", "or", "E", "has", "been", "seen", "to", "read", "the", "rest", "of", "the", "exponent" ]
8febcdc7f88126bde8a1909519b4644655f78106
https://github.com/yonik/noggit/blob/8febcdc7f88126bde8a1909519b4644655f78106/src/main/java/org/noggit/JSONParser.java#L565-L581
train
yonik/noggit
src/main/java/org/noggit/JSONParser.java
JSONParser.readExpDigits
private int readExpDigits(CharArr arr, int lim) throws IOException { while (--lim>=0) { int ch = getChar(); if (ch>='0' && ch<='9') { arr.write(ch); } else { if (ch!=-1) start--; // back up return NUMBER; } } return BIGNUMBER; }
java
private int readExpDigits(CharArr arr, int lim) throws IOException { while (--lim>=0) { int ch = getChar(); if (ch>='0' && ch<='9') { arr.write(ch); } else { if (ch!=-1) start--; // back up return NUMBER; } } return BIGNUMBER; }
[ "private", "int", "readExpDigits", "(", "CharArr", "arr", ",", "int", "lim", ")", "throws", "IOException", "{", "while", "(", "--", "lim", ">=", "0", ")", "{", "int", "ch", "=", "getChar", "(", ")", ";", "if", "(", "ch", ">=", "'", "'", "&&", "ch...
continuation of readExpStart
[ "continuation", "of", "readExpStart" ]
8febcdc7f88126bde8a1909519b4644655f78106
https://github.com/yonik/noggit/blob/8febcdc7f88126bde8a1909519b4644655f78106/src/main/java/org/noggit/JSONParser.java#L584-L595
train
yonik/noggit
src/main/java/org/noggit/JSONParser.java
JSONParser.readEscapedChar
private char readEscapedChar() throws IOException { int ch = getChar(); switch (ch) { case '"' : return '"'; case '\'' : return '\''; case '\\' : return '\\'; case '/' : return '/'; case 'n' : return '\n'; case 'r' : return '\r'; case 't' : return '\t'; case 'f' : return '\f'; case 'b' : return '\b'; case 'u' : return (char)( (hexval(getChar()) << 12) | (hexval(getChar()) << 8) | (hexval(getChar()) << 4) | (hexval(getChar()))); } if ( (flags & ALLOW_BACKSLASH_ESCAPING_ANY_CHARACTER) != 0 && ch != EOF) { return (char)ch; } throw err("Invalid character escape"); }
java
private char readEscapedChar() throws IOException { int ch = getChar(); switch (ch) { case '"' : return '"'; case '\'' : return '\''; case '\\' : return '\\'; case '/' : return '/'; case 'n' : return '\n'; case 'r' : return '\r'; case 't' : return '\t'; case 'f' : return '\f'; case 'b' : return '\b'; case 'u' : return (char)( (hexval(getChar()) << 12) | (hexval(getChar()) << 8) | (hexval(getChar()) << 4) | (hexval(getChar()))); } if ( (flags & ALLOW_BACKSLASH_ESCAPING_ANY_CHARACTER) != 0 && ch != EOF) { return (char)ch; } throw err("Invalid character escape"); }
[ "private", "char", "readEscapedChar", "(", ")", "throws", "IOException", "{", "int", "ch", "=", "getChar", "(", ")", ";", "switch", "(", "ch", ")", "{", "case", "'", "'", ":", "return", "'", "'", ";", "case", "'", "'", ":", "return", "'", "'", ";...
backslash has already been read when this is called
[ "backslash", "has", "already", "been", "read", "when", "this", "is", "called" ]
8febcdc7f88126bde8a1909519b4644655f78106
https://github.com/yonik/noggit/blob/8febcdc7f88126bde8a1909519b4644655f78106/src/main/java/org/noggit/JSONParser.java#L641-L664
train
yonik/noggit
src/main/java/org/noggit/JSONParser.java
JSONParser.readStringChars2
private void readStringChars2(CharArr arr, int middle) throws IOException { if (stringTerm == 0) { readStringBare(arr); return; } char terminator = (char) stringTerm; for (;;) { if (middle>=end) { arr.write(buf,start,middle-start); start=middle; getMore(); middle=start; } int ch = buf[middle++]; if (ch == terminator) { int len = middle-start-1; if (len>0) arr.write(buf,start,len); start=middle; return; } else if (ch=='\\') { int len = middle-start-1; if (len>0) arr.write(buf,start,len); start=middle; arr.write(readEscapedChar()); middle=start; } } }
java
private void readStringChars2(CharArr arr, int middle) throws IOException { if (stringTerm == 0) { readStringBare(arr); return; } char terminator = (char) stringTerm; for (;;) { if (middle>=end) { arr.write(buf,start,middle-start); start=middle; getMore(); middle=start; } int ch = buf[middle++]; if (ch == terminator) { int len = middle-start-1; if (len>0) arr.write(buf,start,len); start=middle; return; } else if (ch=='\\') { int len = middle-start-1; if (len>0) arr.write(buf,start,len); start=middle; arr.write(readEscapedChar()); middle=start; } } }
[ "private", "void", "readStringChars2", "(", "CharArr", "arr", ",", "int", "middle", ")", "throws", "IOException", "{", "if", "(", "stringTerm", "==", "0", ")", "{", "readStringBare", "(", "arr", ")", ";", "return", ";", "}", "char", "terminator", "=", "(...
this should be faster for strings with fewer escapes, but probably slower for many escapes.
[ "this", "should", "be", "faster", "for", "strings", "with", "fewer", "escapes", "but", "probably", "slower", "for", "many", "escapes", "." ]
8febcdc7f88126bde8a1909519b4644655f78106
https://github.com/yonik/noggit/blob/8febcdc7f88126bde8a1909519b4644655f78106/src/main/java/org/noggit/JSONParser.java#L697-L726
train
yonik/noggit
src/main/java/org/noggit/JSONParser.java
JSONParser.getNumberChars
public void getNumberChars(CharArr output) throws IOException { int ev=0; if (valstate==0) ev=nextEvent(); if (valstate == LONG || valstate == NUMBER) output.write(this.out); else if (valstate==BIGNUMBER) { continueNumber(output); } else { throw err("Unexpected " + ev); } valstate=0; }
java
public void getNumberChars(CharArr output) throws IOException { int ev=0; if (valstate==0) ev=nextEvent(); if (valstate == LONG || valstate == NUMBER) output.write(this.out); else if (valstate==BIGNUMBER) { continueNumber(output); } else { throw err("Unexpected " + ev); } valstate=0; }
[ "public", "void", "getNumberChars", "(", "CharArr", "output", ")", "throws", "IOException", "{", "int", "ev", "=", "0", ";", "if", "(", "valstate", "==", "0", ")", "ev", "=", "nextEvent", "(", ")", ";", "if", "(", "valstate", "==", "LONG", "||", "val...
Reads a JSON numeric value into the output.
[ "Reads", "a", "JSON", "numeric", "value", "into", "the", "output", "." ]
8febcdc7f88126bde8a1909519b4644655f78106
https://github.com/yonik/noggit/blob/8febcdc7f88126bde8a1909519b4644655f78106/src/main/java/org/noggit/JSONParser.java#L1200-L1210
train
yonik/noggit
src/main/java/org/noggit/CharUtil.java
CharUtil.parseLong
public long parseLong(char[] arr, int start, int end) { long x = 0; boolean negative = arr[start] == '-'; for (int i=negative ? start+1 : start; i<end; i++) { // If constructing the largest negative number, this will overflow // to the largest negative number. This is OK since the negation of // the largest negative number is itself in two's complement. x = x * 10 + (arr[i] - '0'); } // could replace conditional-move with multiplication of sign... not sure // which is faster. return negative ? -x : x; }
java
public long parseLong(char[] arr, int start, int end) { long x = 0; boolean negative = arr[start] == '-'; for (int i=negative ? start+1 : start; i<end; i++) { // If constructing the largest negative number, this will overflow // to the largest negative number. This is OK since the negation of // the largest negative number is itself in two's complement. x = x * 10 + (arr[i] - '0'); } // could replace conditional-move with multiplication of sign... not sure // which is faster. return negative ? -x : x; }
[ "public", "long", "parseLong", "(", "char", "[", "]", "arr", ",", "int", "start", ",", "int", "end", ")", "{", "long", "x", "=", "0", ";", "boolean", "negative", "=", "arr", "[", "start", "]", "==", "'", "'", ";", "for", "(", "int", "i", "=", ...
belongs in number utils or charutil?
[ "belongs", "in", "number", "utils", "or", "charutil?" ]
8febcdc7f88126bde8a1909519b4644655f78106
https://github.com/yonik/noggit/blob/8febcdc7f88126bde8a1909519b4644655f78106/src/main/java/org/noggit/CharUtil.java#L27-L39
train
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/net/MultiPooledSocketFactory.java
MultiPooledSocketFactory.createSocketFactory
protected SocketFactory createSocketFactory(InetAddress address, int port, InetAddress localAddr, int localPort, long timeout) { SocketFactory factory; factory = new PlainSocketFactory (address, port, localAddr, localPort, timeout); factory = new PooledSocketFactory(factory); factory = new LazySocketFactory(factory); return factory; }
java
protected SocketFactory createSocketFactory(InetAddress address, int port, InetAddress localAddr, int localPort, long timeout) { SocketFactory factory; factory = new PlainSocketFactory (address, port, localAddr, localPort, timeout); factory = new PooledSocketFactory(factory); factory = new LazySocketFactory(factory); return factory; }
[ "protected", "SocketFactory", "createSocketFactory", "(", "InetAddress", "address", ",", "int", "port", ",", "InetAddress", "localAddr", ",", "int", "localPort", ",", "long", "timeout", ")", "{", "SocketFactory", "factory", ";", "factory", "=", "new", "PlainSocket...
Create socket factories for newly resolved addresses. Default implementation returns a LazySocketFactory wrapping a PooledSocketFactory wrapping a PlainSocketFactory.
[ "Create", "socket", "factories", "for", "newly", "resolved", "addresses", ".", "Default", "implementation", "returns", "a", "LazySocketFactory", "wrapping", "a", "PooledSocketFactory", "wrapping", "a", "PlainSocketFactory", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/net/MultiPooledSocketFactory.java#L137-L149
train
teatrove/teatrove
teaapps/src/main/java/org/teatrove/teaapps/contexts/EncodingContext.java
EncodingContext.encodeIntArray
public String encodeIntArray(int[] input) throws IOException { ByteArrayOutputStream bos = new ByteArrayOutputStream(); DataOutputStream dos = new DataOutputStream(bos); int length = input.length; dos.writeInt(length); for (int i=0; i < length; i++) { dos.writeInt(input[i]); } return new String(Base64.encodeBase64URLSafe(bos.toByteArray())); }
java
public String encodeIntArray(int[] input) throws IOException { ByteArrayOutputStream bos = new ByteArrayOutputStream(); DataOutputStream dos = new DataOutputStream(bos); int length = input.length; dos.writeInt(length); for (int i=0; i < length; i++) { dos.writeInt(input[i]); } return new String(Base64.encodeBase64URLSafe(bos.toByteArray())); }
[ "public", "String", "encodeIntArray", "(", "int", "[", "]", "input", ")", "throws", "IOException", "{", "ByteArrayOutputStream", "bos", "=", "new", "ByteArrayOutputStream", "(", ")", ";", "DataOutputStream", "dos", "=", "new", "DataOutputStream", "(", "bos", ")"...
Encode the given integer array into Base64 format. @param input The array of integers to encode @return The Base64 encoded data @throws IOException if an error occurs encoding the array stream @see #decodeIntArray(String)
[ "Encode", "the", "given", "integer", "array", "into", "Base64", "format", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/teaapps/src/main/java/org/teatrove/teaapps/contexts/EncodingContext.java#L82-L92
train
teatrove/teatrove
teaapps/src/main/java/org/teatrove/teaapps/contexts/EncodingContext.java
EncodingContext.decodeIntArray
public int[] decodeIntArray(String input) throws IOException { int[] result = null; ByteArrayInputStream bis = new ByteArrayInputStream(Base64.decodeBase64(input)); DataInputStream dis = new DataInputStream(bis); int length = dis.readInt(); result = new int[length]; for (int i=0; i < length; i++) { result[i] = dis.readInt(); } return result; }
java
public int[] decodeIntArray(String input) throws IOException { int[] result = null; ByteArrayInputStream bis = new ByteArrayInputStream(Base64.decodeBase64(input)); DataInputStream dis = new DataInputStream(bis); int length = dis.readInt(); result = new int[length]; for (int i=0; i < length; i++) { result[i] = dis.readInt(); } return result; }
[ "public", "int", "[", "]", "decodeIntArray", "(", "String", "input", ")", "throws", "IOException", "{", "int", "[", "]", "result", "=", "null", ";", "ByteArrayInputStream", "bis", "=", "new", "ByteArrayInputStream", "(", "Base64", ".", "decodeBase64", "(", "...
Decode the given Base64 encoded value into an integer array. @param input The Base64 encoded value to decode @return The array of decoded integers @throws IOException if an error occurs decoding the array stream @see #encodeIntArray(int[])
[ "Decode", "the", "given", "Base64", "encoded", "value", "into", "an", "integer", "array", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/teaapps/src/main/java/org/teatrove/teaapps/contexts/EncodingContext.java#L105-L116
train
teatrove/teatrove
teaapps/src/main/java/org/teatrove/teaapps/contexts/EncodingContext.java
EncodingContext.decodeHexToString
public String decodeHexToString(String str) throws DecoderException { String result = null; byte[] bytes = Hex.decodeHex(str.toCharArray()); if (bytes != null && bytes.length > 0) { result = new String(bytes); } return result; }
java
public String decodeHexToString(String str) throws DecoderException { String result = null; byte[] bytes = Hex.decodeHex(str.toCharArray()); if (bytes != null && bytes.length > 0) { result = new String(bytes); } return result; }
[ "public", "String", "decodeHexToString", "(", "String", "str", ")", "throws", "DecoderException", "{", "String", "result", "=", "null", ";", "byte", "[", "]", "bytes", "=", "Hex", ".", "decodeHex", "(", "str", ".", "toCharArray", "(", ")", ")", ";", "if"...
Decode the given hexidecimal formatted value into a string representing the bytes of the decoded value. @param str The hexidecimal formatted value @return The string representing the decoded bytes @throws DecoderException if an error occurs during decoding @see #decodeHex(String)
[ "Decode", "the", "given", "hexidecimal", "formatted", "value", "into", "a", "string", "representing", "the", "bytes", "of", "the", "decoded", "value", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/teaapps/src/main/java/org/teatrove/teaapps/contexts/EncodingContext.java#L299-L306
train
teatrove/teatrove
teaservlet/src/main/java/org/teatrove/teatools/FeatureDescription.java
FeatureDescription.getName
public String getName() { FeatureDescriptor fd = getFeatureDescriptor(); if (fd == null) { return null; } return fd.getName(); }
java
public String getName() { FeatureDescriptor fd = getFeatureDescriptor(); if (fd == null) { return null; } return fd.getName(); }
[ "public", "String", "getName", "(", ")", "{", "FeatureDescriptor", "fd", "=", "getFeatureDescriptor", "(", ")", ";", "if", "(", "fd", "==", "null", ")", "{", "return", "null", ";", "}", "return", "fd", ".", "getName", "(", ")", ";", "}" ]
Returns the feature name
[ "Returns", "the", "feature", "name" ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/teaservlet/src/main/java/org/teatrove/teatools/FeatureDescription.java#L40-L47
train
teatrove/teatrove
teaservlet/src/main/java/org/teatrove/teatools/FeatureDescription.java
FeatureDescription.getDescription
public String getDescription() { FeatureDescriptor fd = getFeatureDescriptor(); if (fd == null) { return ""; } return getTeaToolsUtils().getDescription(fd); }
java
public String getDescription() { FeatureDescriptor fd = getFeatureDescriptor(); if (fd == null) { return ""; } return getTeaToolsUtils().getDescription(fd); }
[ "public", "String", "getDescription", "(", ")", "{", "FeatureDescriptor", "fd", "=", "getFeatureDescriptor", "(", ")", ";", "if", "(", "fd", "==", "null", ")", "{", "return", "\"\"", ";", "}", "return", "getTeaToolsUtils", "(", ")", ".", "getDescription", ...
Returns the shortDescription or "" if the shortDescription is the same as the displayName.
[ "Returns", "the", "shortDescription", "or", "if", "the", "shortDescription", "is", "the", "same", "as", "the", "displayName", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/teaservlet/src/main/java/org/teatrove/teatools/FeatureDescription.java#L53-L60
train
teatrove/teatrove
build-tools/toolbox/src/main/java/org/teatrove/toolbox/beandoc/teadoc/ClassDoc.java
ClassDoc.getQualifiedTypeNameForFile
public String getQualifiedTypeNameForFile() { String typeName = getTypeNameForFile(); String qualifiedTypeName = mDoc.qualifiedTypeName(); int packageLength = qualifiedTypeName.length() - typeName.length(); if (packageLength <= 0) { return typeName; } String packagePath = qualifiedTypeName.substring(0, packageLength); return packagePath + typeName; }
java
public String getQualifiedTypeNameForFile() { String typeName = getTypeNameForFile(); String qualifiedTypeName = mDoc.qualifiedTypeName(); int packageLength = qualifiedTypeName.length() - typeName.length(); if (packageLength <= 0) { return typeName; } String packagePath = qualifiedTypeName.substring(0, packageLength); return packagePath + typeName; }
[ "public", "String", "getQualifiedTypeNameForFile", "(", ")", "{", "String", "typeName", "=", "getTypeNameForFile", "(", ")", ";", "String", "qualifiedTypeName", "=", "mDoc", ".", "qualifiedTypeName", "(", ")", ";", "int", "packageLength", "=", "qualifiedTypeName", ...
Converts inner class names.
[ "Converts", "inner", "class", "names", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/build-tools/toolbox/src/main/java/org/teatrove/toolbox/beandoc/teadoc/ClassDoc.java#L201-L214
train
teatrove/teatrove
build-tools/toolbox/src/main/java/org/teatrove/toolbox/beandoc/teadoc/ClassDoc.java
ClassDoc.getMatchingMethod
public MethodDoc getMatchingMethod(MethodDoc method) { MethodDoc[] methods = getMethods(); for (int i = 0; i < methods.length; i++) { if (method.getName().equals(methods[i].getName()) && method.getSignature().equals(methods[i].getSignature())) { return methods[i]; } } return null; }
java
public MethodDoc getMatchingMethod(MethodDoc method) { MethodDoc[] methods = getMethods(); for (int i = 0; i < methods.length; i++) { if (method.getName().equals(methods[i].getName()) && method.getSignature().equals(methods[i].getSignature())) { return methods[i]; } } return null; }
[ "public", "MethodDoc", "getMatchingMethod", "(", "MethodDoc", "method", ")", "{", "MethodDoc", "[", "]", "methods", "=", "getMethods", "(", ")", ";", "for", "(", "int", "i", "=", "0", ";", "i", "<", "methods", ".", "length", ";", "i", "++", ")", "{",...
Get a MethodDoc in this ClassDoc with a name and signature matching that of the specified MethodDoc
[ "Get", "a", "MethodDoc", "in", "this", "ClassDoc", "with", "a", "name", "and", "signature", "matching", "that", "of", "the", "specified", "MethodDoc" ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/build-tools/toolbox/src/main/java/org/teatrove/toolbox/beandoc/teadoc/ClassDoc.java#L239-L251
train
teatrove/teatrove
build-tools/toolbox/src/main/java/org/teatrove/toolbox/beandoc/teadoc/ClassDoc.java
ClassDoc.getMatchingMethod
public MethodDoc getMatchingMethod(MethodDoc method, MethodFinder mf) { MethodDoc md = getMatchingMethod(method); if (md != null) { if (mf.checkMethod(md)) { return md; } } return null; }
java
public MethodDoc getMatchingMethod(MethodDoc method, MethodFinder mf) { MethodDoc md = getMatchingMethod(method); if (md != null) { if (mf.checkMethod(md)) { return md; } } return null; }
[ "public", "MethodDoc", "getMatchingMethod", "(", "MethodDoc", "method", ",", "MethodFinder", "mf", ")", "{", "MethodDoc", "md", "=", "getMatchingMethod", "(", "method", ")", ";", "if", "(", "md", "!=", "null", ")", "{", "if", "(", "mf", ".", "checkMethod",...
Get a MethodDoc in this ClassDoc with a name and signature matching that of the specified MethodDoc and accepted by the specified MethodFinder
[ "Get", "a", "MethodDoc", "in", "this", "ClassDoc", "with", "a", "name", "and", "signature", "matching", "that", "of", "the", "specified", "MethodDoc", "and", "accepted", "by", "the", "specified", "MethodFinder" ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/build-tools/toolbox/src/main/java/org/teatrove/toolbox/beandoc/teadoc/ClassDoc.java#L258-L268
train
teatrove/teatrove
build-tools/toolbox/src/main/java/org/teatrove/toolbox/beandoc/teadoc/ClassDoc.java
ClassDoc.findMatchingMethod
public MethodDoc findMatchingMethod(MethodDoc method, MethodFinder mf) { // Look in this class's interface set MethodDoc md = findMatchingInterfaceMethod(method, mf); if (md != null) { return md; } // Look in this class's superclass ancestry ClassDoc superClass = getSuperclass(); if (superClass != null) { md = superClass.getMatchingMethod(method, mf); if (md != null) { return md; } return superClass.findMatchingMethod(method, mf); } return null; }
java
public MethodDoc findMatchingMethod(MethodDoc method, MethodFinder mf) { // Look in this class's interface set MethodDoc md = findMatchingInterfaceMethod(method, mf); if (md != null) { return md; } // Look in this class's superclass ancestry ClassDoc superClass = getSuperclass(); if (superClass != null) { md = superClass.getMatchingMethod(method, mf); if (md != null) { return md; } return superClass.findMatchingMethod(method, mf); } return null; }
[ "public", "MethodDoc", "findMatchingMethod", "(", "MethodDoc", "method", ",", "MethodFinder", "mf", ")", "{", "// Look in this class's interface set", "MethodDoc", "md", "=", "findMatchingInterfaceMethod", "(", "method", ",", "mf", ")", ";", "if", "(", "md", "!=", ...
Find a MethodDoc with a name and signature matching that of the specified MethodDoc and accepted by the specified MethodFinder. This method searches the interfaces and super class ancestry of the class represented by this ClassDoc for a matching method.
[ "Find", "a", "MethodDoc", "with", "a", "name", "and", "signature", "matching", "that", "of", "the", "specified", "MethodDoc", "and", "accepted", "by", "the", "specified", "MethodFinder", ".", "This", "method", "searches", "the", "interfaces", "and", "super", "...
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/build-tools/toolbox/src/main/java/org/teatrove/toolbox/beandoc/teadoc/ClassDoc.java#L277-L299
train
teatrove/teatrove
build-tools/toolbox/src/main/java/org/teatrove/toolbox/beandoc/teadoc/Doc.java
Doc.getTagValue
public String getTagValue(String tagName) { Tag[] tags = getTagMap().get(tagName); if (tags == null || tags.length == 0) { return null; } return tags[tags.length - 1].getText(); }
java
public String getTagValue(String tagName) { Tag[] tags = getTagMap().get(tagName); if (tags == null || tags.length == 0) { return null; } return tags[tags.length - 1].getText(); }
[ "public", "String", "getTagValue", "(", "String", "tagName", ")", "{", "Tag", "[", "]", "tags", "=", "getTagMap", "(", ")", ".", "get", "(", "tagName", ")", ";", "if", "(", "tags", "==", "null", "||", "tags", ".", "length", "==", "0", ")", "{", "...
Gets the text value of the first tag in doc that matches tagName
[ "Gets", "the", "text", "value", "of", "the", "first", "tag", "in", "doc", "that", "matches", "tagName" ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/build-tools/toolbox/src/main/java/org/teatrove/toolbox/beandoc/teadoc/Doc.java#L79-L87
train
teatrove/teatrove
tea/src/main/java/org/teatrove/tea/util/BeanAnalyzer.java
BeanAnalyzer.getAllProperties
public static Map<String, PropertyDescriptor> getAllProperties(GenericType root) throws IntrospectionException { Map<String, PropertyDescriptor> properties = cPropertiesCache.get(root); if (properties == null) { GenericType rootType = root.getRootType(); if (rootType == null) { rootType = root; } properties = Collections.unmodifiableMap ( createProperties(rootType, root) ); cPropertiesCache.put(root, properties); } return properties; }
java
public static Map<String, PropertyDescriptor> getAllProperties(GenericType root) throws IntrospectionException { Map<String, PropertyDescriptor> properties = cPropertiesCache.get(root); if (properties == null) { GenericType rootType = root.getRootType(); if (rootType == null) { rootType = root; } properties = Collections.unmodifiableMap ( createProperties(rootType, root) ); cPropertiesCache.put(root, properties); } return properties; }
[ "public", "static", "Map", "<", "String", ",", "PropertyDescriptor", ">", "getAllProperties", "(", "GenericType", "root", ")", "throws", "IntrospectionException", "{", "Map", "<", "String", ",", "PropertyDescriptor", ">", "properties", "=", "cPropertiesCache", ".", ...
A function that returns a Map of all the available properties on a given class including write-only properties. The properties returned is mostly a superset of those returned from the standard JavaBeans Introspector except pure indexed properties are discarded. <p>Interfaces receive all the properties available in Object. Arrays, Strings and Collections all receive a "length" property. An array's "length" PropertyDescriptor has no read or write methods. <p>Instead of indexed properties, there may be keyed properties in the map, represented by a {@link KeyedPropertyDescriptor}. Arrays, Strings and Lists always have keyed properties with a key type of int. <p>Because the value returned from a keyed property method may be more specific than the method signature describes (such is often the case with collections), a bean class can contain a special field that indicates what that specific type should be. The signature of this field is as follows: <tt>public&nbsp;static&nbsp;final&nbsp;Class&nbsp;ELEMENT_TYPE&nbsp;=&nbsp;&lt;type&gt;.class;</tt>. @return an unmodifiable mapping of property names (Strings) to PropertyDescriptor objects.
[ "A", "function", "that", "returns", "a", "Map", "of", "all", "the", "available", "properties", "on", "a", "given", "class", "including", "write", "-", "only", "properties", ".", "The", "properties", "returned", "is", "mostly", "a", "superset", "of", "those",...
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/tea/src/main/java/org/teatrove/tea/util/BeanAnalyzer.java#L98-L117
train
teatrove/teatrove
build-tools/teatools/src/main/java/org/teatrove/teatools/TeaCompiler.java
TeaCompiler.findTemplateName
public static String findTemplateName(org.teatrove.tea.compiler.Scanner scanner) { // System.out.println("<-- findTemplateName -->"); Token token; String name = null; try { while (((token = scanner.readToken()).getID()) != Token.EOF) { /* System.out.println("Token [Code: " + token.getCode() + "] [Image: " + token.getImage() + "] [Value: " + token.getStringValue() + "] [Id: " + token.getID() + "]"); */ if (token.getID() == Token.TEMPLATE) { token = scanner.readToken(); if (token.getID() == Token.IDENT) { name = token.getStringValue(); } break; } } } catch (IOException ioe) { ioe.printStackTrace(); } return name; }
java
public static String findTemplateName(org.teatrove.tea.compiler.Scanner scanner) { // System.out.println("<-- findTemplateName -->"); Token token; String name = null; try { while (((token = scanner.readToken()).getID()) != Token.EOF) { /* System.out.println("Token [Code: " + token.getCode() + "] [Image: " + token.getImage() + "] [Value: " + token.getStringValue() + "] [Id: " + token.getID() + "]"); */ if (token.getID() == Token.TEMPLATE) { token = scanner.readToken(); if (token.getID() == Token.IDENT) { name = token.getStringValue(); } break; } } } catch (IOException ioe) { ioe.printStackTrace(); } return name; }
[ "public", "static", "String", "findTemplateName", "(", "org", ".", "teatrove", ".", "tea", ".", "compiler", ".", "Scanner", "scanner", ")", "{", "// System.out.println(\"<-- findTemplateName -->\");", "Token", "token", ";", "String", "name", "=", "null", ";", "try...
Finds the name of the template using the specified tea scanner. @param scanner the Tea scanner. @return the name of the template
[ "Finds", "the", "name", "of", "the", "template", "using", "the", "specified", "tea", "scanner", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/build-tools/teatools/src/main/java/org/teatrove/teatools/TeaCompiler.java#L51-L78
train
teatrove/teatrove
build-tools/teatools/src/main/java/org/teatrove/teatools/TeaCompiler.java
TeaCompiler.parseTeaTemplate
public Template parseTeaTemplate(String templateName) throws IOException { if (templateName == null) { return null; } preserveParseTree(templateName); compile(templateName); CompilationUnit unit = getCompilationUnit(templateName, null); if (unit == null) { return null; } return unit.getParseTree(); }
java
public Template parseTeaTemplate(String templateName) throws IOException { if (templateName == null) { return null; } preserveParseTree(templateName); compile(templateName); CompilationUnit unit = getCompilationUnit(templateName, null); if (unit == null) { return null; } return unit.getParseTree(); }
[ "public", "Template", "parseTeaTemplate", "(", "String", "templateName", ")", "throws", "IOException", "{", "if", "(", "templateName", "==", "null", ")", "{", "return", "null", ";", "}", "preserveParseTree", "(", "templateName", ")", ";", "compile", "(", "temp...
Perform Tea "parsing." This method will compile the named template. @param templateName the name of the template to parse @return a Template object that represents the root node of the Tea parse tree.
[ "Perform", "Tea", "parsing", ".", "This", "method", "will", "compile", "the", "named", "template", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/build-tools/teatools/src/main/java/org/teatrove/teatools/TeaCompiler.java#L225-L239
train
teatrove/teatrove
tea/src/main/java/org/teatrove/tea/parsetree/NumberLiteral.java
NumberLiteral.isValueKnown
public boolean isValueKnown() { Type type = getType(); if (type != null) { Class<?> clazz = type.getObjectClass(); return Number.class.isAssignableFrom(clazz) || clazz.isAssignableFrom(Number.class); } else { return false; } }
java
public boolean isValueKnown() { Type type = getType(); if (type != null) { Class<?> clazz = type.getObjectClass(); return Number.class.isAssignableFrom(clazz) || clazz.isAssignableFrom(Number.class); } else { return false; } }
[ "public", "boolean", "isValueKnown", "(", ")", "{", "Type", "type", "=", "getType", "(", ")", ";", "if", "(", "type", "!=", "null", ")", "{", "Class", "<", "?", ">", "clazz", "=", "type", ".", "getObjectClass", "(", ")", ";", "return", "Number", "....
Value is known only if type is a number or can be assigned a number.
[ "Value", "is", "known", "only", "if", "type", "is", "a", "number", "or", "can", "be", "assigned", "a", "number", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/tea/src/main/java/org/teatrove/tea/parsetree/NumberLiteral.java#L96-L106
train
teatrove/teatrove
teaapps/src/main/java/org/teatrove/teaapps/contexts/ArrayContext.java
ArrayContext.cloneArray
public Object[] cloneArray(Object[] array) { Class<?> clazz = array.getClass().getComponentType(); Object newArray = Array.newInstance(clazz, array.length); System.arraycopy(array, 0, newArray, 0, array.length); return (Object[]) newArray; }
java
public Object[] cloneArray(Object[] array) { Class<?> clazz = array.getClass().getComponentType(); Object newArray = Array.newInstance(clazz, array.length); System.arraycopy(array, 0, newArray, 0, array.length); return (Object[]) newArray; }
[ "public", "Object", "[", "]", "cloneArray", "(", "Object", "[", "]", "array", ")", "{", "Class", "<", "?", ">", "clazz", "=", "array", ".", "getClass", "(", ")", ".", "getComponentType", "(", ")", ";", "Object", "newArray", "=", "Array", ".", "newIns...
Clone the given array into a new instance of the same type and dimensions. The values are directly copied by memory, so this is not a deep clone operation. However, manipulation of the contents of the array will not impact the given array. @param array The array to clone @return The new cloned array
[ "Clone", "the", "given", "array", "into", "a", "new", "instance", "of", "the", "same", "type", "and", "dimensions", ".", "The", "values", "are", "directly", "copied", "by", "memory", "so", "this", "is", "not", "a", "deep", "clone", "operation", ".", "How...
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/teaapps/src/main/java/org/teatrove/teaapps/contexts/ArrayContext.java#L38-L43
train
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/net/HttpClient.java
HttpClient.setHeader
public HttpClient setHeader(String name, Object value) { if (mHeaders == null) { mHeaders = new HttpHeaderMap(); } mHeaders.put(name, value); return this; }
java
public HttpClient setHeader(String name, Object value) { if (mHeaders == null) { mHeaders = new HttpHeaderMap(); } mHeaders.put(name, value); return this; }
[ "public", "HttpClient", "setHeader", "(", "String", "name", ",", "Object", "value", ")", "{", "if", "(", "mHeaders", "==", "null", ")", "{", "mHeaders", "=", "new", "HttpHeaderMap", "(", ")", ";", "}", "mHeaders", ".", "put", "(", "name", ",", "value",...
Set a header name-value pair to the request. @return 'this', so that addtional calls may be chained together
[ "Set", "a", "header", "name", "-", "value", "pair", "to", "the", "request", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/net/HttpClient.java#L116-L122
train
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/net/HttpClient.java
HttpClient.addHeader
public HttpClient addHeader(String name, Object value) { if (mHeaders == null) { mHeaders = new HttpHeaderMap(); } mHeaders.add(name, value); return this; }
java
public HttpClient addHeader(String name, Object value) { if (mHeaders == null) { mHeaders = new HttpHeaderMap(); } mHeaders.add(name, value); return this; }
[ "public", "HttpClient", "addHeader", "(", "String", "name", ",", "Object", "value", ")", "{", "if", "(", "mHeaders", "==", "null", ")", "{", "mHeaders", "=", "new", "HttpHeaderMap", "(", ")", ";", "}", "mHeaders", ".", "add", "(", "name", ",", "value",...
Add a header name-value pair to the request in order for multiple values to be specified. @return 'this', so that addtional calls may be chained together
[ "Add", "a", "header", "name", "-", "value", "pair", "to", "the", "request", "in", "order", "for", "multiple", "values", "to", "be", "specified", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/net/HttpClient.java#L130-L136
train
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/net/HttpClient.java
HttpClient.getResponse
public Response getResponse(PostData postData) throws ConnectException, SocketException { CheckedSocket socket = mFactory.getSocket(mSession); try { CharToByteBuffer request = new FastCharToByteBuffer (new DefaultByteBuffer(), "8859_1"); request = new InternedCharToByteBuffer(request); request.append(mMethod); request.append(' '); request.append(mURI); request.append(' '); request.append(mProtocol); request.append("\r\n"); if (mHeaders != null) { mHeaders.appendTo(request); } request.append("\r\n"); Response response; try { response = sendRequest(socket, request, postData); } catch (InterruptedIOException e) { // If timed out, throw exception rather than risk double // posting. throw e; } catch (IOException e) { response = null; } if (response == null) { // Try again with new connection. Persistent connection may // have timed out and been closed by server. try { socket.close(); } catch (IOException e) { } socket = mFactory.createSocket(mSession); response = sendRequest(socket, request, postData); if (response == null) { throw new ConnectException("No response from server " + socket.getInetAddress() + ":" + socket.getPort()); } } return response; } catch (SocketException e) { throw e; } catch (InterruptedIOException e) { throw new ConnectException("Read timeout expired: " + mReadTimeout + ", " + e); } catch (IOException e) { throw new SocketException(e.toString()); } }
java
public Response getResponse(PostData postData) throws ConnectException, SocketException { CheckedSocket socket = mFactory.getSocket(mSession); try { CharToByteBuffer request = new FastCharToByteBuffer (new DefaultByteBuffer(), "8859_1"); request = new InternedCharToByteBuffer(request); request.append(mMethod); request.append(' '); request.append(mURI); request.append(' '); request.append(mProtocol); request.append("\r\n"); if (mHeaders != null) { mHeaders.appendTo(request); } request.append("\r\n"); Response response; try { response = sendRequest(socket, request, postData); } catch (InterruptedIOException e) { // If timed out, throw exception rather than risk double // posting. throw e; } catch (IOException e) { response = null; } if (response == null) { // Try again with new connection. Persistent connection may // have timed out and been closed by server. try { socket.close(); } catch (IOException e) { } socket = mFactory.createSocket(mSession); response = sendRequest(socket, request, postData); if (response == null) { throw new ConnectException("No response from server " + socket.getInetAddress() + ":" + socket.getPort()); } } return response; } catch (SocketException e) { throw e; } catch (InterruptedIOException e) { throw new ConnectException("Read timeout expired: " + mReadTimeout + ", " + e); } catch (IOException e) { throw new SocketException(e.toString()); } }
[ "public", "Response", "getResponse", "(", "PostData", "postData", ")", "throws", "ConnectException", ",", "SocketException", "{", "CheckedSocket", "socket", "=", "mFactory", ".", "getSocket", "(", "mSession", ")", ";", "try", "{", "CharToByteBuffer", "request", "=...
Opens a connection, passes on the current request settings, and returns the server's response. The optional PostData parameter is used to supply post data to the server. The Content-Length header specifies how much data will be read from the PostData InputStream. If it is not specified, data will be read from the InputStream until EOF is reached. @param postData additional data to supply to the server, if request method is POST
[ "Opens", "a", "connection", "passes", "on", "the", "current", "request", "settings", "and", "returns", "the", "server", "s", "response", ".", "The", "optional", "PostData", "parameter", "is", "used", "to", "supply", "post", "data", "to", "the", "server", "."...
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/net/HttpClient.java#L215-L279
train
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/log/Log.java
Log.addRootLogListener
public void addRootLogListener(LogListener listener) { if (mParent == null) { addLogListener(listener); } else { mParent.addRootLogListener(listener); } }
java
public void addRootLogListener(LogListener listener) { if (mParent == null) { addLogListener(listener); } else { mParent.addRootLogListener(listener); } }
[ "public", "void", "addRootLogListener", "(", "LogListener", "listener", ")", "{", "if", "(", "mParent", "==", "null", ")", "{", "addLogListener", "(", "listener", ")", ";", "}", "else", "{", "mParent", ".", "addRootLogListener", "(", "listener", ")", ";", ...
adds a listener to the root log, the log with a null parent
[ "adds", "a", "listener", "to", "the", "root", "log", "the", "log", "with", "a", "null", "parent" ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/log/Log.java#L150-L157
train
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/log/Log.java
Log.debug
public void debug(String s) { if (isEnabled() && isDebugEnabled()) { dispatchLogMessage(new LogEvent(this, LogEvent.DEBUG_TYPE, s)); } }
java
public void debug(String s) { if (isEnabled() && isDebugEnabled()) { dispatchLogMessage(new LogEvent(this, LogEvent.DEBUG_TYPE, s)); } }
[ "public", "void", "debug", "(", "String", "s", ")", "{", "if", "(", "isEnabled", "(", ")", "&&", "isDebugEnabled", "(", ")", ")", "{", "dispatchLogMessage", "(", "new", "LogEvent", "(", "this", ",", "LogEvent", ".", "DEBUG_TYPE", ",", "s", ")", ")", ...
Simple method for logging a single debugging message.
[ "Simple", "method", "for", "logging", "a", "single", "debugging", "message", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/log/Log.java#L233-L237
train
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/log/Log.java
Log.debug
public void debug(Throwable t) { if (isEnabled() && isDebugEnabled()) { dispatchLogException(new LogEvent(this, LogEvent.DEBUG_TYPE, t)); } }
java
public void debug(Throwable t) { if (isEnabled() && isDebugEnabled()) { dispatchLogException(new LogEvent(this, LogEvent.DEBUG_TYPE, t)); } }
[ "public", "void", "debug", "(", "Throwable", "t", ")", "{", "if", "(", "isEnabled", "(", ")", "&&", "isDebugEnabled", "(", ")", ")", "{", "dispatchLogException", "(", "new", "LogEvent", "(", "this", ",", "LogEvent", ".", "DEBUG_TYPE", ",", "t", ")", ")...
Simple method for logging a single debugging exception.
[ "Simple", "method", "for", "logging", "a", "single", "debugging", "exception", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/log/Log.java#L242-L246
train
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/log/Log.java
Log.info
public void info(String s) { if (isEnabled() && isInfoEnabled()) { dispatchLogMessage(new LogEvent(this, LogEvent.INFO_TYPE, s)); } }
java
public void info(String s) { if (isEnabled() && isInfoEnabled()) { dispatchLogMessage(new LogEvent(this, LogEvent.INFO_TYPE, s)); } }
[ "public", "void", "info", "(", "String", "s", ")", "{", "if", "(", "isEnabled", "(", ")", "&&", "isInfoEnabled", "(", ")", ")", "{", "dispatchLogMessage", "(", "new", "LogEvent", "(", "this", ",", "LogEvent", ".", "INFO_TYPE", ",", "s", ")", ")", ";"...
Simple method for logging a single information message.
[ "Simple", "method", "for", "logging", "a", "single", "information", "message", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/log/Log.java#L258-L262
train
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/log/Log.java
Log.info
public void info(Throwable t) { if (isEnabled() && isInfoEnabled()) { dispatchLogException(new LogEvent(this, LogEvent.INFO_TYPE, t)); } }
java
public void info(Throwable t) { if (isEnabled() && isInfoEnabled()) { dispatchLogException(new LogEvent(this, LogEvent.INFO_TYPE, t)); } }
[ "public", "void", "info", "(", "Throwable", "t", ")", "{", "if", "(", "isEnabled", "(", ")", "&&", "isInfoEnabled", "(", ")", ")", "{", "dispatchLogException", "(", "new", "LogEvent", "(", "this", ",", "LogEvent", ".", "INFO_TYPE", ",", "t", ")", ")", ...
Simple method for logging a single information exception.
[ "Simple", "method", "for", "logging", "a", "single", "information", "exception", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/log/Log.java#L267-L271
train
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/log/Log.java
Log.warn
public void warn(String s) { if (isEnabled() && isWarnEnabled()) { dispatchLogMessage(new LogEvent(this, LogEvent.WARN_TYPE, s)); } }
java
public void warn(String s) { if (isEnabled() && isWarnEnabled()) { dispatchLogMessage(new LogEvent(this, LogEvent.WARN_TYPE, s)); } }
[ "public", "void", "warn", "(", "String", "s", ")", "{", "if", "(", "isEnabled", "(", ")", "&&", "isWarnEnabled", "(", ")", ")", "{", "dispatchLogMessage", "(", "new", "LogEvent", "(", "this", ",", "LogEvent", ".", "WARN_TYPE", ",", "s", ")", ")", ";"...
Simple method for logging a single warning message.
[ "Simple", "method", "for", "logging", "a", "single", "warning", "message", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/log/Log.java#L283-L287
train
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/log/Log.java
Log.warn
public void warn(Throwable t) { if (isEnabled() && isWarnEnabled()) { dispatchLogException(new LogEvent(this, LogEvent.WARN_TYPE, t)); } }
java
public void warn(Throwable t) { if (isEnabled() && isWarnEnabled()) { dispatchLogException(new LogEvent(this, LogEvent.WARN_TYPE, t)); } }
[ "public", "void", "warn", "(", "Throwable", "t", ")", "{", "if", "(", "isEnabled", "(", ")", "&&", "isWarnEnabled", "(", ")", ")", "{", "dispatchLogException", "(", "new", "LogEvent", "(", "this", ",", "LogEvent", ".", "WARN_TYPE", ",", "t", ")", ")", ...
Simple method for logging a single warning exception.
[ "Simple", "method", "for", "logging", "a", "single", "warning", "exception", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/log/Log.java#L292-L296
train
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/log/Log.java
Log.error
public void error(String s) { if (isEnabled() && isErrorEnabled()) { dispatchLogMessage(new LogEvent(this, LogEvent.ERROR_TYPE, s)); } }
java
public void error(String s) { if (isEnabled() && isErrorEnabled()) { dispatchLogMessage(new LogEvent(this, LogEvent.ERROR_TYPE, s)); } }
[ "public", "void", "error", "(", "String", "s", ")", "{", "if", "(", "isEnabled", "(", ")", "&&", "isErrorEnabled", "(", ")", ")", "{", "dispatchLogMessage", "(", "new", "LogEvent", "(", "this", ",", "LogEvent", ".", "ERROR_TYPE", ",", "s", ")", ")", ...
Simple method for logging a single error message.
[ "Simple", "method", "for", "logging", "a", "single", "error", "message", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/log/Log.java#L308-L312
train
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/log/Log.java
Log.error
public void error(Throwable t) { if (isEnabled() && isErrorEnabled()) { dispatchLogException(new LogEvent(this, LogEvent.ERROR_TYPE, t)); } }
java
public void error(Throwable t) { if (isEnabled() && isErrorEnabled()) { dispatchLogException(new LogEvent(this, LogEvent.ERROR_TYPE, t)); } }
[ "public", "void", "error", "(", "Throwable", "t", ")", "{", "if", "(", "isEnabled", "(", ")", "&&", "isErrorEnabled", "(", ")", ")", "{", "dispatchLogException", "(", "new", "LogEvent", "(", "this", ",", "LogEvent", ".", "ERROR_TYPE", ",", "t", ")", ")...
Simple method for logging a single error exception.
[ "Simple", "method", "for", "logging", "a", "single", "error", "exception", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/log/Log.java#L317-L321
train
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/log/Log.java
Log.getChildren
public Log[] getChildren() { Collection copy; synchronized (mChildren) { copy = new ArrayList(mChildren.size()); Iterator it = mChildren.iterator(); while (it.hasNext()) { Log child = (Log)((WeakReference)it.next()).get(); if (child == null) { it.remove(); } else { copy.add(child); } } } return (Log[])copy.toArray(new Log[copy.size()]); }
java
public Log[] getChildren() { Collection copy; synchronized (mChildren) { copy = new ArrayList(mChildren.size()); Iterator it = mChildren.iterator(); while (it.hasNext()) { Log child = (Log)((WeakReference)it.next()).get(); if (child == null) { it.remove(); } else { copy.add(child); } } } return (Log[])copy.toArray(new Log[copy.size()]); }
[ "public", "Log", "[", "]", "getChildren", "(", ")", "{", "Collection", "copy", ";", "synchronized", "(", "mChildren", ")", "{", "copy", "=", "new", "ArrayList", "(", "mChildren", ".", "size", "(", ")", ")", ";", "Iterator", "it", "=", "mChildren", ".",...
Returns a copy of the children Logs.
[ "Returns", "a", "copy", "of", "the", "children", "Logs", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/log/Log.java#L326-L344
train
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/log/Log.java
Log.setEnabled
public void setEnabled(boolean enabled) { setEnabled(enabled, ENABLED_MASK); if (enabled) { Log parent; if ((parent = mParent) != null) { parent.setEnabled(true); } } }
java
public void setEnabled(boolean enabled) { setEnabled(enabled, ENABLED_MASK); if (enabled) { Log parent; if ((parent = mParent) != null) { parent.setEnabled(true); } } }
[ "public", "void", "setEnabled", "(", "boolean", "enabled", ")", "{", "setEnabled", "(", "enabled", ",", "ENABLED_MASK", ")", ";", "if", "(", "enabled", ")", "{", "Log", "parent", ";", "if", "(", "(", "parent", "=", "mParent", ")", "!=", "null", ")", ...
When this Log is enabled, all parent Logs are also enabled. When this Log is disabled, parent Logs are unaffected.
[ "When", "this", "Log", "is", "enabled", "all", "parent", "Logs", "are", "also", "enabled", ".", "When", "this", "Log", "is", "disabled", "parent", "Logs", "are", "unaffected", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/log/Log.java#L379-L387
train
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/log/Log.java
Log.applyProperties
public void applyProperties(Map properties) { if (properties.containsKey("enabled")) { setEnabled(!"false".equalsIgnoreCase ((String)properties.get("enabled"))); } if (properties.containsKey("debug")) { setDebugEnabled(!"false".equalsIgnoreCase ((String)properties.get("debug"))); } if (properties.containsKey("info")) { setInfoEnabled(!"false".equalsIgnoreCase ((String)properties.get("info"))); } if (properties.containsKey("warn")) { setWarnEnabled(!"false".equalsIgnoreCase ((String)properties.get("warn"))); } if (properties.containsKey("error")) { setErrorEnabled(!"false".equalsIgnoreCase ((String)properties.get("error"))); } }
java
public void applyProperties(Map properties) { if (properties.containsKey("enabled")) { setEnabled(!"false".equalsIgnoreCase ((String)properties.get("enabled"))); } if (properties.containsKey("debug")) { setDebugEnabled(!"false".equalsIgnoreCase ((String)properties.get("debug"))); } if (properties.containsKey("info")) { setInfoEnabled(!"false".equalsIgnoreCase ((String)properties.get("info"))); } if (properties.containsKey("warn")) { setWarnEnabled(!"false".equalsIgnoreCase ((String)properties.get("warn"))); } if (properties.containsKey("error")) { setErrorEnabled(!"false".equalsIgnoreCase ((String)properties.get("error"))); } }
[ "public", "void", "applyProperties", "(", "Map", "properties", ")", "{", "if", "(", "properties", ".", "containsKey", "(", "\"enabled\"", ")", ")", "{", "setEnabled", "(", "!", "\"false\"", ".", "equalsIgnoreCase", "(", "(", "String", ")", "properties", ".",...
Understands and applies the following boolean properties. True is the default value if the value doesn't equal "false", ignoring case. <ul> <li>enabled <li>debug <li>info <li>warn <li>error </ul>
[ "Understands", "and", "applies", "the", "following", "boolean", "properties", ".", "True", "is", "the", "default", "value", "if", "the", "value", "doesn", "t", "equal", "false", "ignoring", "case", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/log/Log.java#L481-L506
train
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/util/BeanPropertyAccessor.java
BeanPropertyAccessor.getBeanProperties
private static PropertyDescriptor[][] getBeanProperties(Class<?> beanType) { List<PropertyDescriptor> readProperties = new ArrayList<PropertyDescriptor>(); List<PropertyDescriptor> writeProperties = new ArrayList<PropertyDescriptor>(); try { Map<?, ?> map = CompleteIntrospector.getAllProperties(beanType); Iterator<?> it = map.values().iterator(); while (it.hasNext()) { PropertyDescriptor pd = (PropertyDescriptor)it.next(); if (pd.getReadMethod() != null) { readProperties.add(pd); } if (pd.getWriteMethod() != null) { writeProperties.add(pd); } } } catch (IntrospectionException e) { throw new RuntimeException(e.toString()); } PropertyDescriptor[][] props = new PropertyDescriptor[2][]; props[0] = new PropertyDescriptor[readProperties.size()]; readProperties.toArray(props[0]); props[1] = new PropertyDescriptor[writeProperties.size()]; writeProperties.toArray(props[1]); return props; }
java
private static PropertyDescriptor[][] getBeanProperties(Class<?> beanType) { List<PropertyDescriptor> readProperties = new ArrayList<PropertyDescriptor>(); List<PropertyDescriptor> writeProperties = new ArrayList<PropertyDescriptor>(); try { Map<?, ?> map = CompleteIntrospector.getAllProperties(beanType); Iterator<?> it = map.values().iterator(); while (it.hasNext()) { PropertyDescriptor pd = (PropertyDescriptor)it.next(); if (pd.getReadMethod() != null) { readProperties.add(pd); } if (pd.getWriteMethod() != null) { writeProperties.add(pd); } } } catch (IntrospectionException e) { throw new RuntimeException(e.toString()); } PropertyDescriptor[][] props = new PropertyDescriptor[2][]; props[0] = new PropertyDescriptor[readProperties.size()]; readProperties.toArray(props[0]); props[1] = new PropertyDescriptor[writeProperties.size()]; writeProperties.toArray(props[1]); return props; }
[ "private", "static", "PropertyDescriptor", "[", "]", "[", "]", "getBeanProperties", "(", "Class", "<", "?", ">", "beanType", ")", "{", "List", "<", "PropertyDescriptor", ">", "readProperties", "=", "new", "ArrayList", "<", "PropertyDescriptor", ">", "(", ")", ...
Returns two arrays of PropertyDescriptors. Array 0 has contains read PropertyDescriptors, array 1 contains the write PropertyDescriptors.
[ "Returns", "two", "arrays", "of", "PropertyDescriptors", ".", "Array", "0", "has", "contains", "read", "PropertyDescriptors", "array", "1", "contains", "the", "write", "PropertyDescriptors", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/util/BeanPropertyAccessor.java#L419-L452
train
teatrove/teatrove
teaservlet/src/main/java/org/teatrove/teaservlet/ApplicationResponseImpl.java
ApplicationResponseImpl.writeShort
static void writeShort(OutputStream out, int i) throws IOException { out.write((byte)i); out.write((byte)(i >> 8)); }
java
static void writeShort(OutputStream out, int i) throws IOException { out.write((byte)i); out.write((byte)(i >> 8)); }
[ "static", "void", "writeShort", "(", "OutputStream", "out", ",", "int", "i", ")", "throws", "IOException", "{", "out", ".", "write", "(", "(", "byte", ")", "i", ")", ";", "out", ".", "write", "(", "(", "byte", ")", "(", "i", ">>", "8", ")", ")", ...
Writes a short in Intel byte order.
[ "Writes", "a", "short", "in", "Intel", "byte", "order", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/teaservlet/src/main/java/org/teatrove/teaservlet/ApplicationResponseImpl.java#L66-L69
train
teatrove/teatrove
teaservlet/src/main/java/org/teatrove/teaservlet/ApplicationResponseImpl.java
ApplicationResponseImpl.appendCompressed
void appendCompressed(ByteData compressed, ByteData original) throws IOException { mCompressedSegments++; mBuffer.appendSurrogate(new CompressedData(compressed, original)); }
java
void appendCompressed(ByteData compressed, ByteData original) throws IOException { mCompressedSegments++; mBuffer.appendSurrogate(new CompressedData(compressed, original)); }
[ "void", "appendCompressed", "(", "ByteData", "compressed", ",", "ByteData", "original", ")", "throws", "IOException", "{", "mCompressedSegments", "++", ";", "mBuffer", ".", "appendSurrogate", "(", "new", "CompressedData", "(", "compressed", ",", "original", ")", "...
Called from DetachedResponseImpl.
[ "Called", "from", "DetachedResponseImpl", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/teaservlet/src/main/java/org/teatrove/teaservlet/ApplicationResponseImpl.java#L366-L371
train
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/util/DecimalConvertor.java
DecimalConvertor.toDecimalDigits
public static int toDecimalDigits(float v, char[] digits, int offset, int maxDigits, int maxFractDigits, int roundMode) { int bits = Float.floatToIntBits(v); int f = bits & 0x7fffff; int e = (bits >> 23) & 0xff; if (e != 0) { // Normalized number. return toDecimalDigits(f + 0x800000, e - 126, 24, digits, offset, maxDigits, maxFractDigits, roundMode); } else { // Denormalized number. return toDecimalDigits(f, -125, 23, digits, offset, maxDigits, maxFractDigits, roundMode); } }
java
public static int toDecimalDigits(float v, char[] digits, int offset, int maxDigits, int maxFractDigits, int roundMode) { int bits = Float.floatToIntBits(v); int f = bits & 0x7fffff; int e = (bits >> 23) & 0xff; if (e != 0) { // Normalized number. return toDecimalDigits(f + 0x800000, e - 126, 24, digits, offset, maxDigits, maxFractDigits, roundMode); } else { // Denormalized number. return toDecimalDigits(f, -125, 23, digits, offset, maxDigits, maxFractDigits, roundMode); } }
[ "public", "static", "int", "toDecimalDigits", "(", "float", "v", ",", "char", "[", "]", "digits", ",", "int", "offset", ",", "int", "maxDigits", ",", "int", "maxFractDigits", ",", "int", "roundMode", ")", "{", "int", "bits", "=", "Float", ".", "floatToIn...
Produces decimal digits for non-zero, finite floating point values. The sign of the value is discarded. Passing in Infinity or NaN produces invalid digits. The maximum number of decimal digits that this function will likely produce is 9. @param v value @param digits buffer to receive decimal digits @param offset offset into digit buffer @param maxDigits maximum number of digits to produce @param maxFractDigits maximum number of fractional digits to produce @param roundMode i.e. ROUND_HALF_UP @return Upper 16 bits: decimal point offset; lower 16 bits: number of digits produced
[ "Produces", "decimal", "digits", "for", "non", "-", "zero", "finite", "floating", "point", "values", ".", "The", "sign", "of", "the", "value", "is", "discarded", ".", "Passing", "in", "Infinity", "or", "NaN", "produces", "invalid", "digits", ".", "The", "m...
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/util/DecimalConvertor.java#L819-L836
train
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/util/DecimalConvertor.java
DecimalConvertor.toDecimalDigits
public static int toDecimalDigits(double v, char[] digits, int offset, int maxDigits, int maxFractDigits, int roundMode) { // NOTE: The value 144115188075855872 is converted to // 144115188075855870, which is as correct as possible. Java's // Double.toString method doesn't round off the last digit. long bits = Double.doubleToLongBits(v); long f = bits & 0xfffffffffffffL; int e = (int)((bits >> 52) & 0x7ff); if (e != 0) { // Normalized number. return toDecimalDigits(f + 0x10000000000000L, e - 1022, 53, digits, offset, maxDigits, maxFractDigits, roundMode); } else { // Denormalized number. return toDecimalDigits(f, -1023, 52, digits, offset, maxDigits, maxFractDigits, roundMode); } }
java
public static int toDecimalDigits(double v, char[] digits, int offset, int maxDigits, int maxFractDigits, int roundMode) { // NOTE: The value 144115188075855872 is converted to // 144115188075855870, which is as correct as possible. Java's // Double.toString method doesn't round off the last digit. long bits = Double.doubleToLongBits(v); long f = bits & 0xfffffffffffffL; int e = (int)((bits >> 52) & 0x7ff); if (e != 0) { // Normalized number. return toDecimalDigits(f + 0x10000000000000L, e - 1022, 53, digits, offset, maxDigits, maxFractDigits, roundMode); } else { // Denormalized number. return toDecimalDigits(f, -1023, 52, digits, offset, maxDigits, maxFractDigits, roundMode); } }
[ "public", "static", "int", "toDecimalDigits", "(", "double", "v", ",", "char", "[", "]", "digits", ",", "int", "offset", ",", "int", "maxDigits", ",", "int", "maxFractDigits", ",", "int", "roundMode", ")", "{", "// NOTE: The value 144115188075855872 is converted t...
Produces decimal digits for non-zero, finite floating point values. The sign of the value is discarded. Passing in Infinity or NaN produces invalid digits. The maximum number of decimal digits that this function will likely produce is 18. @param v value @param digits buffer to receive decimal digits @param offset offset into digit buffer @param maxDigits maximum number of digits to produce @param maxFractDigits maximum number of fractional digits to produce @param roundMode i.e. ROUND_HALF_UP @return Upper 16 bits: decimal point offset; lower 16 bits: number of digits produced
[ "Produces", "decimal", "digits", "for", "non", "-", "zero", "finite", "floating", "point", "values", ".", "The", "sign", "of", "the", "value", "is", "discarded", ".", "Passing", "in", "Infinity", "or", "NaN", "produces", "invalid", "digits", ".", "The", "m...
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/util/DecimalConvertor.java#L853-L875
train
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/util/tq/TransactionQueueData.java
TransactionQueueData.add
public TransactionQueueData add(TransactionQueueData data) { return new TransactionQueueData (null, Math.min(mSnapshotStart, data.mSnapshotStart), Math.max(mSnapshotEnd, data.mSnapshotEnd), mQueueSize + data.mQueueSize, mThreadCount + data.mThreadCount, mServicingCount + data.mServicingCount, Math.max(mPeakQueueSize, data.mPeakQueueSize), Math.max(mPeakThreadCount, data.mPeakThreadCount), Math.max(mPeakServicingCount, data.mPeakServicingCount), mTotalEnqueueAttempts + data.mTotalEnqueueAttempts, mTotalEnqueued + data.mTotalEnqueued, mTotalServiced + data.mTotalServiced, mTotalExpired + data.mTotalExpired, mTotalServiceExceptions + data.mTotalServiceExceptions, mTotalUncaughtExceptions + data.mTotalUncaughtExceptions, mTotalQueueDuration + data.mTotalQueueDuration, mTotalServiceDuration + data.mTotalServiceDuration ); }
java
public TransactionQueueData add(TransactionQueueData data) { return new TransactionQueueData (null, Math.min(mSnapshotStart, data.mSnapshotStart), Math.max(mSnapshotEnd, data.mSnapshotEnd), mQueueSize + data.mQueueSize, mThreadCount + data.mThreadCount, mServicingCount + data.mServicingCount, Math.max(mPeakQueueSize, data.mPeakQueueSize), Math.max(mPeakThreadCount, data.mPeakThreadCount), Math.max(mPeakServicingCount, data.mPeakServicingCount), mTotalEnqueueAttempts + data.mTotalEnqueueAttempts, mTotalEnqueued + data.mTotalEnqueued, mTotalServiced + data.mTotalServiced, mTotalExpired + data.mTotalExpired, mTotalServiceExceptions + data.mTotalServiceExceptions, mTotalUncaughtExceptions + data.mTotalUncaughtExceptions, mTotalQueueDuration + data.mTotalQueueDuration, mTotalServiceDuration + data.mTotalServiceDuration ); }
[ "public", "TransactionQueueData", "add", "(", "TransactionQueueData", "data", ")", "{", "return", "new", "TransactionQueueData", "(", "null", ",", "Math", ".", "min", "(", "mSnapshotStart", ",", "data", ".", "mSnapshotStart", ")", ",", "Math", ".", "max", "(",...
Adds TransactionQueueData to another.
[ "Adds", "TransactionQueueData", "to", "another", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/util/tq/TransactionQueueData.java#L89-L109
train
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/util/WrappedCache.java
WrappedCache.get
public Object get(Object key) { Object value = mCacheMap.get(key); if (value != null || mCacheMap.containsKey(key)) { return value; } value = mBackingMap.get(key); if (value != null || mBackingMap.containsKey(key)) { mCacheMap.put(key, value); } return value; }
java
public Object get(Object key) { Object value = mCacheMap.get(key); if (value != null || mCacheMap.containsKey(key)) { return value; } value = mBackingMap.get(key); if (value != null || mBackingMap.containsKey(key)) { mCacheMap.put(key, value); } return value; }
[ "public", "Object", "get", "(", "Object", "key", ")", "{", "Object", "value", "=", "mCacheMap", ".", "get", "(", "key", ")", ";", "if", "(", "value", "!=", "null", "||", "mCacheMap", ".", "containsKey", "(", "key", ")", ")", "{", "return", "value", ...
Returns the value from the cache, or if not found, the backing map. If the backing map is accessed, the value is saved in the cache for future gets.
[ "Returns", "the", "value", "from", "the", "cache", "or", "if", "not", "found", "the", "backing", "map", ".", "If", "the", "backing", "map", "is", "accessed", "the", "value", "is", "saved", "in", "the", "cache", "for", "future", "gets", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/util/WrappedCache.java#L80-L90
train
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/util/WrappedCache.java
WrappedCache.put
public Object put(Object key, Object value) { mCacheMap.put(key, value); return mBackingMap.put(key, value); }
java
public Object put(Object key, Object value) { mCacheMap.put(key, value); return mBackingMap.put(key, value); }
[ "public", "Object", "put", "(", "Object", "key", ",", "Object", "value", ")", "{", "mCacheMap", ".", "put", "(", "key", ",", "value", ")", ";", "return", "mBackingMap", ".", "put", "(", "key", ",", "value", ")", ";", "}" ]
Puts the entry into both the cache and backing map. The old value in the backing map is returned.
[ "Puts", "the", "entry", "into", "both", "the", "cache", "and", "backing", "map", ".", "The", "old", "value", "in", "the", "backing", "map", "is", "returned", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/util/WrappedCache.java#L96-L99
train
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/util/WrappedCache.java
WrappedCache.remove
public Object remove(Object key) { mCacheMap.remove(key); return mBackingMap.remove(key); }
java
public Object remove(Object key) { mCacheMap.remove(key); return mBackingMap.remove(key); }
[ "public", "Object", "remove", "(", "Object", "key", ")", "{", "mCacheMap", ".", "remove", "(", "key", ")", ";", "return", "mBackingMap", ".", "remove", "(", "key", ")", ";", "}" ]
Removes the key from both the cache and backing map. The old value in the backing map is returned.
[ "Removes", "the", "key", "from", "both", "the", "cache", "and", "backing", "map", ".", "The", "old", "value", "in", "the", "backing", "map", "is", "returned", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/util/WrappedCache.java#L105-L108
train
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/util/plugin/PluginConfigSupport.java
PluginConfigSupport.getPlugin
public Plugin getPlugin(String name) { if (mPluginContext != null) { return mPluginContext.getPlugin(name); } return null; }
java
public Plugin getPlugin(String name) { if (mPluginContext != null) { return mPluginContext.getPlugin(name); } return null; }
[ "public", "Plugin", "getPlugin", "(", "String", "name", ")", "{", "if", "(", "mPluginContext", "!=", "null", ")", "{", "return", "mPluginContext", ".", "getPlugin", "(", "name", ")", ";", "}", "return", "null", ";", "}" ]
Returns a Plugin by name. @param name the name of the Plugin. @return Plugin the Plugin object.
[ "Returns", "a", "Plugin", "by", "name", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/util/plugin/PluginConfigSupport.java#L66-L71
train
teatrove/teatrove
trove/src/main/java/org/teatrove/trove/util/plugin/PluginConfigSupport.java
PluginConfigSupport.getPlugins
public Plugin[] getPlugins() { if (mPluginContext != null) { Collection c = mPluginContext.getPlugins().values(); if (c != null) { return (Plugin[])c.toArray(new Plugin[c.size()]); } } return new Plugin[0]; }
java
public Plugin[] getPlugins() { if (mPluginContext != null) { Collection c = mPluginContext.getPlugins().values(); if (c != null) { return (Plugin[])c.toArray(new Plugin[c.size()]); } } return new Plugin[0]; }
[ "public", "Plugin", "[", "]", "getPlugins", "(", ")", "{", "if", "(", "mPluginContext", "!=", "null", ")", "{", "Collection", "c", "=", "mPluginContext", ".", "getPlugins", "(", ")", ".", "values", "(", ")", ";", "if", "(", "c", "!=", "null", ")", ...
Returns an array of all of the Plugins. @return the array of Plugins.
[ "Returns", "an", "array", "of", "all", "of", "the", "Plugins", "." ]
7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea
https://github.com/teatrove/teatrove/blob/7039bdd4da6817ff8c737f7e4e07bac7e3ad8bea/trove/src/main/java/org/teatrove/trove/util/plugin/PluginConfigSupport.java#L78-L86
train
Azure/azure-sdk-for-java
eventhubs/data-plane/azure-eventhubs-eph/src/main/java/com/microsoft/azure/eventprocessorhost/BaseLease.java
BaseLease.isOwnedBy
public boolean isOwnedBy(String possibleOwner) { boolean retval = false; if (this.owner != null) { retval = (this.owner.compareTo(possibleOwner) == 0); } return retval; }
java
public boolean isOwnedBy(String possibleOwner) { boolean retval = false; if (this.owner != null) { retval = (this.owner.compareTo(possibleOwner) == 0); } return retval; }
[ "public", "boolean", "isOwnedBy", "(", "String", "possibleOwner", ")", "{", "boolean", "retval", "=", "false", ";", "if", "(", "this", ".", "owner", "!=", "null", ")", "{", "retval", "=", "(", "this", ".", "owner", ".", "compareTo", "(", "possibleOwner",...
Convenience function for comparing possibleOwner against this.owner @param possibleOwner name to check @return true if possibleOwner is the same as this.owner, false otherwise
[ "Convenience", "function", "for", "comparing", "possibleOwner", "against", "this", ".", "owner" ]
aab183ddc6686c82ec10386d5a683d2691039626
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/eventhubs/data-plane/azure-eventhubs-eph/src/main/java/com/microsoft/azure/eventprocessorhost/BaseLease.java#L120-L126
train
Azure/azure-sdk-for-java
policy/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/policy/v2018_03_01/implementation/PolicySetDefinitionsInner.java
PolicySetDefinitionsInner.deleteAtManagementGroup
public void deleteAtManagementGroup(String policySetDefinitionName, String managementGroupId) { deleteAtManagementGroupWithServiceResponseAsync(policySetDefinitionName, managementGroupId).toBlocking().single().body(); }
java
public void deleteAtManagementGroup(String policySetDefinitionName, String managementGroupId) { deleteAtManagementGroupWithServiceResponseAsync(policySetDefinitionName, managementGroupId).toBlocking().single().body(); }
[ "public", "void", "deleteAtManagementGroup", "(", "String", "policySetDefinitionName", ",", "String", "managementGroupId", ")", "{", "deleteAtManagementGroupWithServiceResponseAsync", "(", "policySetDefinitionName", ",", "managementGroupId", ")", ".", "toBlocking", "(", ")", ...
Deletes a policy set definition. This operation deletes the policy set definition in the given management group with the given name. @param policySetDefinitionName The name of the policy set definition to delete. @param managementGroupId The ID of the management group. @throws IllegalArgumentException thrown if parameters fail the validation @throws ErrorResponseException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
[ "Deletes", "a", "policy", "set", "definition", ".", "This", "operation", "deletes", "the", "policy", "set", "definition", "in", "the", "given", "management", "group", "with", "the", "given", "name", "." ]
aab183ddc6686c82ec10386d5a683d2691039626
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/policy/resource-manager/v2018_03_01/src/main/java/com/microsoft/azure/management/policy/v2018_03_01/implementation/PolicySetDefinitionsInner.java#L783-L785
train
Azure/azure-sdk-for-java
logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/WorkflowsInner.java
WorkflowsInner.delete
public void delete(String resourceGroupName, String workflowName) { deleteWithServiceResponseAsync(resourceGroupName, workflowName).toBlocking().single().body(); }
java
public void delete(String resourceGroupName, String workflowName) { deleteWithServiceResponseAsync(resourceGroupName, workflowName).toBlocking().single().body(); }
[ "public", "void", "delete", "(", "String", "resourceGroupName", ",", "String", "workflowName", ")", "{", "deleteWithServiceResponseAsync", "(", "resourceGroupName", ",", "workflowName", ")", ".", "toBlocking", "(", ")", ".", "single", "(", ")", ".", "body", "(",...
Deletes a workflow. @param resourceGroupName The resource group name. @param workflowName The workflow name. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
[ "Deletes", "a", "workflow", "." ]
aab183ddc6686c82ec10386d5a683d2691039626
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/WorkflowsInner.java#L881-L883
train
Azure/azure-sdk-for-java
logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/WorkflowsInner.java
WorkflowsInner.listByResourceGroupNextAsync
public Observable<Page<WorkflowInner>> listByResourceGroupNextAsync(final String nextPageLink) { return listByResourceGroupNextWithServiceResponseAsync(nextPageLink) .map(new Func1<ServiceResponse<Page<WorkflowInner>>, Page<WorkflowInner>>() { @Override public Page<WorkflowInner> call(ServiceResponse<Page<WorkflowInner>> response) { return response.body(); } }); }
java
public Observable<Page<WorkflowInner>> listByResourceGroupNextAsync(final String nextPageLink) { return listByResourceGroupNextWithServiceResponseAsync(nextPageLink) .map(new Func1<ServiceResponse<Page<WorkflowInner>>, Page<WorkflowInner>>() { @Override public Page<WorkflowInner> call(ServiceResponse<Page<WorkflowInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "WorkflowInner", ">", ">", "listByResourceGroupNextAsync", "(", "final", "String", "nextPageLink", ")", "{", "return", "listByResourceGroupNextWithServiceResponseAsync", "(", "nextPageLink", ")", ".", "map", "(", "new", "Func1...
Gets a list of workflows by resource group. @param nextPageLink The NextLink from the previous successful call to List operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;WorkflowInner&gt; object
[ "Gets", "a", "list", "of", "workflows", "by", "resource", "group", "." ]
aab183ddc6686c82ec10386d5a683d2691039626
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/WorkflowsInner.java#L2099-L2107
train
Azure/azure-sdk-for-java
kusto/resource-manager/v2018_09_07_preview/src/main/java/com/microsoft/azure/management/kusto/v2018_09_07_preview/implementation/ClustersInner.java
ClustersInner.listByResourceGroupAsync
public Observable<Page<ClusterInner>> listByResourceGroupAsync(String resourceGroupName) { return listByResourceGroupWithServiceResponseAsync(resourceGroupName).map(new Func1<ServiceResponse<List<ClusterInner>>, Page<ClusterInner>>() { @Override public Page<ClusterInner> call(ServiceResponse<List<ClusterInner>> response) { PageImpl<ClusterInner> page = new PageImpl<>(); page.setItems(response.body()); return page; } }); }
java
public Observable<Page<ClusterInner>> listByResourceGroupAsync(String resourceGroupName) { return listByResourceGroupWithServiceResponseAsync(resourceGroupName).map(new Func1<ServiceResponse<List<ClusterInner>>, Page<ClusterInner>>() { @Override public Page<ClusterInner> call(ServiceResponse<List<ClusterInner>> response) { PageImpl<ClusterInner> page = new PageImpl<>(); page.setItems(response.body()); return page; } }); }
[ "public", "Observable", "<", "Page", "<", "ClusterInner", ">", ">", "listByResourceGroupAsync", "(", "String", "resourceGroupName", ")", "{", "return", "listByResourceGroupWithServiceResponseAsync", "(", "resourceGroupName", ")", ".", "map", "(", "new", "Func1", "<", ...
Lists all Kusto clusters within a resource group. @param resourceGroupName The name of the resource group containing the Kusto cluster. @return the observable to the List&lt;ClusterInner&gt; object
[ "Lists", "all", "Kusto", "clusters", "within", "a", "resource", "group", "." ]
aab183ddc6686c82ec10386d5a683d2691039626
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/kusto/resource-manager/v2018_09_07_preview/src/main/java/com/microsoft/azure/management/kusto/v2018_09_07_preview/implementation/ClustersInner.java#L1062-L1071
train
Azure/azure-sdk-for-java
mediaservices/data-plane/src/main/java/com/microsoft/windowsazure/services/media/models/AssetDeliveryPolicy.java
AssetDeliveryPolicy.get
public static EntityGetOperation<AssetDeliveryPolicyInfo> get(String assetDeliveryPolicyId) { return new DefaultGetOperation<AssetDeliveryPolicyInfo>(ENTITY_SET, assetDeliveryPolicyId, AssetDeliveryPolicyInfo.class); }
java
public static EntityGetOperation<AssetDeliveryPolicyInfo> get(String assetDeliveryPolicyId) { return new DefaultGetOperation<AssetDeliveryPolicyInfo>(ENTITY_SET, assetDeliveryPolicyId, AssetDeliveryPolicyInfo.class); }
[ "public", "static", "EntityGetOperation", "<", "AssetDeliveryPolicyInfo", ">", "get", "(", "String", "assetDeliveryPolicyId", ")", "{", "return", "new", "DefaultGetOperation", "<", "AssetDeliveryPolicyInfo", ">", "(", "ENTITY_SET", ",", "assetDeliveryPolicyId", ",", "As...
Create an operation that will retrieve the given asset delivery policy @param assetDeliveryPolicyId id of asset delivery policy to retrieve @return the operation
[ "Create", "an", "operation", "that", "will", "retrieve", "the", "given", "asset", "delivery", "policy" ]
aab183ddc6686c82ec10386d5a683d2691039626
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/data-plane/src/main/java/com/microsoft/windowsazure/services/media/models/AssetDeliveryPolicy.java#L132-L135
train
Azure/azure-sdk-for-java
mediaservices/data-plane/src/main/java/com/microsoft/windowsazure/services/media/models/AssetDeliveryPolicy.java
AssetDeliveryPolicy.list
public static DefaultListOperation<AssetDeliveryPolicyInfo> list(LinkInfo<AssetDeliveryPolicyInfo> link) { return new DefaultListOperation<AssetDeliveryPolicyInfo>(link.getHref(), new GenericType<ListResult<AssetDeliveryPolicyInfo>>() { }); }
java
public static DefaultListOperation<AssetDeliveryPolicyInfo> list(LinkInfo<AssetDeliveryPolicyInfo> link) { return new DefaultListOperation<AssetDeliveryPolicyInfo>(link.getHref(), new GenericType<ListResult<AssetDeliveryPolicyInfo>>() { }); }
[ "public", "static", "DefaultListOperation", "<", "AssetDeliveryPolicyInfo", ">", "list", "(", "LinkInfo", "<", "AssetDeliveryPolicyInfo", ">", "link", ")", "{", "return", "new", "DefaultListOperation", "<", "AssetDeliveryPolicyInfo", ">", "(", "link", ".", "getHref", ...
Create an operation that will list all the asset delivery policies at the given link. @param link Link to request all the asset delivery policies. @return The list operation.
[ "Create", "an", "operation", "that", "will", "list", "all", "the", "asset", "delivery", "policies", "at", "the", "given", "link", "." ]
aab183ddc6686c82ec10386d5a683d2691039626
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/data-plane/src/main/java/com/microsoft/windowsazure/services/media/models/AssetDeliveryPolicy.java#L157-L161
train
Azure/azure-sdk-for-java
sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseAdvisorsInner.java
DatabaseAdvisorsInner.listByDatabaseAsync
public Observable<AdvisorListResultInner> listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName) { return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1<ServiceResponse<AdvisorListResultInner>, AdvisorListResultInner>() { @Override public AdvisorListResultInner call(ServiceResponse<AdvisorListResultInner> response) { return response.body(); } }); }
java
public Observable<AdvisorListResultInner> listByDatabaseAsync(String resourceGroupName, String serverName, String databaseName) { return listByDatabaseWithServiceResponseAsync(resourceGroupName, serverName, databaseName).map(new Func1<ServiceResponse<AdvisorListResultInner>, AdvisorListResultInner>() { @Override public AdvisorListResultInner call(ServiceResponse<AdvisorListResultInner> response) { return response.body(); } }); }
[ "public", "Observable", "<", "AdvisorListResultInner", ">", "listByDatabaseAsync", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "databaseName", ")", "{", "return", "listByDatabaseWithServiceResponseAsync", "(", "resourceGroupName", ",", ...
Returns a list of database advisors. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param databaseName The name of the database. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the AdvisorListResultInner object
[ "Returns", "a", "list", "of", "database", "advisors", "." ]
aab183ddc6686c82ec10386d5a683d2691039626
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseAdvisorsInner.java#L109-L116
train
Azure/azure-sdk-for-java
sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseAdvisorsInner.java
DatabaseAdvisorsInner.createOrUpdate
public AdvisorInner createOrUpdate(String resourceGroupName, String serverName, String databaseName, String advisorName, AutoExecuteStatus autoExecuteValue) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, advisorName, autoExecuteValue).toBlocking().single().body(); }
java
public AdvisorInner createOrUpdate(String resourceGroupName, String serverName, String databaseName, String advisorName, AutoExecuteStatus autoExecuteValue) { return createOrUpdateWithServiceResponseAsync(resourceGroupName, serverName, databaseName, advisorName, autoExecuteValue).toBlocking().single().body(); }
[ "public", "AdvisorInner", "createOrUpdate", "(", "String", "resourceGroupName", ",", "String", "serverName", ",", "String", "databaseName", ",", "String", "advisorName", ",", "AutoExecuteStatus", "autoExecuteValue", ")", "{", "return", "createOrUpdateWithServiceResponseAsyn...
Creates or updates a database advisor. @param resourceGroupName The name of the resource group that contains the resource. You can obtain this value from the Azure Resource Manager API or the portal. @param serverName The name of the server. @param databaseName The name of the database. @param advisorName The name of the Database Advisor. @param autoExecuteValue Gets the auto-execute status (whether to let the system execute the recommendations) of this advisor. Possible values are 'Enabled' and 'Disabled'. Possible values include: 'Enabled', 'Disabled', 'Default' @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent @return the AdvisorInner object if successful.
[ "Creates", "or", "updates", "a", "database", "advisor", "." ]
aab183ddc6686c82ec10386d5a683d2691039626
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/sql/resource-manager/v2014_04_01/src/main/java/com/microsoft/azure/management/sql/v2014_04_01/implementation/DatabaseAdvisorsInner.java#L277-L279
train
Azure/azure-sdk-for-java
authorization/msi-auth-token-provider-jar/src/main/java/com/microsoft/azure/msiAuthTokenProvider/MSICredentials.java
MSICredentials.getMSICredentials
public static MSICredentials getMSICredentials(String managementEndpoint) { //check if we are running in a web app String websiteName = System.getenv("WEBSITE_SITE_NAME"); if (websiteName != null && !websiteName.isEmpty()) { // We are in a web app... MSIConfigurationForAppService config = new MSIConfigurationForAppService(managementEndpoint); return forAppService(config); } else { //We are in a vm/container MSIConfigurationForVirtualMachine config = new MSIConfigurationForVirtualMachine(managementEndpoint); return forVirtualMachine(config); } }
java
public static MSICredentials getMSICredentials(String managementEndpoint) { //check if we are running in a web app String websiteName = System.getenv("WEBSITE_SITE_NAME"); if (websiteName != null && !websiteName.isEmpty()) { // We are in a web app... MSIConfigurationForAppService config = new MSIConfigurationForAppService(managementEndpoint); return forAppService(config); } else { //We are in a vm/container MSIConfigurationForVirtualMachine config = new MSIConfigurationForVirtualMachine(managementEndpoint); return forVirtualMachine(config); } }
[ "public", "static", "MSICredentials", "getMSICredentials", "(", "String", "managementEndpoint", ")", "{", "//check if we are running in a web app", "String", "websiteName", "=", "System", ".", "getenv", "(", "\"WEBSITE_SITE_NAME\"", ")", ";", "if", "(", "websiteName", "...
This method checks if the env vars "MSI_ENDPOINT" and "MSI_SECRET" exist. If they do, we return the msi creds class for APP Svcs otherwise we return one for VM @param managementEndpoint Management endpoint in Azure @return MSICredentials
[ "This", "method", "checks", "if", "the", "env", "vars", "MSI_ENDPOINT", "and", "MSI_SECRET", "exist", ".", "If", "they", "do", "we", "return", "the", "msi", "creds", "class", "for", "APP", "Svcs", "otherwise", "we", "return", "one", "for", "VM" ]
aab183ddc6686c82ec10386d5a683d2691039626
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/authorization/msi-auth-token-provider-jar/src/main/java/com/microsoft/azure/msiAuthTokenProvider/MSICredentials.java#L66-L79
train
Azure/azure-sdk-for-java
eventhubs/data-plane/azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/impl/FaultTolerantObject.java
FaultTolerantObject.unsafeGetIfOpened
T unsafeGetIfOpened() { if (innerObject != null && innerObject.getState() == IOObject.IOObjectState.OPENED) { return innerObject; } return null; }
java
T unsafeGetIfOpened() { if (innerObject != null && innerObject.getState() == IOObject.IOObjectState.OPENED) { return innerObject; } return null; }
[ "T", "unsafeGetIfOpened", "(", ")", "{", "if", "(", "innerObject", "!=", "null", "&&", "innerObject", ".", "getState", "(", ")", "==", "IOObject", ".", "IOObjectState", ".", "OPENED", ")", "{", "return", "innerObject", ";", "}", "return", "null", ";", "}...
should be invoked from reactor thread
[ "should", "be", "invoked", "from", "reactor", "thread" ]
aab183ddc6686c82ec10386d5a683d2691039626
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/eventhubs/data-plane/azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/impl/FaultTolerantObject.java#L32-L38
train
Azure/azure-sdk-for-java
containerregistry/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/containerregistry/v2018_09_01/implementation/TasksInner.java
TasksInner.delete
public void delete(String resourceGroupName, String registryName, String taskName) { deleteWithServiceResponseAsync(resourceGroupName, registryName, taskName).toBlocking().last().body(); }
java
public void delete(String resourceGroupName, String registryName, String taskName) { deleteWithServiceResponseAsync(resourceGroupName, registryName, taskName).toBlocking().last().body(); }
[ "public", "void", "delete", "(", "String", "resourceGroupName", ",", "String", "registryName", ",", "String", "taskName", ")", "{", "deleteWithServiceResponseAsync", "(", "resourceGroupName", ",", "registryName", ",", "taskName", ")", ".", "toBlocking", "(", ")", ...
Deletes a specified task. @param resourceGroupName The name of the resource group to which the container registry belongs. @param registryName The name of the container registry. @param taskName The name of the container registry task. @throws IllegalArgumentException thrown if parameters fail the validation @throws CloudException thrown if the request is rejected by server @throws RuntimeException all other wrapped checked exceptions if the request fails to be sent
[ "Deletes", "a", "specified", "task", "." ]
aab183ddc6686c82ec10386d5a683d2691039626
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/containerregistry/resource-manager/v2018_09_01/src/main/java/com/microsoft/azure/management/containerregistry/v2018_09_01/implementation/TasksInner.java#L513-L515
train
Azure/azure-sdk-for-java
applicationconfig/client/src/samples/java/PipelineSample.java
PipelineSample.main
public static void main(String[] args) throws NoSuchAlgorithmException, InvalidKeyException { // The connection string value can be obtained by going to your App Configuration instance in the Azure portal // and navigating to "Access Keys" page under the "Settings" section. final String connectionString = "endpoint={endpoint_value};id={id_value};name={secret_value}"; final HttpMethodRequestTracker tracker = new HttpMethodRequestTracker(); // Instantiate a client that will be used to call the service. // We add in a policy to track the type of HTTP method calls we make. // We also want to see the Header information of our HTTP requests, so we specify the detail level. final ConfigurationAsyncClient client = ConfigurationAsyncClient.builder() .credentials(new ConfigurationClientCredentials(connectionString)) .addPolicy(new HttpMethodRequestTrackingPolicy(tracker)) .httpLogDetailLevel(HttpLogDetailLevel.HEADERS) .build(); // Adding a couple of settings and then fetching all the settings in our repository. final List<ConfigurationSetting> settings = Flux.concat(client.addSetting(new ConfigurationSetting().key("hello").value("world")), client.setSetting(new ConfigurationSetting().key("newSetting").value("newValue"))) .then(client.listSettings(new SettingSelector().key("*")).collectList()) .block(); // Cleaning up after ourselves by deleting the values. final Stream<ConfigurationSetting> stream = settings == null ? Stream.empty() : settings.stream(); Flux.merge(stream.map(client::deleteSetting).collect(Collectors.toList())).blockLast(); // Check what sort of HTTP method calls we made. tracker.print(); }
java
public static void main(String[] args) throws NoSuchAlgorithmException, InvalidKeyException { // The connection string value can be obtained by going to your App Configuration instance in the Azure portal // and navigating to "Access Keys" page under the "Settings" section. final String connectionString = "endpoint={endpoint_value};id={id_value};name={secret_value}"; final HttpMethodRequestTracker tracker = new HttpMethodRequestTracker(); // Instantiate a client that will be used to call the service. // We add in a policy to track the type of HTTP method calls we make. // We also want to see the Header information of our HTTP requests, so we specify the detail level. final ConfigurationAsyncClient client = ConfigurationAsyncClient.builder() .credentials(new ConfigurationClientCredentials(connectionString)) .addPolicy(new HttpMethodRequestTrackingPolicy(tracker)) .httpLogDetailLevel(HttpLogDetailLevel.HEADERS) .build(); // Adding a couple of settings and then fetching all the settings in our repository. final List<ConfigurationSetting> settings = Flux.concat(client.addSetting(new ConfigurationSetting().key("hello").value("world")), client.setSetting(new ConfigurationSetting().key("newSetting").value("newValue"))) .then(client.listSettings(new SettingSelector().key("*")).collectList()) .block(); // Cleaning up after ourselves by deleting the values. final Stream<ConfigurationSetting> stream = settings == null ? Stream.empty() : settings.stream(); Flux.merge(stream.map(client::deleteSetting).collect(Collectors.toList())).blockLast(); // Check what sort of HTTP method calls we made. tracker.print(); }
[ "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "throws", "NoSuchAlgorithmException", ",", "InvalidKeyException", "{", "// The connection string value can be obtained by going to your App Configuration instance in the Azure portal", "// and navigating to \"A...
Runs the sample algorithm and demonstrates how to add a custom policy to the HTTP pipeline. @param args Unused. Arguments to the program. @throws NoSuchAlgorithmException when credentials cannot be created because the service cannot resolve the HMAC-SHA256 algorithm. @throws InvalidKeyException when credentials cannot be created because the connection string is invalid.
[ "Runs", "the", "sample", "algorithm", "and", "demonstrates", "how", "to", "add", "a", "custom", "policy", "to", "the", "HTTP", "pipeline", "." ]
aab183ddc6686c82ec10386d5a683d2691039626
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/applicationconfig/client/src/samples/java/PipelineSample.java#L36-L65
train
Azure/azure-sdk-for-java
eventhubs/data-plane/azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/ConnectionStringBuilder.java
ConnectionStringBuilder.setEndpoint
public ConnectionStringBuilder setEndpoint(String namespaceName, String domainName) { try { this.endpoint = new URI(String.format(Locale.US, END_POINT_FORMAT, namespaceName, domainName)); } catch (URISyntaxException exception) { throw new IllegalConnectionStringFormatException( String.format(Locale.US, "Invalid namespace name: %s", namespaceName), exception); } return this; }
java
public ConnectionStringBuilder setEndpoint(String namespaceName, String domainName) { try { this.endpoint = new URI(String.format(Locale.US, END_POINT_FORMAT, namespaceName, domainName)); } catch (URISyntaxException exception) { throw new IllegalConnectionStringFormatException( String.format(Locale.US, "Invalid namespace name: %s", namespaceName), exception); } return this; }
[ "public", "ConnectionStringBuilder", "setEndpoint", "(", "String", "namespaceName", ",", "String", "domainName", ")", "{", "try", "{", "this", ".", "endpoint", "=", "new", "URI", "(", "String", ".", "format", "(", "Locale", ".", "US", ",", "END_POINT_FORMAT", ...
Set an endpoint which can be used to connect to the EventHub instance. @param namespaceName the name of the namespace to connect to. @param domainName identifies the domain the namespace is located in. For non-public and national clouds, the domain will not be "servicebus.windows.net". Available options include: - "servicebus.usgovcloudapi.net" - "servicebus.cloudapi.de" - "servicebus.chinacloudapi.cn" @return the {@link ConnectionStringBuilder} being set.
[ "Set", "an", "endpoint", "which", "can", "be", "used", "to", "connect", "to", "the", "EventHub", "instance", "." ]
aab183ddc6686c82ec10386d5a683d2691039626
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/eventhubs/data-plane/azure-eventhubs/src/main/java/com/microsoft/azure/eventhubs/ConnectionStringBuilder.java#L138-L147
train
Azure/azure-sdk-for-java
mediaservices/data-plane/src/main/java/com/microsoft/windowsazure/services/media/implementation/ODataAtomMarshaller.java
ODataAtomMarshaller.marshalEntry
public void marshalEntry(Object content, OutputStream stream) throws JAXBException { marshaller.marshal(createEntry(content), stream); }
java
public void marshalEntry(Object content, OutputStream stream) throws JAXBException { marshaller.marshal(createEntry(content), stream); }
[ "public", "void", "marshalEntry", "(", "Object", "content", ",", "OutputStream", "stream", ")", "throws", "JAXBException", "{", "marshaller", ".", "marshal", "(", "createEntry", "(", "content", ")", ",", "stream", ")", ";", "}" ]
Convert the given content into an ATOM entry and write it to the given stream. @param content Content object to send @param stream Stream to write to @throws JAXBException if content is malformed/not marshallable
[ "Convert", "the", "given", "content", "into", "an", "ATOM", "entry", "and", "write", "it", "to", "the", "given", "stream", "." ]
aab183ddc6686c82ec10386d5a683d2691039626
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/data-plane/src/main/java/com/microsoft/windowsazure/services/media/implementation/ODataAtomMarshaller.java#L109-L112
train
Azure/azure-sdk-for-java
keyvault/resource-manager/v2016_10_01/src/main/java/com/microsoft/azure/management/keyvault/v2016_10_01/implementation/VaultsInner.java
VaultsInner.listByResourceGroupAsync
public Observable<Page<VaultInner>> listByResourceGroupAsync(final String resourceGroupName, final Integer top) { return listByResourceGroupWithServiceResponseAsync(resourceGroupName, top) .map(new Func1<ServiceResponse<Page<VaultInner>>, Page<VaultInner>>() { @Override public Page<VaultInner> call(ServiceResponse<Page<VaultInner>> response) { return response.body(); } }); }
java
public Observable<Page<VaultInner>> listByResourceGroupAsync(final String resourceGroupName, final Integer top) { return listByResourceGroupWithServiceResponseAsync(resourceGroupName, top) .map(new Func1<ServiceResponse<Page<VaultInner>>, Page<VaultInner>>() { @Override public Page<VaultInner> call(ServiceResponse<Page<VaultInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "VaultInner", ">", ">", "listByResourceGroupAsync", "(", "final", "String", "resourceGroupName", ",", "final", "Integer", "top", ")", "{", "return", "listByResourceGroupWithServiceResponseAsync", "(", "resourceGroupName", ",", ...
The List operation gets information about the vaults associated with the subscription and within the specified resource group. @param resourceGroupName The name of the Resource Group to which the vault belongs. @param top Maximum number of results to return. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;VaultInner&gt; object
[ "The", "List", "operation", "gets", "information", "about", "the", "vaults", "associated", "with", "the", "subscription", "and", "within", "the", "specified", "resource", "group", "." ]
aab183ddc6686c82ec10386d5a683d2691039626
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/resource-manager/v2016_10_01/src/main/java/com/microsoft/azure/management/keyvault/v2016_10_01/implementation/VaultsInner.java#L767-L775
train
Azure/azure-sdk-for-java
common/azure-common/src/main/java/com/azure/common/http/HttpPipelineCallContext.java
HttpPipelineCallContext.setData
public void setData(String key, Object value) { this.data = this.data.addData(key, value); }
java
public void setData(String key, Object value) { this.data = this.data.addData(key, value); }
[ "public", "void", "setData", "(", "String", "key", ",", "Object", "value", ")", "{", "this", ".", "data", "=", "this", ".", "data", ".", "addData", "(", "key", ",", "value", ")", ";", "}" ]
Stores a key-value data in the context. @param key the key @param value the value
[ "Stores", "a", "key", "-", "value", "data", "in", "the", "context", "." ]
aab183ddc6686c82ec10386d5a683d2691039626
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/common/azure-common/src/main/java/com/azure/common/http/HttpPipelineCallContext.java#L57-L59
train
Azure/azure-sdk-for-java
mediaservices/data-plane/src/main/java/com/microsoft/windowsazure/services/media/implementation/BatchMimeMultipart.java
BatchMimeMultipart.resetInputStreams
private void resetInputStreams() throws IOException, MessagingException { for (int ix = 0; ix < this.getCount(); ix++) { BodyPart part = this.getBodyPart(ix); if (part.getContent() instanceof MimeMultipart) { MimeMultipart subContent = (MimeMultipart) part.getContent(); for (int jx = 0; jx < subContent.getCount(); jx++) { BodyPart subPart = subContent.getBodyPart(jx); if (subPart.getContent() instanceof ByteArrayInputStream) { ((ByteArrayInputStream) subPart.getContent()).reset(); } } } } }
java
private void resetInputStreams() throws IOException, MessagingException { for (int ix = 0; ix < this.getCount(); ix++) { BodyPart part = this.getBodyPart(ix); if (part.getContent() instanceof MimeMultipart) { MimeMultipart subContent = (MimeMultipart) part.getContent(); for (int jx = 0; jx < subContent.getCount(); jx++) { BodyPart subPart = subContent.getBodyPart(jx); if (subPart.getContent() instanceof ByteArrayInputStream) { ((ByteArrayInputStream) subPart.getContent()).reset(); } } } } }
[ "private", "void", "resetInputStreams", "(", ")", "throws", "IOException", ",", "MessagingException", "{", "for", "(", "int", "ix", "=", "0", ";", "ix", "<", "this", ".", "getCount", "(", ")", ";", "ix", "++", ")", "{", "BodyPart", "part", "=", "this",...
reset all input streams to allow redirect filter to write the output twice
[ "reset", "all", "input", "streams", "to", "allow", "redirect", "filter", "to", "write", "the", "output", "twice" ]
aab183ddc6686c82ec10386d5a683d2691039626
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/mediaservices/data-plane/src/main/java/com/microsoft/windowsazure/services/media/implementation/BatchMimeMultipart.java#L26-L39
train
Azure/azure-sdk-for-java
logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/SessionsInner.java
SessionsInner.listByIntegrationAccountsNextAsync
public Observable<Page<IntegrationAccountSessionInner>> listByIntegrationAccountsNextAsync(final String nextPageLink) { return listByIntegrationAccountsNextWithServiceResponseAsync(nextPageLink) .map(new Func1<ServiceResponse<Page<IntegrationAccountSessionInner>>, Page<IntegrationAccountSessionInner>>() { @Override public Page<IntegrationAccountSessionInner> call(ServiceResponse<Page<IntegrationAccountSessionInner>> response) { return response.body(); } }); }
java
public Observable<Page<IntegrationAccountSessionInner>> listByIntegrationAccountsNextAsync(final String nextPageLink) { return listByIntegrationAccountsNextWithServiceResponseAsync(nextPageLink) .map(new Func1<ServiceResponse<Page<IntegrationAccountSessionInner>>, Page<IntegrationAccountSessionInner>>() { @Override public Page<IntegrationAccountSessionInner> call(ServiceResponse<Page<IntegrationAccountSessionInner>> response) { return response.body(); } }); }
[ "public", "Observable", "<", "Page", "<", "IntegrationAccountSessionInner", ">", ">", "listByIntegrationAccountsNextAsync", "(", "final", "String", "nextPageLink", ")", "{", "return", "listByIntegrationAccountsNextWithServiceResponseAsync", "(", "nextPageLink", ")", ".", "m...
Gets a list of integration account sessions. @param nextPageLink The NextLink from the previous successful call to List operation. @throws IllegalArgumentException thrown if parameters fail the validation @return the observable to the PagedList&lt;IntegrationAccountSessionInner&gt; object
[ "Gets", "a", "list", "of", "integration", "account", "sessions", "." ]
aab183ddc6686c82ec10386d5a683d2691039626
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/logic/resource-manager/v2016_06_01/src/main/java/com/microsoft/azure/management/logic/v2016_06_01/implementation/SessionsInner.java#L672-L680
train
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/messagesecurity/JWSObject.java
JWSObject.deserialize
public static JWSObject deserialize(String json) throws IOException { ObjectMapper mapper = new ObjectMapper(); return mapper.readValue(json, JWSObject.class); }
java
public static JWSObject deserialize(String json) throws IOException { ObjectMapper mapper = new ObjectMapper(); return mapper.readValue(json, JWSObject.class); }
[ "public", "static", "JWSObject", "deserialize", "(", "String", "json", ")", "throws", "IOException", "{", "ObjectMapper", "mapper", "=", "new", "ObjectMapper", "(", ")", ";", "return", "mapper", ".", "readValue", "(", "json", ",", "JWSObject", ".", "class", ...
Construct JWSObject from json string. @param json json string. @return Constructed JWSObject
[ "Construct", "JWSObject", "from", "json", "string", "." ]
aab183ddc6686c82ec10386d5a683d2691039626
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/messagesecurity/JWSObject.java#L104-L107
train
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/models/custom/KeyBundle.java
KeyBundle.keyIdentifier
public KeyIdentifier keyIdentifier() { if (key() == null || key().kid() == null || key().kid().length() == 0) { return null; } return new KeyIdentifier(key().kid()); }
java
public KeyIdentifier keyIdentifier() { if (key() == null || key().kid() == null || key().kid().length() == 0) { return null; } return new KeyIdentifier(key().kid()); }
[ "public", "KeyIdentifier", "keyIdentifier", "(", ")", "{", "if", "(", "key", "(", ")", "==", "null", "||", "key", "(", ")", ".", "kid", "(", ")", "==", "null", "||", "key", "(", ")", ".", "kid", "(", ")", ".", "length", "(", ")", "==", "0", "...
The key identifier. @return identifier for the key
[ "The", "key", "identifier", "." ]
aab183ddc6686c82ec10386d5a683d2691039626
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/models/custom/KeyBundle.java#L40-L45
train
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/authentication/ChallengeCache.java
ChallengeCache.getCachedChallenge
public Map<String, String> getCachedChallenge(HttpUrl url) { if (url == null) { return null; } String authority = getAuthority(url); authority = authority.toLowerCase(Locale.ENGLISH); return cachedChallenges.get(authority); }
java
public Map<String, String> getCachedChallenge(HttpUrl url) { if (url == null) { return null; } String authority = getAuthority(url); authority = authority.toLowerCase(Locale.ENGLISH); return cachedChallenges.get(authority); }
[ "public", "Map", "<", "String", ",", "String", ">", "getCachedChallenge", "(", "HttpUrl", "url", ")", "{", "if", "(", "url", "==", "null", ")", "{", "return", "null", ";", "}", "String", "authority", "=", "getAuthority", "(", "url", ")", ";", "authorit...
Uses authority to retrieve the cached values. @param url the url that is used as a cache key. @return cached value or null if value is not available.
[ "Uses", "authority", "to", "retrieve", "the", "cached", "values", "." ]
aab183ddc6686c82ec10386d5a683d2691039626
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/authentication/ChallengeCache.java#L26-L33
train
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/authentication/ChallengeCache.java
ChallengeCache.addCachedChallenge
public void addCachedChallenge(HttpUrl url, Map<String, String> challenge) { if (url == null || challenge == null) { return; } String authority = getAuthority(url); authority = authority.toLowerCase(Locale.ENGLISH); cachedChallenges.put(authority, challenge); }
java
public void addCachedChallenge(HttpUrl url, Map<String, String> challenge) { if (url == null || challenge == null) { return; } String authority = getAuthority(url); authority = authority.toLowerCase(Locale.ENGLISH); cachedChallenges.put(authority, challenge); }
[ "public", "void", "addCachedChallenge", "(", "HttpUrl", "url", ",", "Map", "<", "String", ",", "String", ">", "challenge", ")", "{", "if", "(", "url", "==", "null", "||", "challenge", "==", "null", ")", "{", "return", ";", "}", "String", "authority", "...
Uses authority to cache challenge. @param url the url that is used as a cache key. @param challenge the challenge to cache.
[ "Uses", "authority", "to", "cache", "challenge", "." ]
aab183ddc6686c82ec10386d5a683d2691039626
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/authentication/ChallengeCache.java#L43-L50
train
Azure/azure-sdk-for-java
keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/authentication/ChallengeCache.java
ChallengeCache.getAuthority
public String getAuthority(HttpUrl url) { String scheme = url.scheme(); String host = url.host(); int port = url.port(); StringBuilder builder = new StringBuilder(); if (scheme != null) { builder.append(scheme).append("://"); } builder.append(host); if (port >= 0) { builder.append(':').append(port); } return builder.toString(); }
java
public String getAuthority(HttpUrl url) { String scheme = url.scheme(); String host = url.host(); int port = url.port(); StringBuilder builder = new StringBuilder(); if (scheme != null) { builder.append(scheme).append("://"); } builder.append(host); if (port >= 0) { builder.append(':').append(port); } return builder.toString(); }
[ "public", "String", "getAuthority", "(", "HttpUrl", "url", ")", "{", "String", "scheme", "=", "url", ".", "scheme", "(", ")", ";", "String", "host", "=", "url", ".", "host", "(", ")", ";", "int", "port", "=", "url", ".", "port", "(", ")", ";", "S...
Gets authority of a url. @param url the url to get the authority for. @return the authority.
[ "Gets", "authority", "of", "a", "url", "." ]
aab183ddc6686c82ec10386d5a683d2691039626
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/keyvault/data-plane/azure-keyvault/src/main/java/com/microsoft/azure/keyvault/authentication/ChallengeCache.java#L59-L72
train
Azure/azure-sdk-for-java
common/azure-common/src/main/java/com/azure/common/implementation/serializer/HttpResponseHeaderDecoder.java
HttpResponseHeaderDecoder.decode
static Mono<Object> decode(HttpResponse httpResponse, SerializerAdapter serializer, HttpResponseDecodeData decodeData) { Type headerType = decodeData.headersType(); if (headerType == null) { return Mono.empty(); } else { return Mono.defer(() -> { try { return Mono.just(deserializeHeaders(httpResponse.headers(), serializer, decodeData)); } catch (IOException e) { return Mono.error(new HttpRequestException("HTTP response has malformed headers", httpResponse, e)); } }); } }
java
static Mono<Object> decode(HttpResponse httpResponse, SerializerAdapter serializer, HttpResponseDecodeData decodeData) { Type headerType = decodeData.headersType(); if (headerType == null) { return Mono.empty(); } else { return Mono.defer(() -> { try { return Mono.just(deserializeHeaders(httpResponse.headers(), serializer, decodeData)); } catch (IOException e) { return Mono.error(new HttpRequestException("HTTP response has malformed headers", httpResponse, e)); } }); } }
[ "static", "Mono", "<", "Object", ">", "decode", "(", "HttpResponse", "httpResponse", ",", "SerializerAdapter", "serializer", ",", "HttpResponseDecodeData", "decodeData", ")", "{", "Type", "headerType", "=", "decodeData", ".", "headersType", "(", ")", ";", "if", ...
Decode headers of the http response. The decoding happens when caller subscribed to the returned {@code Mono<Object>}, if the response header is not decodable then {@code Mono.empty()} will be returned. @param httpResponse the response containing the headers to be decoded @param serializer the adapter to use for decoding @param decodeData the necessary data required to decode a Http response @return publisher that emits decoded response header upon subscription if header is decodable, no emission if the header is not-decodable
[ "Decode", "headers", "of", "the", "http", "response", "." ]
aab183ddc6686c82ec10386d5a683d2691039626
https://github.com/Azure/azure-sdk-for-java/blob/aab183ddc6686c82ec10386d5a683d2691039626/common/azure-common/src/main/java/com/azure/common/implementation/serializer/HttpResponseHeaderDecoder.java#L38-L51
train