id int32 0 165k | repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 |
|---|---|---|---|---|---|---|---|---|---|---|---|
57,600 | amzn/ion-java | src/com/amazon/ion/impl/IonReaderBinaryRawX.java | IonReaderBinaryRawX.readVarInt | private int readVarInt(int firstByte) throws IOException {
// VarInt uses the high-order bit of the last octet as a marker; some (but not all) 5-byte VarInts can fit
// into a Java int.
// To validate overflows we accumulate the VarInt in a long and then check if it can be represented by an int
... | java | private int readVarInt(int firstByte) throws IOException {
// VarInt uses the high-order bit of the last octet as a marker; some (but not all) 5-byte VarInts can fit
// into a Java int.
// To validate overflows we accumulate the VarInt in a long and then check if it can be represented by an int
... | [
"private",
"int",
"readVarInt",
"(",
"int",
"firstByte",
")",
"throws",
"IOException",
"{",
"// VarInt uses the high-order bit of the last octet as a marker; some (but not all) 5-byte VarInts can fit",
"// into a Java int.",
"// To validate overflows we accumulate the VarInt in a long and th... | reads a varInt after the first byte was read. The first byte is used to specify the sign and -0 has different
representation on the protected API that was called
@param firstByte last varInt octet | [
"reads",
"a",
"varInt",
"after",
"the",
"first",
"byte",
"was",
"read",
".",
"The",
"first",
"byte",
"is",
"used",
"to",
"specify",
"the",
"sign",
"and",
"-",
"0",
"has",
"different",
"representation",
"on",
"the",
"protected",
"API",
"that",
"was",
"cal... | 4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270 | https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/impl/IonReaderBinaryRawX.java#L929-L983 |
57,601 | amzn/ion-java | src/com/amazon/ion/impl/IonTokenReader.java | IonTokenReader.next | public Type next(boolean is_in_expression) throws IOException {
inQuotedContent = false;
int c = this.readIgnoreWhitespace();
return next(c, is_in_expression);
} | java | public Type next(boolean is_in_expression) throws IOException {
inQuotedContent = false;
int c = this.readIgnoreWhitespace();
return next(c, is_in_expression);
} | [
"public",
"Type",
"next",
"(",
"boolean",
"is_in_expression",
")",
"throws",
"IOException",
"{",
"inQuotedContent",
"=",
"false",
";",
"int",
"c",
"=",
"this",
".",
"readIgnoreWhitespace",
"(",
")",
";",
"return",
"next",
"(",
"c",
",",
"is_in_expression",
"... | Java handles the tail optimization) | [
"Java",
"handles",
"the",
"tail",
"optimization",
")"
] | 4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270 | https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/impl/IonTokenReader.java#L464-L468 |
57,602 | amzn/ion-java | src/com/amazon/ion/impl/IonTokenReader.java | IonTokenReader.twoMoreSingleQuotes | private boolean twoMoreSingleQuotes() throws IOException
{
int c = read();
if (c == '\'') {
int c2 = read();
if (c2 == '\'') {
return true;
}
unread(c2);
}
unread(c);
return false;
} | java | private boolean twoMoreSingleQuotes() throws IOException
{
int c = read();
if (c == '\'') {
int c2 = read();
if (c2 == '\'') {
return true;
}
unread(c2);
}
unread(c);
return false;
} | [
"private",
"boolean",
"twoMoreSingleQuotes",
"(",
")",
"throws",
"IOException",
"{",
"int",
"c",
"=",
"read",
"(",
")",
";",
"if",
"(",
"c",
"==",
"'",
"'",
")",
"{",
"int",
"c2",
"=",
"read",
"(",
")",
";",
"if",
"(",
"c2",
"==",
"'",
"'",
")"... | If two single quotes are next on the input, consume them and return
true. Otherwise, leave them on the input and return false.
@return true when there are two pending single quotes.
@throws IOException | [
"If",
"two",
"single",
"quotes",
"are",
"next",
"on",
"the",
"input",
"consume",
"them",
"and",
"return",
"true",
".",
"Otherwise",
"leave",
"them",
"on",
"the",
"input",
"and",
"return",
"false",
"."
] | 4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270 | https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/impl/IonTokenReader.java#L1065-L1077 |
57,603 | amzn/ion-java | src/com/amazon/ion/impl/IonTokenConstsX.java | IonTokenConstsX.typeNameKeyWordFromMask | public final static int typeNameKeyWordFromMask(int possible_names, int length) {
int kw = KEYWORD_unrecognized;
if (possible_names != IonTokenConstsX.KW_ALL_BITS) {
for (int ii=0; ii<typeNameBits.length; ii++) {
int tb = typeNameBits[ii];
if (tb == possible_n... | java | public final static int typeNameKeyWordFromMask(int possible_names, int length) {
int kw = KEYWORD_unrecognized;
if (possible_names != IonTokenConstsX.KW_ALL_BITS) {
for (int ii=0; ii<typeNameBits.length; ii++) {
int tb = typeNameBits[ii];
if (tb == possible_n... | [
"public",
"final",
"static",
"int",
"typeNameKeyWordFromMask",
"(",
"int",
"possible_names",
",",
"int",
"length",
")",
"{",
"int",
"kw",
"=",
"KEYWORD_unrecognized",
";",
"if",
"(",
"possible_names",
"!=",
"IonTokenConstsX",
".",
"KW_ALL_BITS",
")",
"{",
"for",... | this can be faster but it's pretty unusual to be called. | [
"this",
"can",
"be",
"faster",
"but",
"it",
"s",
"pretty",
"unusual",
"to",
"be",
"called",
"."
] | 4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270 | https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/impl/IonTokenConstsX.java#L814-L828 |
57,604 | amzn/ion-java | src/com/amazon/ion/system/IonTextWriterBuilder.java | IonTextWriterBuilder.withIvmMinimizing | public final IonTextWriterBuilder
withIvmMinimizing(IvmMinimizing minimizing)
{
IonTextWriterBuilder b = mutable();
b.setIvmMinimizing(minimizing);
return b;
} | java | public final IonTextWriterBuilder
withIvmMinimizing(IvmMinimizing minimizing)
{
IonTextWriterBuilder b = mutable();
b.setIvmMinimizing(minimizing);
return b;
} | [
"public",
"final",
"IonTextWriterBuilder",
"withIvmMinimizing",
"(",
"IvmMinimizing",
"minimizing",
")",
"{",
"IonTextWriterBuilder",
"b",
"=",
"mutable",
"(",
")",
";",
"b",
".",
"setIvmMinimizing",
"(",
"minimizing",
")",
";",
"return",
"b",
";",
"}"
] | Declares the strategy for reducing or eliminating non-initial Ion version
markers, returning a new mutable builder if this is immutable.
When null, IVMs are emitted as they are written.
@param minimizing the IVM minimization strategy.
Null indicates that all explicitly-written IVMs will be emitted.
@return this insta... | [
"Declares",
"the",
"strategy",
"for",
"reducing",
"or",
"eliminating",
"non",
"-",
"initial",
"Ion",
"version",
"markers",
"returning",
"a",
"new",
"mutable",
"builder",
"if",
"this",
"is",
"immutable",
".",
"When",
"null",
"IVMs",
"are",
"emitted",
"as",
"t... | 4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270 | https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/system/IonTextWriterBuilder.java#L500-L506 |
57,605 | amzn/ion-java | src/com/amazon/ion/system/IonTextWriterBuilder.java | IonTextWriterBuilder.withLongStringThreshold | public final IonTextWriterBuilder withLongStringThreshold(int threshold)
{
IonTextWriterBuilder b = mutable();
b.setLongStringThreshold(threshold);
return b;
} | java | public final IonTextWriterBuilder withLongStringThreshold(int threshold)
{
IonTextWriterBuilder b = mutable();
b.setLongStringThreshold(threshold);
return b;
} | [
"public",
"final",
"IonTextWriterBuilder",
"withLongStringThreshold",
"(",
"int",
"threshold",
")",
"{",
"IonTextWriterBuilder",
"b",
"=",
"mutable",
"(",
")",
";",
"b",
".",
"setLongStringThreshold",
"(",
"threshold",
")",
";",
"return",
"b",
";",
"}"
] | Declares the length beyond which string and clob content will be rendered
as triple-quoted "long strings".
At present, such content will only line-break on extant newlines.
@param threshold the new threshold; zero means none.
@see #getLongStringThreshold()
@see #setLongStringThreshold(int)
@return this instance, if ... | [
"Declares",
"the",
"length",
"beyond",
"which",
"string",
"and",
"clob",
"content",
"will",
"be",
"rendered",
"as",
"triple",
"-",
"quoted",
"long",
"strings",
".",
"At",
"present",
"such",
"content",
"will",
"only",
"line",
"-",
"break",
"on",
"extant",
"... | 4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270 | https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/system/IonTextWriterBuilder.java#L619-L624 |
57,606 | amzn/ion-java | src/com/amazon/ion/impl/bin/IonManagedBinaryWriter.java | IonManagedBinaryWriter.startLocalSymbolTableIfNeeded | private void startLocalSymbolTableIfNeeded(final boolean writeIVM) throws IOException
{
if (symbolState == SymbolState.SYSTEM_SYMBOLS)
{
if (writeIVM)
{
symbols.writeIonVersionMarker();
}
symbols.addTypeAnnotationSymbol(systemSymbol(ION... | java | private void startLocalSymbolTableIfNeeded(final boolean writeIVM) throws IOException
{
if (symbolState == SymbolState.SYSTEM_SYMBOLS)
{
if (writeIVM)
{
symbols.writeIonVersionMarker();
}
symbols.addTypeAnnotationSymbol(systemSymbol(ION... | [
"private",
"void",
"startLocalSymbolTableIfNeeded",
"(",
"final",
"boolean",
"writeIVM",
")",
"throws",
"IOException",
"{",
"if",
"(",
"symbolState",
"==",
"SymbolState",
".",
"SYSTEM_SYMBOLS",
")",
"{",
"if",
"(",
"writeIVM",
")",
"{",
"symbols",
".",
"writeIon... | Symbol Table Management | [
"Symbol",
"Table",
"Management"
] | 4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270 | https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/impl/bin/IonManagedBinaryWriter.java#L741-L775 |
57,607 | amzn/ion-java | src/com/amazon/ion/impl/bin/IonManagedBinaryWriter.java | IonManagedBinaryWriter.setFieldName | public void setFieldName(final String name)
{
if (!isInStruct())
{
throw new IllegalStateException("IonWriter.setFieldName() must be called before writing a value into a struct.");
}
if (name == null)
{
throw new NullPointerException("Null field name i... | java | public void setFieldName(final String name)
{
if (!isInStruct())
{
throw new IllegalStateException("IonWriter.setFieldName() must be called before writing a value into a struct.");
}
if (name == null)
{
throw new NullPointerException("Null field name i... | [
"public",
"void",
"setFieldName",
"(",
"final",
"String",
"name",
")",
"{",
"if",
"(",
"!",
"isInStruct",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"IonWriter.setFieldName() must be called before writing a value into a struct.\"",
")",
";",
"... | Current Value Meta | [
"Current",
"Value",
"Meta"
] | 4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270 | https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/impl/bin/IonManagedBinaryWriter.java#L870-L882 |
57,608 | amzn/ion-java | src/com/amazon/ion/system/SimpleCatalog.java | SimpleCatalog.removeTable | public SymbolTable removeTable(String name, int version)
{
SymbolTable removed = null;
synchronized (myTablesByName)
{
TreeMap<Integer,SymbolTable> versions =
myTablesByName.get(name);
if (versions != null)
{
synchronized (... | java | public SymbolTable removeTable(String name, int version)
{
SymbolTable removed = null;
synchronized (myTablesByName)
{
TreeMap<Integer,SymbolTable> versions =
myTablesByName.get(name);
if (versions != null)
{
synchronized (... | [
"public",
"SymbolTable",
"removeTable",
"(",
"String",
"name",
",",
"int",
"version",
")",
"{",
"SymbolTable",
"removed",
"=",
"null",
";",
"synchronized",
"(",
"myTablesByName",
")",
"{",
"TreeMap",
"<",
"Integer",
",",
"SymbolTable",
">",
"versions",
"=",
... | Removes a symbol table from this catalog.
@return the removed table, or <code>null</code> if this catalog has
no matching table. | [
"Removes",
"a",
"symbol",
"table",
"from",
"this",
"catalog",
"."
] | 4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270 | https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/system/SimpleCatalog.java#L181-L205 |
57,609 | amzn/ion-java | src/com/amazon/ion/system/SimpleCatalog.java | SimpleCatalog.iterator | public Iterator<SymbolTable> iterator()
{
ArrayList<SymbolTable> tables;
synchronized (myTablesByName)
{
tables = new ArrayList<SymbolTable>(myTablesByName.size());
// I don't think we can shorten the synchronization block
// because HashMap.values() res... | java | public Iterator<SymbolTable> iterator()
{
ArrayList<SymbolTable> tables;
synchronized (myTablesByName)
{
tables = new ArrayList<SymbolTable>(myTablesByName.size());
// I don't think we can shorten the synchronization block
// because HashMap.values() res... | [
"public",
"Iterator",
"<",
"SymbolTable",
">",
"iterator",
"(",
")",
"{",
"ArrayList",
"<",
"SymbolTable",
">",
"tables",
";",
"synchronized",
"(",
"myTablesByName",
")",
"{",
"tables",
"=",
"new",
"ArrayList",
"<",
"SymbolTable",
">",
"(",
"myTablesByName",
... | Constructs an iterator that enumerates all of the shared symbol tables
in this catalog, at the time of method invocation. The result represents
a snapshot of the state of this catalog.
@return a non-null, but potentially empty, iterator. | [
"Constructs",
"an",
"iterator",
"that",
"enumerates",
"all",
"of",
"the",
"shared",
"symbol",
"tables",
"in",
"this",
"catalog",
"at",
"the",
"time",
"of",
"method",
"invocation",
".",
"The",
"result",
"represents",
"a",
"snapshot",
"of",
"the",
"state",
"of... | 4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270 | https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/system/SimpleCatalog.java#L215-L238 |
57,610 | amzn/ion-java | src/com/amazon/ion/impl/lite/IonContainerLite.java | IonContainerLite.validateNewChild | void validateNewChild(IonValue child)
throws ContainedValueException, NullPointerException,
IllegalArgumentException
{
if (child.getContainer() != null) // Also checks for null.
{
throw new ContainedValueException();
}
if (child.isReadOn... | java | void validateNewChild(IonValue child)
throws ContainedValueException, NullPointerException,
IllegalArgumentException
{
if (child.getContainer() != null) // Also checks for null.
{
throw new ContainedValueException();
}
if (child.isReadOn... | [
"void",
"validateNewChild",
"(",
"IonValue",
"child",
")",
"throws",
"ContainedValueException",
",",
"NullPointerException",
",",
"IllegalArgumentException",
"{",
"if",
"(",
"child",
".",
"getContainer",
"(",
")",
"!=",
"null",
")",
"// Also checks for null.",
"{",
... | Ensures that a potential new child is non-null, has no container,
is not read-only, and is not a datagram.
@throws NullPointerException
if {@code child} is {@code null}.
@throws ContainedValueException
if {@code child} is already part of a container.
@throws ReadOnlyValueException
if {@code child} is read only.
@throw... | [
"Ensures",
"that",
"a",
"potential",
"new",
"child",
"is",
"non",
"-",
"null",
"has",
"no",
"container",
"is",
"not",
"read",
"-",
"only",
"and",
"is",
"not",
"a",
"datagram",
"."
] | 4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270 | https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/impl/lite/IonContainerLite.java#L506-L529 |
57,611 | amzn/ion-java | src/com/amazon/ion/impl/lite/IonContainerLite.java | IonContainerLite.add_child | protected int add_child(int idx, IonValueLite child)
{
_isNullValue(false); // if we add children we're not null anymore
child.setContext(this.getContextForIndex(child, idx));
if (_children == null || _child_count >= _children.length) {
int old_len = (_children == null) ? 0 : _ch... | java | protected int add_child(int idx, IonValueLite child)
{
_isNullValue(false); // if we add children we're not null anymore
child.setContext(this.getContextForIndex(child, idx));
if (_children == null || _child_count >= _children.length) {
int old_len = (_children == null) ? 0 : _ch... | [
"protected",
"int",
"add_child",
"(",
"int",
"idx",
",",
"IonValueLite",
"child",
")",
"{",
"_isNullValue",
"(",
"false",
")",
";",
"// if we add children we're not null anymore",
"child",
".",
"setContext",
"(",
"this",
".",
"getContextForIndex",
"(",
"child",
",... | Does not validate the child or check locks. | [
"Does",
"not",
"validate",
"the",
"child",
"or",
"check",
"locks",
"."
] | 4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270 | https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/impl/lite/IonContainerLite.java#L673-L702 |
57,612 | amzn/ion-java | src/com/amazon/ion/impl/lite/IonContainerLite.java | IonContainerLite.remove_child | void remove_child(int idx)
{
assert(idx >=0);
assert(idx < get_child_count()); // this also asserts child count > 0
assert get_child(idx) != null : "No child at index " + idx;
_children[idx].detachFromContainer();
int children_to_move = _child_count - idx - 1;
if (ch... | java | void remove_child(int idx)
{
assert(idx >=0);
assert(idx < get_child_count()); // this also asserts child count > 0
assert get_child(idx) != null : "No child at index " + idx;
_children[idx].detachFromContainer();
int children_to_move = _child_count - idx - 1;
if (ch... | [
"void",
"remove_child",
"(",
"int",
"idx",
")",
"{",
"assert",
"(",
"idx",
">=",
"0",
")",
";",
"assert",
"(",
"idx",
"<",
"get_child_count",
"(",
")",
")",
";",
"// this also asserts child count > 0",
"assert",
"get_child",
"(",
"idx",
")",
"!=",
"null",
... | Does not check locks. | [
"Does",
"not",
"check",
"locks",
"."
] | 4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270 | https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/impl/lite/IonContainerLite.java#L712-L726 |
57,613 | amzn/ion-java | src/com/amazon/ion/impl/lite/IonStructLite.java | IonStructLite.put | public void put(String fieldName, IonValue value)
{
checkForLock();
validateFieldName(fieldName);
if (value != null) validateNewChild(value);
int lowestRemovedIndex = get_child_count();
boolean any_removed = false;
// first we remove the any existing fields
... | java | public void put(String fieldName, IonValue value)
{
checkForLock();
validateFieldName(fieldName);
if (value != null) validateNewChild(value);
int lowestRemovedIndex = get_child_count();
boolean any_removed = false;
// first we remove the any existing fields
... | [
"public",
"void",
"put",
"(",
"String",
"fieldName",
",",
"IonValue",
"value",
")",
"{",
"checkForLock",
"(",
")",
";",
"validateFieldName",
"(",
"fieldName",
")",
";",
"if",
"(",
"value",
"!=",
"null",
")",
"validateNewChild",
"(",
"value",
")",
";",
"i... | put is "make this value the one and only value
associated with this fieldName". The side effect
is that if there were multiple fields with this
name when put is complete there will only be the
one value in the collection. | [
"put",
"is",
"make",
"this",
"value",
"the",
"one",
"and",
"only",
"value",
"associated",
"with",
"this",
"fieldName",
".",
"The",
"side",
"effect",
"is",
"that",
"if",
"there",
"were",
"multiple",
"fields",
"with",
"this",
"name",
"when",
"put",
"is",
"... | 4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270 | https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/impl/lite/IonStructLite.java#L560-L629 |
57,614 | amzn/ion-java | src/com/amazon/ion/impl/lite/IonLobLite.java | IonLobLite.lobHashCode | protected int lobHashCode(int seed, SymbolTableProvider symbolTableProvider)
{
int result = seed;
if (!isNullValue()) {
CRC32 crc = new CRC32();
crc.update(getBytes());
result ^= (int) crc.getValue();
}
return hashTypeAnnotations(result, symbolT... | java | protected int lobHashCode(int seed, SymbolTableProvider symbolTableProvider)
{
int result = seed;
if (!isNullValue()) {
CRC32 crc = new CRC32();
crc.update(getBytes());
result ^= (int) crc.getValue();
}
return hashTypeAnnotations(result, symbolT... | [
"protected",
"int",
"lobHashCode",
"(",
"int",
"seed",
",",
"SymbolTableProvider",
"symbolTableProvider",
")",
"{",
"int",
"result",
"=",
"seed",
";",
"if",
"(",
"!",
"isNullValue",
"(",
")",
")",
"{",
"CRC32",
"crc",
"=",
"new",
"CRC32",
"(",
")",
";",
... | Calculate LOB hash code as XOR of seed with CRC-32 of the LOB data.
This distinguishes BLOBs from CLOBs
@param seed Seed value
@return hash code | [
"Calculate",
"LOB",
"hash",
"code",
"as",
"XOR",
"of",
"seed",
"with",
"CRC",
"-",
"32",
"of",
"the",
"LOB",
"data",
".",
"This",
"distinguishes",
"BLOBs",
"from",
"CLOBs"
] | 4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270 | https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/impl/lite/IonLobLite.java#L55-L66 |
57,615 | amzn/ion-java | src/com/amazon/ion/impl/IonReaderTextRawTokensX.java | IonReaderTextRawTokensX.skipDoubleColon | public final boolean skipDoubleColon() throws IOException
{
int c = skip_over_whitespace();
if (c != ':') {
unread_char(c);
return false;
}
c = read_char();
if (c != ':') {
unread_char(c);
unread_char(':');
return fa... | java | public final boolean skipDoubleColon() throws IOException
{
int c = skip_over_whitespace();
if (c != ':') {
unread_char(c);
return false;
}
c = read_char();
if (c != ':') {
unread_char(c);
unread_char(':');
return fa... | [
"public",
"final",
"boolean",
"skipDoubleColon",
"(",
")",
"throws",
"IOException",
"{",
"int",
"c",
"=",
"skip_over_whitespace",
"(",
")",
";",
"if",
"(",
"c",
"!=",
"'",
"'",
")",
"{",
"unread_char",
"(",
"c",
")",
";",
"return",
"false",
";",
"}",
... | peeks into the input stream to see if the next token
would be a double colon. If indeed this is the case
it skips the two colons and returns true. If not
it unreads the 1 or 2 real characters it read and
return false.
It always consumes any preceding whitespace.
@return true if the next token is a double colon, false... | [
"peeks",
"into",
"the",
"input",
"stream",
"to",
"see",
"if",
"the",
"next",
"token",
"would",
"be",
"a",
"double",
"colon",
".",
"If",
"indeed",
"this",
"is",
"the",
"case",
"it",
"skips",
"the",
"two",
"colons",
"and",
"returns",
"true",
".",
"If",
... | 4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270 | https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/impl/IonReaderTextRawTokensX.java#L336-L350 |
57,616 | amzn/ion-java | src/com/amazon/ion/impl/IonReaderTextRawTokensX.java | IonReaderTextRawTokensX.peekNullTypeSymbol | public final int peekNullTypeSymbol() throws IOException
{
// the '.' has to follow the 'null' immediately
int c = read_char();
if (c != '.') {
unread_char(c);
return IonTokenConstsX.KEYWORD_none;
}
// we have a dot, start reading through the followin... | java | public final int peekNullTypeSymbol() throws IOException
{
// the '.' has to follow the 'null' immediately
int c = read_char();
if (c != '.') {
unread_char(c);
return IonTokenConstsX.KEYWORD_none;
}
// we have a dot, start reading through the followin... | [
"public",
"final",
"int",
"peekNullTypeSymbol",
"(",
")",
"throws",
"IOException",
"{",
"// the '.' has to follow the 'null' immediately",
"int",
"c",
"=",
"read_char",
"(",
")",
";",
"if",
"(",
"c",
"!=",
"'",
"'",
")",
"{",
"unread_char",
"(",
"c",
")",
";... | peeks into the input stream to see if we have an
unquoted symbol that resolves to one of the ion
types. If it does it consumes the input and
returns the type keyword id. If not is unreads
the non-whitespace characters and the dot, which
the input argument 'c' should be. | [
"peeks",
"into",
"the",
"input",
"stream",
"to",
"see",
"if",
"we",
"have",
"an",
"unquoted",
"symbol",
"that",
"resolves",
"to",
"one",
"of",
"the",
"ion",
"types",
".",
"If",
"it",
"does",
"it",
"consumes",
"the",
"input",
"and",
"returns",
"the",
"t... | 4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270 | https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/impl/IonReaderTextRawTokensX.java#L361-L418 |
57,617 | amzn/ion-java | src/com/amazon/ion/impl/IonReaderTextRawTokensX.java | IonReaderTextRawTokensX.peekLobStartPunctuation | public final int peekLobStartPunctuation() throws IOException
{
int c = skip_over_lob_whitespace();
if (c == '"') {
//unread_char(c);
return IonTokenConstsX.TOKEN_STRING_DOUBLE_QUOTE;
}
if (c != '\'') {
unread_char(c);
return IonTokenCo... | java | public final int peekLobStartPunctuation() throws IOException
{
int c = skip_over_lob_whitespace();
if (c == '"') {
//unread_char(c);
return IonTokenConstsX.TOKEN_STRING_DOUBLE_QUOTE;
}
if (c != '\'') {
unread_char(c);
return IonTokenCo... | [
"public",
"final",
"int",
"peekLobStartPunctuation",
"(",
")",
"throws",
"IOException",
"{",
"int",
"c",
"=",
"skip_over_lob_whitespace",
"(",
")",
";",
"if",
"(",
"c",
"==",
"'",
"'",
")",
"{",
"//unread_char(c);",
"return",
"IonTokenConstsX",
".",
"TOKEN_STR... | peeks into the input stream to see what non-whitespace
character is coming up. If it is a double quote or
a triple quote this returns true as either distinguished
the contents of a lob as distinctly a clob. Otherwise
it returns false.
In either case it unreads whatever non-whitespace it read
to decide.
@return true i... | [
"peeks",
"into",
"the",
"input",
"stream",
"to",
"see",
"what",
"non",
"-",
"whitespace",
"character",
"is",
"coming",
"up",
".",
"If",
"it",
"is",
"a",
"double",
"quote",
"or",
"a",
"triple",
"quote",
"this",
"returns",
"true",
"as",
"either",
"distingu... | 4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270 | https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/impl/IonReaderTextRawTokensX.java#L443-L468 |
57,618 | amzn/ion-java | src/com/amazon/ion/impl/IonReaderTextRawTokensX.java | IonReaderTextRawTokensX.skip_clob_close_punctuation | protected final void skip_clob_close_punctuation() throws IOException {
int c = skip_over_clob_whitespace();
if (c == '}') {
c = read_char();
if (c == '}') {
return;
}
unread_char(c);
c = '}';
}
unread_char(c);
... | java | protected final void skip_clob_close_punctuation() throws IOException {
int c = skip_over_clob_whitespace();
if (c == '}') {
c = read_char();
if (c == '}') {
return;
}
unread_char(c);
c = '}';
}
unread_char(c);
... | [
"protected",
"final",
"void",
"skip_clob_close_punctuation",
"(",
")",
"throws",
"IOException",
"{",
"int",
"c",
"=",
"skip_over_clob_whitespace",
"(",
")",
";",
"if",
"(",
"c",
"==",
"'",
"'",
")",
"{",
"c",
"=",
"read_char",
"(",
")",
";",
"if",
"(",
... | Expects optional whitespace then }} | [
"Expects",
"optional",
"whitespace",
"then",
"}}"
] | 4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270 | https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/impl/IonReaderTextRawTokensX.java#L471-L483 |
57,619 | amzn/ion-java | src/com/amazon/ion/impl/IonReaderTextRawTokensX.java | IonReaderTextRawTokensX.skip_whitespace | private final boolean skip_whitespace(CommentStrategy commentStrategy) throws IOException
{
boolean any_whitespace = false;
int c;
loop: for (;;) {
c = read_char();
switch (c) {
case -1:
break loop;
case ' ':
case '... | java | private final boolean skip_whitespace(CommentStrategy commentStrategy) throws IOException
{
boolean any_whitespace = false;
int c;
loop: for (;;) {
c = read_char();
switch (c) {
case -1:
break loop;
case ' ':
case '... | [
"private",
"final",
"boolean",
"skip_whitespace",
"(",
"CommentStrategy",
"commentStrategy",
")",
"throws",
"IOException",
"{",
"boolean",
"any_whitespace",
"=",
"false",
";",
"int",
"c",
";",
"loop",
":",
"for",
"(",
";",
";",
")",
"{",
"c",
"=",
"read_char... | Skips whitespace and applies the given CommentStrategy to any comments
found. Finishes at the starting position of the next token.
@param commentStrategy
@return true if whitespace was skipped and/or comments ignored
@throws IOException | [
"Skips",
"whitespace",
"and",
"applies",
"the",
"given",
"CommentStrategy",
"to",
"any",
"comments",
"found",
".",
"Finishes",
"at",
"the",
"starting",
"position",
"of",
"the",
"next",
"token",
"."
] | 4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270 | https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/impl/IonReaderTextRawTokensX.java#L876-L910 |
57,620 | amzn/ion-java | src/com/amazon/ion/impl/IonReaderTextRawTokensX.java | IonReaderTextRawTokensX.is_2_single_quotes_helper | private final boolean is_2_single_quotes_helper() throws IOException
{
int c = read_char();
if (c != '\'') {
unread_char(c);
return false;
}
c = read_char();
if (c != '\'') {
unread_char(c);
unread_char('\'');
return... | java | private final boolean is_2_single_quotes_helper() throws IOException
{
int c = read_char();
if (c != '\'') {
unread_char(c);
return false;
}
c = read_char();
if (c != '\'') {
unread_char(c);
unread_char('\'');
return... | [
"private",
"final",
"boolean",
"is_2_single_quotes_helper",
"(",
")",
"throws",
"IOException",
"{",
"int",
"c",
"=",
"read_char",
"(",
")",
";",
"if",
"(",
"c",
"!=",
"'",
"'",
")",
"{",
"unread_char",
"(",
"c",
")",
";",
"return",
"false",
";",
"}",
... | this peeks ahead to see if the next two characters
are single quotes. this would finish off a triple
quote when the first quote has been read.
if it succeeds it "consumes" the two quotes
it reads.
if it fails it unreads
@return true if the next two characters are single quotes
@throws IOException | [
"this",
"peeks",
"ahead",
"to",
"see",
"if",
"the",
"next",
"two",
"characters",
"are",
"single",
"quotes",
".",
"this",
"would",
"finish",
"off",
"a",
"triple",
"quote",
"when",
"the",
"first",
"quote",
"has",
"been",
"read",
".",
"if",
"it",
"succeeds"... | 4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270 | https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/impl/IonReaderTextRawTokensX.java#L968-L982 |
57,621 | amzn/ion-java | src/com/amazon/ion/impl/IonReaderTextRawTokensX.java | IonReaderTextRawTokensX.scan_negative_for_numeric_type | private final int scan_negative_for_numeric_type(int c) throws IOException
{
assert(c == '-');
c = read_char();
int t = scan_for_numeric_type(c);
if (t == IonTokenConstsX.TOKEN_TIMESTAMP) {
bad_token(c);
}
unread_char(c); // and the caller need to unread t... | java | private final int scan_negative_for_numeric_type(int c) throws IOException
{
assert(c == '-');
c = read_char();
int t = scan_for_numeric_type(c);
if (t == IonTokenConstsX.TOKEN_TIMESTAMP) {
bad_token(c);
}
unread_char(c); // and the caller need to unread t... | [
"private",
"final",
"int",
"scan_negative_for_numeric_type",
"(",
"int",
"c",
")",
"throws",
"IOException",
"{",
"assert",
"(",
"c",
"==",
"'",
"'",
")",
";",
"c",
"=",
"read_char",
"(",
")",
";",
"int",
"t",
"=",
"scan_for_numeric_type",
"(",
"c",
")",
... | variant of scan_numeric_type where the passed in
start character was preceded by a minus sign.
this will also unread the minus sign.
@param c first char of number read by caller
@return numeric token type
@throws IOException | [
"variant",
"of",
"scan_numeric_type",
"where",
"the",
"passed",
"in",
"start",
"character",
"was",
"preceded",
"by",
"a",
"minus",
"sign",
".",
"this",
"will",
"also",
"unread",
"the",
"minus",
"sign",
"."
] | 4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270 | https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/impl/IonReaderTextRawTokensX.java#L1146-L1156 |
57,622 | amzn/ion-java | src/com/amazon/ion/impl/IonReaderTextRawTokensX.java | IonReaderTextRawTokensX.load_raw_characters | protected void load_raw_characters(StringBuilder sb) throws IOException
{
int c = read_char();
for (;;) {
c = read_char();
switch (c) {
case CharacterSequence.CHAR_SEQ_ESCAPED_NEWLINE_SEQUENCE_1:
case CharacterSequence.CHAR_SEQ_ESCAPED_NEWLINE_SEQUENCE... | java | protected void load_raw_characters(StringBuilder sb) throws IOException
{
int c = read_char();
for (;;) {
c = read_char();
switch (c) {
case CharacterSequence.CHAR_SEQ_ESCAPED_NEWLINE_SEQUENCE_1:
case CharacterSequence.CHAR_SEQ_ESCAPED_NEWLINE_SEQUENCE... | [
"protected",
"void",
"load_raw_characters",
"(",
"StringBuilder",
"sb",
")",
"throws",
"IOException",
"{",
"int",
"c",
"=",
"read_char",
"(",
")",
";",
"for",
"(",
";",
";",
")",
"{",
"c",
"=",
"read_char",
"(",
")",
";",
"switch",
"(",
"c",
")",
"{"... | this is used to load a previously marked set of bytes
into the StringBuilder without escaping. It expects
the caller to have set a save point so that the EOF
will stop us at the right time.
This does handle UTF8 decoding and surrogate encoding
as the bytes are transfered. | [
"this",
"is",
"used",
"to",
"load",
"a",
"previously",
"marked",
"set",
"of",
"bytes",
"into",
"the",
"StringBuilder",
"without",
"escaping",
".",
"It",
"expects",
"the",
"caller",
"to",
"have",
"set",
"a",
"save",
"point",
"so",
"that",
"the",
"EOF",
"w... | 4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270 | https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/impl/IonReaderTextRawTokensX.java#L1171-L1195 |
57,623 | amzn/ion-java | src/com/amazon/ion/impl/IonReaderTextRawTokensX.java | IonReaderTextRawTokensX.skip_timestamp_past_digits | private final int skip_timestamp_past_digits(int min, int max)
throws IOException
{
int c;
// scan the first min characters insuring they're digits
while (min > 0) {
c = read_char();
if (!IonTokenConstsX.isDigit(c)) {
error("invalid character ... | java | private final int skip_timestamp_past_digits(int min, int max)
throws IOException
{
int c;
// scan the first min characters insuring they're digits
while (min > 0) {
c = read_char();
if (!IonTokenConstsX.isDigit(c)) {
error("invalid character ... | [
"private",
"final",
"int",
"skip_timestamp_past_digits",
"(",
"int",
"min",
",",
"int",
"max",
")",
"throws",
"IOException",
"{",
"int",
"c",
";",
"// scan the first min characters insuring they're digits",
"while",
"(",
"min",
">",
"0",
")",
"{",
"c",
"=",
"rea... | Helper method for skipping embedded digits inside a timestamp value
This overload skips at least min and at most max digits, and errors
if a non-digit is encountered in the first min characters read | [
"Helper",
"method",
"for",
"skipping",
"embedded",
"digits",
"inside",
"a",
"timestamp",
"value",
"This",
"overload",
"skips",
"at",
"least",
"min",
"and",
"at",
"most",
"max",
"digits",
"and",
"errors",
"if",
"a",
"non",
"-",
"digit",
"is",
"encountered",
... | 4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270 | https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/impl/IonReaderTextRawTokensX.java#L1504-L1528 |
57,624 | amzn/ion-java | src/com/amazon/ion/impl/IonReaderTextRawTokensX.java | IonReaderTextRawTokensX.load_exponent | private final int load_exponent(StringBuilder sb) throws IOException
{
int c = read_char();
if (c == '-' || c == '+') {
sb.append((char)c);
c = read_char();
}
c = load_digits(sb, c);
if (c == '.') {
sb.append((char)c);
c = read... | java | private final int load_exponent(StringBuilder sb) throws IOException
{
int c = read_char();
if (c == '-' || c == '+') {
sb.append((char)c);
c = read_char();
}
c = load_digits(sb, c);
if (c == '.') {
sb.append((char)c);
c = read... | [
"private",
"final",
"int",
"load_exponent",
"(",
"StringBuilder",
"sb",
")",
"throws",
"IOException",
"{",
"int",
"c",
"=",
"read_char",
"(",
")",
";",
"if",
"(",
"c",
"==",
"'",
"'",
"||",
"c",
"==",
"'",
"'",
")",
"{",
"sb",
".",
"append",
"(",
... | can unread it | [
"can",
"unread",
"it"
] | 4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270 | https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/impl/IonReaderTextRawTokensX.java#L1657-L1672 |
57,625 | amzn/ion-java | src/com/amazon/ion/impl/IonReaderTextRawTokensX.java | IonReaderTextRawTokensX.load_digits | private final int load_digits(StringBuilder sb, int c) throws IOException
{
if (!IonTokenConstsX.isDigit(c))
{
return c;
}
sb.append((char) c);
return readNumeric(sb, Radix.DECIMAL, NumericState.DIGIT);
} | java | private final int load_digits(StringBuilder sb, int c) throws IOException
{
if (!IonTokenConstsX.isDigit(c))
{
return c;
}
sb.append((char) c);
return readNumeric(sb, Radix.DECIMAL, NumericState.DIGIT);
} | [
"private",
"final",
"int",
"load_digits",
"(",
"StringBuilder",
"sb",
",",
"int",
"c",
")",
"throws",
"IOException",
"{",
"if",
"(",
"!",
"IonTokenConstsX",
".",
"isDigit",
"(",
"c",
")",
")",
"{",
"return",
"c",
";",
"}",
"sb",
".",
"append",
"(",
"... | Accumulates digits into the buffer, starting with the given character.
@return the first non-digit character on the input. Could be the given
character if its not a digit.
@see IonTokenConstsX#isDigit(int) | [
"Accumulates",
"digits",
"into",
"the",
"buffer",
"starting",
"with",
"the",
"given",
"character",
"."
] | 4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270 | https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/impl/IonReaderTextRawTokensX.java#L1682-L1691 |
57,626 | amzn/ion-java | src/com/amazon/ion/impl/IonReaderTextRawTokensX.java | IonReaderTextRawTokensX.skip_over_lob | protected void skip_over_lob(int lobToken, SavePoint sp) throws IOException {
switch(lobToken) {
case IonTokenConstsX.TOKEN_STRING_DOUBLE_QUOTE:
skip_double_quoted_string(sp);
skip_clob_close_punctuation();
break;
case IonTokenConstsX.TOKEN_STRING_TRIPLE_QUOTE... | java | protected void skip_over_lob(int lobToken, SavePoint sp) throws IOException {
switch(lobToken) {
case IonTokenConstsX.TOKEN_STRING_DOUBLE_QUOTE:
skip_double_quoted_string(sp);
skip_clob_close_punctuation();
break;
case IonTokenConstsX.TOKEN_STRING_TRIPLE_QUOTE... | [
"protected",
"void",
"skip_over_lob",
"(",
"int",
"lobToken",
",",
"SavePoint",
"sp",
")",
"throws",
"IOException",
"{",
"switch",
"(",
"lobToken",
")",
"{",
"case",
"IonTokenConstsX",
".",
"TOKEN_STRING_DOUBLE_QUOTE",
":",
"skip_double_quoted_string",
"(",
"sp",
... | Skips over the closing }} too. | [
"Skips",
"over",
"the",
"closing",
"}}",
"too",
"."
] | 4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270 | https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/impl/IonReaderTextRawTokensX.java#L2270-L2287 |
57,627 | amzn/ion-java | src/com/amazon/ion/impl/IonWriterSystemBinary.java | IonWriterSystemBinary.writeRaw | public void writeRaw(byte[] value, int start, int len) throws IOException
{
startValue(TID_RAW);
_writer.write(value, start, len);
_patch.patchValue(len);
closeValue();
} | java | public void writeRaw(byte[] value, int start, int len) throws IOException
{
startValue(TID_RAW);
_writer.write(value, start, len);
_patch.patchValue(len);
closeValue();
} | [
"public",
"void",
"writeRaw",
"(",
"byte",
"[",
"]",
"value",
",",
"int",
"start",
",",
"int",
"len",
")",
"throws",
"IOException",
"{",
"startValue",
"(",
"TID_RAW",
")",
";",
"_writer",
".",
"write",
"(",
"value",
",",
"start",
",",
"len",
")",
";"... | just transfer the bytes into the current patch as 'proper' ion binary serialization | [
"just",
"transfer",
"the",
"bytes",
"into",
"the",
"current",
"patch",
"as",
"proper",
"ion",
"binary",
"serialization"
] | 4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270 | https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/impl/IonWriterSystemBinary.java#L808-L814 |
57,628 | amzn/ion-java | src/com/amazon/ion/impl/IonWriterSystemBinary.java | IonWriterSystemBinary.writeBytes | int writeBytes(OutputStream userstream) throws IOException {
if (_patch.getParent() != null) {
throw new IllegalStateException("Tried to flush while not on top-level");
}
try {
BlockedByteInputStream datastream =
new BlockedByteInputStream(_manager.buffer... | java | int writeBytes(OutputStream userstream) throws IOException {
if (_patch.getParent() != null) {
throw new IllegalStateException("Tried to flush while not on top-level");
}
try {
BlockedByteInputStream datastream =
new BlockedByteInputStream(_manager.buffer... | [
"int",
"writeBytes",
"(",
"OutputStream",
"userstream",
")",
"throws",
"IOException",
"{",
"if",
"(",
"_patch",
".",
"getParent",
"(",
")",
"!=",
"null",
")",
"{",
"throw",
"new",
"IllegalStateException",
"(",
"\"Tried to flush while not on top-level\"",
")",
";",... | Writes everything we've got into the output stream, performing all
necessary patches along the way.
This implements {@link com.amazon.ion.IonBinaryWriter#writeBytes(OutputStream)}
via our subclass {@link IonWriterBinaryCompatibility.System}. | [
"Writes",
"everything",
"we",
"ve",
"got",
"into",
"the",
"output",
"stream",
"performing",
"all",
"necessary",
"patches",
"along",
"the",
"way",
"."
] | 4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270 | https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/impl/IonWriterSystemBinary.java#L896-L909 |
57,629 | amzn/ion-java | src/com/amazon/ion/impl/lite/IonLoaderLite.java | IonLoaderLite.load_helper | private IonDatagramLite load_helper(IonReader reader)
throws IOException
{
IonDatagramLite datagram = new IonDatagramLite(_system, _catalog);
IonWriter writer = _Private_IonWriterFactory.makeWriter(datagram);
writer.writeValues(reader);
return datagram;
} | java | private IonDatagramLite load_helper(IonReader reader)
throws IOException
{
IonDatagramLite datagram = new IonDatagramLite(_system, _catalog);
IonWriter writer = _Private_IonWriterFactory.makeWriter(datagram);
writer.writeValues(reader);
return datagram;
} | [
"private",
"IonDatagramLite",
"load_helper",
"(",
"IonReader",
"reader",
")",
"throws",
"IOException",
"{",
"IonDatagramLite",
"datagram",
"=",
"new",
"IonDatagramLite",
"(",
"_system",
",",
"_catalog",
")",
";",
"IonWriter",
"writer",
"=",
"_Private_IonWriterFactory"... | This doesn't wrap IOException because some callers need to propagate it.
@return a new datagram; not null. | [
"This",
"doesn",
"t",
"wrap",
"IOException",
"because",
"some",
"callers",
"need",
"to",
"propagate",
"it",
"."
] | 4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270 | https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/impl/lite/IonLoaderLite.java#L76-L83 |
57,630 | amzn/ion-java | src/com/amazon/ion/impl/LocalSymbolTableAsStruct.java | LocalSymbolTableAsStruct.getIonRepresentation | IonStruct getIonRepresentation()
{
synchronized (this)
{
IonStruct image = myImage;
if (image == null)
{
// Start a new image from scratch
myImage = image = makeIonRepresentation(myImageFactory);
}
return i... | java | IonStruct getIonRepresentation()
{
synchronized (this)
{
IonStruct image = myImage;
if (image == null)
{
// Start a new image from scratch
myImage = image = makeIonRepresentation(myImageFactory);
}
return i... | [
"IonStruct",
"getIonRepresentation",
"(",
")",
"{",
"synchronized",
"(",
"this",
")",
"{",
"IonStruct",
"image",
"=",
"myImage",
";",
"if",
"(",
"image",
"==",
"null",
")",
"{",
"// Start a new image from scratch",
"myImage",
"=",
"image",
"=",
"makeIonRepresent... | Only valid on local symtabs that already have an _image_factory set.
@return Not null. | [
"Only",
"valid",
"on",
"local",
"symtabs",
"that",
"already",
"have",
"an",
"_image_factory",
"set",
"."
] | 4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270 | https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/impl/LocalSymbolTableAsStruct.java#L173-L187 |
57,631 | amzn/ion-java | src/com/amazon/ion/impl/LocalSymbolTableAsStruct.java | LocalSymbolTableAsStruct.makeIonRepresentation | private IonStruct makeIonRepresentation(ValueFactory factory)
{
IonStruct ionRep = factory.newEmptyStruct();
ionRep.addTypeAnnotation(ION_SYMBOL_TABLE);
SymbolTable[] importedTables = getImportedTablesNoCopy();
if (importedTables.length > 1)
{
IonList importsLi... | java | private IonStruct makeIonRepresentation(ValueFactory factory)
{
IonStruct ionRep = factory.newEmptyStruct();
ionRep.addTypeAnnotation(ION_SYMBOL_TABLE);
SymbolTable[] importedTables = getImportedTablesNoCopy();
if (importedTables.length > 1)
{
IonList importsLi... | [
"private",
"IonStruct",
"makeIonRepresentation",
"(",
"ValueFactory",
"factory",
")",
"{",
"IonStruct",
"ionRep",
"=",
"factory",
".",
"newEmptyStruct",
"(",
")",
";",
"ionRep",
".",
"addTypeAnnotation",
"(",
"ION_SYMBOL_TABLE",
")",
";",
"SymbolTable",
"[",
"]",
... | NOT SYNCHRONIZED! Call only from a synch'd method.
@return a new struct, not null. | [
"NOT",
"SYNCHRONIZED!",
"Call",
"only",
"from",
"a",
"synch",
"d",
"method",
"."
] | 4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270 | https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/impl/LocalSymbolTableAsStruct.java#L194-L233 |
57,632 | amzn/ion-java | src/com/amazon/ion/impl/LocalSymbolTableAsStruct.java | LocalSymbolTableAsStruct.recordLocalSymbolInIonRep | private void recordLocalSymbolInIonRep(IonStruct ionRep,
String symbolName,
int sid)
{
assert sid >= myFirstLocalSid;
ValueFactory sys = ionRep.getSystem();
// TODO this is crazy inefficient and not as re... | java | private void recordLocalSymbolInIonRep(IonStruct ionRep,
String symbolName,
int sid)
{
assert sid >= myFirstLocalSid;
ValueFactory sys = ionRep.getSystem();
// TODO this is crazy inefficient and not as re... | [
"private",
"void",
"recordLocalSymbolInIonRep",
"(",
"IonStruct",
"ionRep",
",",
"String",
"symbolName",
",",
"int",
"sid",
")",
"{",
"assert",
"sid",
">=",
"myFirstLocalSid",
";",
"ValueFactory",
"sys",
"=",
"ionRep",
".",
"getSystem",
"(",
")",
";",
"// TODO... | NOT SYNCHRONIZED! Call within constructor or from synched method.
@param symbolName can be null when there's a gap in the local symbols list. | [
"NOT",
"SYNCHRONIZED!",
"Call",
"within",
"constructor",
"or",
"from",
"synched",
"method",
"."
] | 4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270 | https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/impl/LocalSymbolTableAsStruct.java#L239-L264 |
57,633 | amzn/ion-java | src/com/amazon/ion/impl/IonCharacterReader.java | IonCharacterReader.read | @Override
public int read() throws IOException {
int nextChar = super.read();
// process the character
if ( nextChar != -1 ) {
if ( nextChar == '\n' ) {
m_line++;
pushColumn( m_column );
m_column = 0;
}
else... | java | @Override
public int read() throws IOException {
int nextChar = super.read();
// process the character
if ( nextChar != -1 ) {
if ( nextChar == '\n' ) {
m_line++;
pushColumn( m_column );
m_column = 0;
}
else... | [
"@",
"Override",
"public",
"int",
"read",
"(",
")",
"throws",
"IOException",
"{",
"int",
"nextChar",
"=",
"super",
".",
"read",
"(",
")",
";",
"// process the character",
"if",
"(",
"nextChar",
"!=",
"-",
"1",
")",
"{",
"if",
"(",
"nextChar",
"==",
"'"... | Uses the push back implementation but normalizes newlines to "\n". | [
"Uses",
"the",
"push",
"back",
"implementation",
"but",
"normalizes",
"newlines",
"to",
"\\",
"n",
"."
] | 4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270 | https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/impl/IonCharacterReader.java#L132-L165 |
57,634 | amzn/ion-java | src/com/amazon/ion/impl/IonCharacterReader.java | IonCharacterReader.unreadImpl | private void unreadImpl(int c, boolean updateCounts ) throws IOException {
if ( c != -1 ) {
if ( updateCounts ) {
if ( c == '\n' ) {
m_line--;
m_column = popColumn();
} else {
m_column--;
}
... | java | private void unreadImpl(int c, boolean updateCounts ) throws IOException {
if ( c != -1 ) {
if ( updateCounts ) {
if ( c == '\n' ) {
m_line--;
m_column = popColumn();
} else {
m_column--;
}
... | [
"private",
"void",
"unreadImpl",
"(",
"int",
"c",
",",
"boolean",
"updateCounts",
")",
"throws",
"IOException",
"{",
"if",
"(",
"c",
"!=",
"-",
"1",
")",
"{",
"if",
"(",
"updateCounts",
")",
"{",
"if",
"(",
"c",
"==",
"'",
"'",
")",
"{",
"m_line",
... | Performs ths actual unread operation.
@param c the character to unread.
@param updateCounts Whether or not we actually update the line number. | [
"Performs",
"ths",
"actual",
"unread",
"operation",
"."
] | 4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270 | https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/impl/IonCharacterReader.java#L269-L282 |
57,635 | amzn/ion-java | src/com/amazon/ion/impl/IonBinary.java | IonBinary.verifyBinaryVersionMarker | public static void verifyBinaryVersionMarker(Reader reader)
throws IonException
{
try
{
int pos = reader.position();
//reader.sync();
//reader.setPosition(0);
byte[] bvm = new byte[BINARY_VERSION_MARKER_SIZE];
int len = readFully(re... | java | public static void verifyBinaryVersionMarker(Reader reader)
throws IonException
{
try
{
int pos = reader.position();
//reader.sync();
//reader.setPosition(0);
byte[] bvm = new byte[BINARY_VERSION_MARKER_SIZE];
int len = readFully(re... | [
"public",
"static",
"void",
"verifyBinaryVersionMarker",
"(",
"Reader",
"reader",
")",
"throws",
"IonException",
"{",
"try",
"{",
"int",
"pos",
"=",
"reader",
".",
"position",
"(",
")",
";",
"//reader.sync();",
"//reader.setPosition(0);",
"byte",
"[",
"]",
"bvm"... | Verifies that a reader starts with a valid Ion cookie, throwing an
exception if it does not.
@param reader must not be null.
@throws IonException if there's a problem reading the cookie, or if the
data does not start with {@link _Private_IonConstants#BINARY_VERSION_MARKER_1_0}. | [
"Verifies",
"that",
"a",
"reader",
"starts",
"with",
"a",
"valid",
"Ion",
"cookie",
"throwing",
"an",
"exception",
"if",
"it",
"does",
"not",
"."
] | 4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270 | https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/impl/IonBinary.java#L76-L116 |
57,636 | amzn/ion-java | src/com/amazon/ion/impl/IonBinary.java | IonBinary.lenVarUInt | public static int lenVarUInt(long longVal) {
assert longVal >= 0;
if (longVal < (1L << (7 * 1))) return 1; // 7 bits
if (longVal < (1L << (7 * 2))) return 2; // 14 bits
if (longVal < (1L << (7 * 3))) return 3; // 21 bits
if (longVal < (1L << (7 * 4))) return 4; // 28 bits
... | java | public static int lenVarUInt(long longVal) {
assert longVal >= 0;
if (longVal < (1L << (7 * 1))) return 1; // 7 bits
if (longVal < (1L << (7 * 2))) return 2; // 14 bits
if (longVal < (1L << (7 * 3))) return 3; // 21 bits
if (longVal < (1L << (7 * 4))) return 4; // 28 bits
... | [
"public",
"static",
"int",
"lenVarUInt",
"(",
"long",
"longVal",
")",
"{",
"assert",
"longVal",
">=",
"0",
";",
"if",
"(",
"longVal",
"<",
"(",
"1L",
"<<",
"(",
"7",
"*",
"1",
")",
")",
")",
"return",
"1",
";",
"// 7 bits",
"if",
"(",
"longVal",
... | Variable-length, high-bit-terminating integer, 7 data bits per byte. | [
"Variable",
"-",
"length",
"high",
"-",
"bit",
"-",
"terminating",
"integer",
"7",
"data",
"bits",
"per",
"byte",
"."
] | 4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270 | https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/impl/IonBinary.java#L444-L456 |
57,637 | amzn/ion-java | src/com/amazon/ion/impl/IonBinary.java | IonBinary.lenIonTimestamp | public static int lenIonTimestamp(Timestamp di)
{
if (di == null) return 0;
int len = 0;
switch (di.getPrecision()) {
case FRACTION:
case SECOND:
{
BigDecimal fraction = di.getFractionalSecond();
if (fraction != null)
{
... | java | public static int lenIonTimestamp(Timestamp di)
{
if (di == null) return 0;
int len = 0;
switch (di.getPrecision()) {
case FRACTION:
case SECOND:
{
BigDecimal fraction = di.getFractionalSecond();
if (fraction != null)
{
... | [
"public",
"static",
"int",
"lenIonTimestamp",
"(",
"Timestamp",
"di",
")",
"{",
"if",
"(",
"di",
"==",
"null",
")",
"return",
"0",
";",
"int",
"len",
"=",
"0",
";",
"switch",
"(",
"di",
".",
"getPrecision",
"(",
")",
")",
"{",
"case",
"FRACTION",
"... | this method computes the output length of this timestamp value
in the Ion binary format. It does not include the length of
the typedesc byte that preceeds the actual value. The output
length of a null value is 0, as a result this this.
@param di may be null | [
"this",
"method",
"computes",
"the",
"output",
"length",
"of",
"this",
"timestamp",
"value",
"in",
"the",
"Ion",
"binary",
"format",
".",
"It",
"does",
"not",
"include",
"the",
"length",
"of",
"the",
"typedesc",
"byte",
"that",
"preceeds",
"the",
"actual",
... | 4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270 | https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/impl/IonBinary.java#L678-L723 |
57,638 | amzn/ion-java | src/com/amazon/ion/impl/SymbolTableReader.java | SymbolTableReader.stateFirstInStruct | private final int stateFirstInStruct()
{
int new_state;
if (hasName()) {
new_state = S_NAME;
}
else if (hasMaxId()) {
new_state = S_MAX_ID;
}
else if (hasImports()) {
new_state = S_IMPORT_LIST;
}
else if (hasLocalSy... | java | private final int stateFirstInStruct()
{
int new_state;
if (hasName()) {
new_state = S_NAME;
}
else if (hasMaxId()) {
new_state = S_MAX_ID;
}
else if (hasImports()) {
new_state = S_IMPORT_LIST;
}
else if (hasLocalSy... | [
"private",
"final",
"int",
"stateFirstInStruct",
"(",
")",
"{",
"int",
"new_state",
";",
"if",
"(",
"hasName",
"(",
")",
")",
"{",
"new_state",
"=",
"S_NAME",
";",
"}",
"else",
"if",
"(",
"hasMaxId",
"(",
")",
")",
"{",
"new_state",
"=",
"S_MAX_ID",
... | details of the symbol table we're reading. | [
"details",
"of",
"the",
"symbol",
"table",
"we",
"re",
"reading",
"."
] | 4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270 | https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/impl/SymbolTableReader.java#L667-L687 |
57,639 | amzn/ion-java | src/com/amazon/ion/impl/SymbolTableReader.java | SymbolTableReader.next | public IonType next()
{
if (has_next_helper() == false) {
return null;
}
int new_state;
switch (_current_state)
{
case S_BOF:
new_state = S_STRUCT;
break;
case S_STRUCT:
new_state = S_EOF;
break;
... | java | public IonType next()
{
if (has_next_helper() == false) {
return null;
}
int new_state;
switch (_current_state)
{
case S_BOF:
new_state = S_STRUCT;
break;
case S_STRUCT:
new_state = S_EOF;
break;
... | [
"public",
"IonType",
"next",
"(",
")",
"{",
"if",
"(",
"has_next_helper",
"(",
")",
"==",
"false",
")",
"{",
"return",
"null",
";",
"}",
"int",
"new_state",
";",
"switch",
"(",
"_current_state",
")",
"{",
"case",
"S_BOF",
":",
"new_state",
"=",
"S_STRU... | this computes the actual move to the next state
It does take into account the existence or absence
of various properties, such as the symbol table
name which is only present in some symbol tables.
This also fills in a variety of current state
variables that are used to return correct values
by the "get" methods. | [
"this",
"computes",
"the",
"actual",
"move",
"to",
"the",
"next",
"state"
] | 4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270 | https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/impl/SymbolTableReader.java#L761-L904 |
57,640 | amzn/ion-java | src/com/amazon/ion/impl/lite/ReverseBinaryEncoder.java | ReverseBinaryEncoder.growBuffer | private int growBuffer(int offset)
{
assert offset < 0;
byte[] oldBuf = myBuffer;
int oldLen = oldBuf.length;
byte[] newBuf = new byte[(-offset + oldLen) << 1]; // Double the buffer
int oldBegin = newBuf.length - oldLen;
System.arraycopy(oldBuf, 0, newBuf, oldBegin, o... | java | private int growBuffer(int offset)
{
assert offset < 0;
byte[] oldBuf = myBuffer;
int oldLen = oldBuf.length;
byte[] newBuf = new byte[(-offset + oldLen) << 1]; // Double the buffer
int oldBegin = newBuf.length - oldLen;
System.arraycopy(oldBuf, 0, newBuf, oldBegin, o... | [
"private",
"int",
"growBuffer",
"(",
"int",
"offset",
")",
"{",
"assert",
"offset",
"<",
"0",
";",
"byte",
"[",
"]",
"oldBuf",
"=",
"myBuffer",
";",
"int",
"oldLen",
"=",
"oldBuf",
".",
"length",
";",
"byte",
"[",
"]",
"newBuf",
"=",
"new",
"byte",
... | Grows the current buffer and returns the updated offset.
@param offset the original offset
@return the updated offset | [
"Grows",
"the",
"current",
"buffer",
"and",
"returns",
"the",
"updated",
"offset",
"."
] | 4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270 | https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/impl/lite/ReverseBinaryEncoder.java#L283-L294 |
57,641 | amzn/ion-java | src/com/amazon/ion/impl/lite/ReverseBinaryEncoder.java | ReverseBinaryEncoder.writeIonValue | private void writeIonValue(IonValue value)
throws IonException
{
final int valueOffset = myBuffer.length - myOffset;
switch (value.getType())
{
// scalars
case BLOB: writeIonBlobContent((IonBlob) value); break;
case BOOL: writ... | java | private void writeIonValue(IonValue value)
throws IonException
{
final int valueOffset = myBuffer.length - myOffset;
switch (value.getType())
{
// scalars
case BLOB: writeIonBlobContent((IonBlob) value); break;
case BOOL: writ... | [
"private",
"void",
"writeIonValue",
"(",
"IonValue",
"value",
")",
"throws",
"IonException",
"{",
"final",
"int",
"valueOffset",
"=",
"myBuffer",
".",
"length",
"-",
"myOffset",
";",
"switch",
"(",
"value",
".",
"getType",
"(",
")",
")",
"{",
"// scalars",
... | Writes the IonValue and its nested values recursively, including
annotations.
@param value
@throws IonException | [
"Writes",
"the",
"IonValue",
"and",
"its",
"nested",
"values",
"recursively",
"including",
"annotations",
"."
] | 4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270 | https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/impl/lite/ReverseBinaryEncoder.java#L303-L332 |
57,642 | amzn/ion-java | src/com/amazon/ion/impl/lite/ReverseBinaryEncoder.java | ReverseBinaryEncoder.writeSymbolsField | private void writeSymbolsField(SymbolTable symTab)
{
// SymbolTable's APIs doesn't expose an Iterator to traverse declared
// symbol strings in reverse order. As such, we utilize these two
// indexes to traverse the strings in reverse.
int importedMaxId = symTab.getImportedMaxId();
... | java | private void writeSymbolsField(SymbolTable symTab)
{
// SymbolTable's APIs doesn't expose an Iterator to traverse declared
// symbol strings in reverse order. As such, we utilize these two
// indexes to traverse the strings in reverse.
int importedMaxId = symTab.getImportedMaxId();
... | [
"private",
"void",
"writeSymbolsField",
"(",
"SymbolTable",
"symTab",
")",
"{",
"// SymbolTable's APIs doesn't expose an Iterator to traverse declared",
"// symbol strings in reverse order. As such, we utilize these two",
"// indexes to traverse the strings in reverse.",
"int",
"importedMaxI... | Write declared local symbol names if any exists.
@param symTab the local symbol table, not shared, not system | [
"Write",
"declared",
"local",
"symbol",
"names",
"if",
"any",
"exists",
"."
] | 4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270 | https://github.com/amzn/ion-java/blob/4ce1f0f58c6a5a8e42d0425ccdb36e38be3e2270/src/com/amazon/ion/impl/lite/ReverseBinaryEncoder.java#L1437-L1464 |
57,643 | elastic/elasticsearch-metrics-reporter-java | src/main/java/org/elasticsearch/metrics/ElasticsearchReporter.java | ElasticsearchReporter.getPercolationMatches | private List<String> getPercolationMatches(JsonMetric jsonMetric) throws IOException {
HttpURLConnection connection = openConnection("/" + currentIndexName + "/" + jsonMetric.type() + "/_percolate", "POST");
if (connection == null) {
LOGGER.error("Could not connect to any configured elastics... | java | private List<String> getPercolationMatches(JsonMetric jsonMetric) throws IOException {
HttpURLConnection connection = openConnection("/" + currentIndexName + "/" + jsonMetric.type() + "/_percolate", "POST");
if (connection == null) {
LOGGER.error("Could not connect to any configured elastics... | [
"private",
"List",
"<",
"String",
">",
"getPercolationMatches",
"(",
"JsonMetric",
"jsonMetric",
")",
"throws",
"IOException",
"{",
"HttpURLConnection",
"connection",
"=",
"openConnection",
"(",
"\"/\"",
"+",
"currentIndexName",
"+",
"\"/\"",
"+",
"jsonMetric",
".",... | Execute a percolation request for the specified metric | [
"Execute",
"a",
"percolation",
"request",
"for",
"the",
"specified",
"metric"
] | 4018eaef6fc7721312f7440b2bf5a19699a6cb56 | https://github.com/elastic/elasticsearch-metrics-reporter-java/blob/4018eaef6fc7721312f7440b2bf5a19699a6cb56/src/main/java/org/elasticsearch/metrics/ElasticsearchReporter.java#L352-L380 |
57,644 | elastic/elasticsearch-metrics-reporter-java | src/main/java/org/elasticsearch/metrics/ElasticsearchReporter.java | ElasticsearchReporter.addJsonMetricToPercolationIfMatching | private void addJsonMetricToPercolationIfMatching(JsonMetric<? extends Metric> jsonMetric, List<JsonMetric> percolationMetrics) {
if (percolationFilter != null && percolationFilter.matches(jsonMetric.name(), jsonMetric.value())) {
percolationMetrics.add(jsonMetric);
}
} | java | private void addJsonMetricToPercolationIfMatching(JsonMetric<? extends Metric> jsonMetric, List<JsonMetric> percolationMetrics) {
if (percolationFilter != null && percolationFilter.matches(jsonMetric.name(), jsonMetric.value())) {
percolationMetrics.add(jsonMetric);
}
} | [
"private",
"void",
"addJsonMetricToPercolationIfMatching",
"(",
"JsonMetric",
"<",
"?",
"extends",
"Metric",
">",
"jsonMetric",
",",
"List",
"<",
"JsonMetric",
">",
"percolationMetrics",
")",
"{",
"if",
"(",
"percolationFilter",
"!=",
"null",
"&&",
"percolationFilte... | Add metric to list of matched percolation if needed | [
"Add",
"metric",
"to",
"list",
"of",
"matched",
"percolation",
"if",
"needed"
] | 4018eaef6fc7721312f7440b2bf5a19699a6cb56 | https://github.com/elastic/elasticsearch-metrics-reporter-java/blob/4018eaef6fc7721312f7440b2bf5a19699a6cb56/src/main/java/org/elasticsearch/metrics/ElasticsearchReporter.java#L385-L389 |
57,645 | elastic/elasticsearch-metrics-reporter-java | src/main/java/org/elasticsearch/metrics/ElasticsearchReporter.java | ElasticsearchReporter.createNewConnectionIfBulkSizeReached | private HttpURLConnection createNewConnectionIfBulkSizeReached(HttpURLConnection connection, int entriesWritten) throws IOException {
if (entriesWritten % bulkSize == 0) {
closeConnection(connection);
return openConnection("/_bulk", "POST");
}
return connection;
} | java | private HttpURLConnection createNewConnectionIfBulkSizeReached(HttpURLConnection connection, int entriesWritten) throws IOException {
if (entriesWritten % bulkSize == 0) {
closeConnection(connection);
return openConnection("/_bulk", "POST");
}
return connection;
} | [
"private",
"HttpURLConnection",
"createNewConnectionIfBulkSizeReached",
"(",
"HttpURLConnection",
"connection",
",",
"int",
"entriesWritten",
")",
"throws",
"IOException",
"{",
"if",
"(",
"entriesWritten",
"%",
"bulkSize",
"==",
"0",
")",
"{",
"closeConnection",
"(",
... | Create a new connection when the bulk size has hit the limit
Checked on every write of a metric | [
"Create",
"a",
"new",
"connection",
"when",
"the",
"bulk",
"size",
"has",
"hit",
"the",
"limit",
"Checked",
"on",
"every",
"write",
"of",
"a",
"metric"
] | 4018eaef6fc7721312f7440b2bf5a19699a6cb56 | https://github.com/elastic/elasticsearch-metrics-reporter-java/blob/4018eaef6fc7721312f7440b2bf5a19699a6cb56/src/main/java/org/elasticsearch/metrics/ElasticsearchReporter.java#L412-L419 |
57,646 | elastic/elasticsearch-metrics-reporter-java | src/main/java/org/elasticsearch/metrics/ElasticsearchReporter.java | ElasticsearchReporter.writeJsonMetric | private void writeJsonMetric(JsonMetric jsonMetric, ObjectWriter writer, OutputStream out) throws IOException {
writer.writeValue(out, new BulkIndexOperationHeader(currentIndexName, jsonMetric.type()));
out.write("\n".getBytes());
writer.writeValue(out, jsonMetric);
out.write("\n".getByt... | java | private void writeJsonMetric(JsonMetric jsonMetric, ObjectWriter writer, OutputStream out) throws IOException {
writer.writeValue(out, new BulkIndexOperationHeader(currentIndexName, jsonMetric.type()));
out.write("\n".getBytes());
writer.writeValue(out, jsonMetric);
out.write("\n".getByt... | [
"private",
"void",
"writeJsonMetric",
"(",
"JsonMetric",
"jsonMetric",
",",
"ObjectWriter",
"writer",
",",
"OutputStream",
"out",
")",
"throws",
"IOException",
"{",
"writer",
".",
"writeValue",
"(",
"out",
",",
"new",
"BulkIndexOperationHeader",
"(",
"currentIndexNa... | serialize a JSON metric over the outputstream in a bulk request | [
"serialize",
"a",
"JSON",
"metric",
"over",
"the",
"outputstream",
"in",
"a",
"bulk",
"request"
] | 4018eaef6fc7721312f7440b2bf5a19699a6cb56 | https://github.com/elastic/elasticsearch-metrics-reporter-java/blob/4018eaef6fc7721312f7440b2bf5a19699a6cb56/src/main/java/org/elasticsearch/metrics/ElasticsearchReporter.java#L424-L431 |
57,647 | elastic/elasticsearch-metrics-reporter-java | src/main/java/org/elasticsearch/metrics/ElasticsearchReporter.java | ElasticsearchReporter.openConnection | private HttpURLConnection openConnection(String uri, String method) {
for (String host : hosts) {
try {
URL templateUrl = new URL("http://" + host + uri);
HttpURLConnection connection = ( HttpURLConnection ) templateUrl.openConnection();
connection.se... | java | private HttpURLConnection openConnection(String uri, String method) {
for (String host : hosts) {
try {
URL templateUrl = new URL("http://" + host + uri);
HttpURLConnection connection = ( HttpURLConnection ) templateUrl.openConnection();
connection.se... | [
"private",
"HttpURLConnection",
"openConnection",
"(",
"String",
"uri",
",",
"String",
"method",
")",
"{",
"for",
"(",
"String",
"host",
":",
"hosts",
")",
"{",
"try",
"{",
"URL",
"templateUrl",
"=",
"new",
"URL",
"(",
"\"http://\"",
"+",
"host",
"+",
"u... | Open a new HttpUrlConnection, in case it fails it tries for the next host in the configured list | [
"Open",
"a",
"new",
"HttpUrlConnection",
"in",
"case",
"it",
"fails",
"it",
"tries",
"for",
"the",
"next",
"host",
"in",
"the",
"configured",
"list"
] | 4018eaef6fc7721312f7440b2bf5a19699a6cb56 | https://github.com/elastic/elasticsearch-metrics-reporter-java/blob/4018eaef6fc7721312f7440b2bf5a19699a6cb56/src/main/java/org/elasticsearch/metrics/ElasticsearchReporter.java#L436-L456 |
57,648 | elastic/elasticsearch-metrics-reporter-java | src/main/java/org/elasticsearch/metrics/ElasticsearchReporter.java | ElasticsearchReporter.checkForIndexTemplate | private void checkForIndexTemplate() {
try {
HttpURLConnection connection = openConnection( "/_template/metrics_template", "HEAD");
if (connection == null) {
LOGGER.error("Could not connect to any configured elasticsearch instances: {}", Arrays.asList(hosts));
... | java | private void checkForIndexTemplate() {
try {
HttpURLConnection connection = openConnection( "/_template/metrics_template", "HEAD");
if (connection == null) {
LOGGER.error("Could not connect to any configured elasticsearch instances: {}", Arrays.asList(hosts));
... | [
"private",
"void",
"checkForIndexTemplate",
"(",
")",
"{",
"try",
"{",
"HttpURLConnection",
"connection",
"=",
"openConnection",
"(",
"\"/_template/metrics_template\"",
",",
"\"HEAD\"",
")",
";",
"if",
"(",
"connection",
"==",
"null",
")",
"{",
"LOGGER",
".",
"e... | This index template is automatically applied to all indices which start with the index name
The index template simply configures the name not to be analyzed | [
"This",
"index",
"template",
"is",
"automatically",
"applied",
"to",
"all",
"indices",
"which",
"start",
"with",
"the",
"index",
"name",
"The",
"index",
"template",
"simply",
"configures",
"the",
"name",
"not",
"to",
"be",
"analyzed"
] | 4018eaef6fc7721312f7440b2bf5a19699a6cb56 | https://github.com/elastic/elasticsearch-metrics-reporter-java/blob/4018eaef6fc7721312f7440b2bf5a19699a6cb56/src/main/java/org/elasticsearch/metrics/ElasticsearchReporter.java#L462-L512 |
57,649 | cloudant/sync-android | cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/event/EventBus.java | EventBus.post | public void post(Notification event) {
for (Map.Entry<Object, List<SubscriberMethod>> entry : listeners.entrySet()) {
for (SubscriberMethod method : entry.getValue()) {
if (method.eventTypeToInvokeOn.isInstance(event)) {
try {
method.method... | java | public void post(Notification event) {
for (Map.Entry<Object, List<SubscriberMethod>> entry : listeners.entrySet()) {
for (SubscriberMethod method : entry.getValue()) {
if (method.eventTypeToInvokeOn.isInstance(event)) {
try {
method.method... | [
"public",
"void",
"post",
"(",
"Notification",
"event",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"Object",
",",
"List",
"<",
"SubscriberMethod",
">",
">",
"entry",
":",
"listeners",
".",
"entrySet",
"(",
")",
")",
"{",
"for",
"(",
"SubscriberMet... | Post an event to the bus. All subscribers to the event class type posted will be notified.
@param event to post to subscribers | [
"Post",
"an",
"event",
"to",
"the",
"bus",
".",
"All",
"subscribers",
"to",
"the",
"event",
"class",
"type",
"posted",
"will",
"be",
"notified",
"."
] | 5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383 | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/event/EventBus.java#L53-L72 |
57,650 | cloudant/sync-android | cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/callables/PickWinningRevisionCallable.java | PickWinningRevisionCallable.call | @Override
public Void call(SQLDatabase db) throws DocumentStoreException {
/*
Pick winner and mark the appropriate revision with the 'current' flag set
- There can only be one winner in a tree (or set of trees - if there is no common root)
at any one time, so if there is a new... | java | @Override
public Void call(SQLDatabase db) throws DocumentStoreException {
/*
Pick winner and mark the appropriate revision with the 'current' flag set
- There can only be one winner in a tree (or set of trees - if there is no common root)
at any one time, so if there is a new... | [
"@",
"Override",
"public",
"Void",
"call",
"(",
"SQLDatabase",
"db",
")",
"throws",
"DocumentStoreException",
"{",
"/*\n Pick winner and mark the appropriate revision with the 'current' flag set\n - There can only be one winner in a tree (or set of trees - if there is no comm... | Execute the callable, selecting and marking the new winning revision.
@param db the database to execute the callable against
@throws DocumentStoreException | [
"Execute",
"the",
"callable",
"selecting",
"and",
"marking",
"the",
"new",
"winning",
"revision",
"."
] | 5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383 | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/callables/PickWinningRevisionCallable.java#L68-L133 |
57,651 | cloudant/sync-android | cloudant-sync-datastore-android-encryption/src/main/java/com/cloudant/sync/datastore/encryption/DPKEncryptionUtil.java | DPKEncryptionUtil.encryptAES | public static byte[] encryptAES(SecretKey key, byte[] iv, byte[] unencryptedBytes) throws
NoSuchPaddingException, NoSuchAlgorithmException, InvalidAlgorithmParameterException,
InvalidKeyException, BadPaddingException, IllegalBlockSizeException {
Cipher aesCipher = Cipher.getInstance("AES... | java | public static byte[] encryptAES(SecretKey key, byte[] iv, byte[] unencryptedBytes) throws
NoSuchPaddingException, NoSuchAlgorithmException, InvalidAlgorithmParameterException,
InvalidKeyException, BadPaddingException, IllegalBlockSizeException {
Cipher aesCipher = Cipher.getInstance("AES... | [
"public",
"static",
"byte",
"[",
"]",
"encryptAES",
"(",
"SecretKey",
"key",
",",
"byte",
"[",
"]",
"iv",
",",
"byte",
"[",
"]",
"unencryptedBytes",
")",
"throws",
"NoSuchPaddingException",
",",
"NoSuchAlgorithmException",
",",
"InvalidAlgorithmParameterException",
... | AES Encrypt a byte array
@param key The encryption key
@param iv The iv
@param unencryptedBytes The data to encrypt
@return The encrypted data
@throws NoSuchPaddingException
@throws NoSuchAlgorithmException
@throws InvalidAlgorithmParameterException
@throws InvalidKeyException
@throws BadPad... | [
"AES",
"Encrypt",
"a",
"byte",
"array"
] | 5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383 | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-android-encryption/src/main/java/com/cloudant/sync/datastore/encryption/DPKEncryptionUtil.java#L73-L82 |
57,652 | cloudant/sync-android | cloudant-sync-datastore-android-encryption/src/main/java/com/cloudant/sync/datastore/encryption/DPKEncryptionUtil.java | DPKEncryptionUtil.decryptAES | public static byte[] decryptAES(SecretKey key, byte[] iv, byte[] encryptedBytes) throws
NoSuchPaddingException, NoSuchAlgorithmException, InvalidAlgorithmParameterException,
InvalidKeyException, BadPaddingException, IllegalBlockSizeException {
Cipher aesCipher = Cipher.getInstance("AES/C... | java | public static byte[] decryptAES(SecretKey key, byte[] iv, byte[] encryptedBytes) throws
NoSuchPaddingException, NoSuchAlgorithmException, InvalidAlgorithmParameterException,
InvalidKeyException, BadPaddingException, IllegalBlockSizeException {
Cipher aesCipher = Cipher.getInstance("AES/C... | [
"public",
"static",
"byte",
"[",
"]",
"decryptAES",
"(",
"SecretKey",
"key",
",",
"byte",
"[",
"]",
"iv",
",",
"byte",
"[",
"]",
"encryptedBytes",
")",
"throws",
"NoSuchPaddingException",
",",
"NoSuchAlgorithmException",
",",
"InvalidAlgorithmParameterException",
... | Decrypt an AES encrypted byte array
@param key The encryption key
@param iv The iv
@param encryptedBytes The data to decrypt
@return The decrypted data
@throws NoSuchPaddingException
@throws NoSuchAlgorithmException
@throws InvalidAlgorithmParameterException
@throws InvalidKeyException
@throws B... | [
"Decrypt",
"an",
"AES",
"encrypted",
"byte",
"array"
] | 5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383 | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-android-encryption/src/main/java/com/cloudant/sync/datastore/encryption/DPKEncryptionUtil.java#L98-L107 |
57,653 | cloudant/sync-android | cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/android/ContentValues.java | ContentValues.getAsString | public String getAsString(String key) {
Object value = mValues.get(key);
return value != null ? value.toString() : null;
} | java | public String getAsString(String key) {
Object value = mValues.get(key);
return value != null ? value.toString() : null;
} | [
"public",
"String",
"getAsString",
"(",
"String",
"key",
")",
"{",
"Object",
"value",
"=",
"mValues",
".",
"get",
"(",
"key",
")",
";",
"return",
"value",
"!=",
"null",
"?",
"value",
".",
"toString",
"(",
")",
":",
"null",
";",
"}"
] | Gets a value and converts it to a String.
@param key the value to get
@return the String for the value | [
"Gets",
"a",
"value",
"and",
"converts",
"it",
"to",
"a",
"String",
"."
] | 5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383 | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/android/ContentValues.java#L261-L264 |
57,654 | cloudant/sync-android | cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/sqlite/SQLDatabaseQueue.java | SQLDatabaseQueue.getVersion | public int getVersion() throws SQLException {
try {
return this.submit(new VersionCallable()).get();
} catch (InterruptedException e) {
logger.log(Level.SEVERE, "Failed to get database version", e);
throw new SQLException(e);
} catch (ExecutionException e) {
... | java | public int getVersion() throws SQLException {
try {
return this.submit(new VersionCallable()).get();
} catch (InterruptedException e) {
logger.log(Level.SEVERE, "Failed to get database version", e);
throw new SQLException(e);
} catch (ExecutionException e) {
... | [
"public",
"int",
"getVersion",
"(",
")",
"throws",
"SQLException",
"{",
"try",
"{",
"return",
"this",
".",
"submit",
"(",
"new",
"VersionCallable",
"(",
")",
")",
".",
"get",
"(",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"log... | Returns the current version of the database.
@return The current version of the database.
@throws SQLException Throws if there was an error getting the current database version | [
"Returns",
"the",
"current",
"version",
"of",
"the",
"database",
"."
] | 5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383 | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/sqlite/SQLDatabaseQueue.java#L90-L100 |
57,655 | cloudant/sync-android | cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/sqlite/SQLDatabaseQueue.java | SQLDatabaseQueue.submit | public <T> Future<T> submit(SQLCallable<T> callable){
return this.submitTaskToQueue(new SQLQueueCallable<T>(db, callable));
} | java | public <T> Future<T> submit(SQLCallable<T> callable){
return this.submitTaskToQueue(new SQLQueueCallable<T>(db, callable));
} | [
"public",
"<",
"T",
">",
"Future",
"<",
"T",
">",
"submit",
"(",
"SQLCallable",
"<",
"T",
">",
"callable",
")",
"{",
"return",
"this",
".",
"submitTaskToQueue",
"(",
"new",
"SQLQueueCallable",
"<",
"T",
">",
"(",
"db",
",",
"callable",
")",
")",
";",... | Submits a database task for execution
@param callable The task to be performed
@param <T> The type of object that is returned from the task
@throws RejectedExecutionException Thrown when the queue has been shutdown
@return Future representing the task to be executed. | [
"Submits",
"a",
"database",
"task",
"for",
"execution"
] | 5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383 | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/sqlite/SQLDatabaseQueue.java#L109-L111 |
57,656 | cloudant/sync-android | cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/sqlite/SQLDatabaseQueue.java | SQLDatabaseQueue.submitTransaction | public <T> Future<T> submitTransaction(SQLCallable<T> callable){
return this.submitTaskToQueue(new SQLQueueCallable<T>(db, callable, true));
} | java | public <T> Future<T> submitTransaction(SQLCallable<T> callable){
return this.submitTaskToQueue(new SQLQueueCallable<T>(db, callable, true));
} | [
"public",
"<",
"T",
">",
"Future",
"<",
"T",
">",
"submitTransaction",
"(",
"SQLCallable",
"<",
"T",
">",
"callable",
")",
"{",
"return",
"this",
".",
"submitTaskToQueue",
"(",
"new",
"SQLQueueCallable",
"<",
"T",
">",
"(",
"db",
",",
"callable",
",",
... | Submits a database task for execution in a transaction
@param callable The task to be performed
@param <T> The type of object that is returned from the task
@throws RejectedExecutionException thrown when the queue has been shutdown
@return Future representing the task to be executed. | [
"Submits",
"a",
"database",
"task",
"for",
"execution",
"in",
"a",
"transaction"
] | 5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383 | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/sqlite/SQLDatabaseQueue.java#L120-L122 |
57,657 | cloudant/sync-android | cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/sqlite/SQLDatabaseQueue.java | SQLDatabaseQueue.shutdown | public void shutdown() {
// If shutdown has already been called then we don't need to shutdown again
if (acceptTasks.getAndSet(false)) {
//pass straight to queue, tasks passed via submitTaskToQueue will now be blocked.
Future<?> close = queue.submit(new Runnable() {
... | java | public void shutdown() {
// If shutdown has already been called then we don't need to shutdown again
if (acceptTasks.getAndSet(false)) {
//pass straight to queue, tasks passed via submitTaskToQueue will now be blocked.
Future<?> close = queue.submit(new Runnable() {
... | [
"public",
"void",
"shutdown",
"(",
")",
"{",
"// If shutdown has already been called then we don't need to shutdown again",
"if",
"(",
"acceptTasks",
".",
"getAndSet",
"(",
"false",
")",
")",
"{",
"//pass straight to queue, tasks passed via submitTaskToQueue will now be blocked.",
... | Shuts down this database queue and closes
the underlying database connection. Any tasks
previously submitted for execution will still be
executed, however the queue will not accept additional
tasks | [
"Shuts",
"down",
"this",
"database",
"queue",
"and",
"closes",
"the",
"underlying",
"database",
"connection",
".",
"Any",
"tasks",
"previously",
"submitted",
"for",
"execution",
"will",
"still",
"be",
"executed",
"however",
"the",
"queue",
"will",
"not",
"accept... | 5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383 | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/sqlite/SQLDatabaseQueue.java#L131-L153 |
57,658 | cloudant/sync-android | cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/sqlite/SQLDatabaseQueue.java | SQLDatabaseQueue.submitTaskToQueue | private <T> Future<T> submitTaskToQueue(SQLQueueCallable<T> callable){
if(acceptTasks.get()){
return queue.submit(callable);
} else {
throw new RejectedExecutionException("Database is closed");
}
} | java | private <T> Future<T> submitTaskToQueue(SQLQueueCallable<T> callable){
if(acceptTasks.get()){
return queue.submit(callable);
} else {
throw new RejectedExecutionException("Database is closed");
}
} | [
"private",
"<",
"T",
">",
"Future",
"<",
"T",
">",
"submitTaskToQueue",
"(",
"SQLQueueCallable",
"<",
"T",
">",
"callable",
")",
"{",
"if",
"(",
"acceptTasks",
".",
"get",
"(",
")",
")",
"{",
"return",
"queue",
".",
"submit",
"(",
"callable",
")",
";... | Adds a task to the queue, checking if the queue is still open
to accepting tasks
@param callable The task to submit to the queue
@param <T> The type of object that the callable returns
@return Future representing the task to be executed.
@throws RejectedExecutionException If the queue has been shutdown. | [
"Adds",
"a",
"task",
"to",
"the",
"queue",
"checking",
"if",
"the",
"queue",
"is",
"still",
"open",
"to",
"accepting",
"tasks"
] | 5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383 | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/sqlite/SQLDatabaseQueue.java#L171-L177 |
57,659 | cloudant/sync-android | cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/sqlite/SQLDatabaseQueue.java | SQLDatabaseQueue.getSQLiteVersion | public synchronized String getSQLiteVersion() {
if (this.sqliteVersion == null) {
try {
this.sqliteVersion = this.submit(new SQLiteVersionCallable()).get();
return sqliteVersion;
} catch (InterruptedException e) {
logger.log(Level.WARNING,... | java | public synchronized String getSQLiteVersion() {
if (this.sqliteVersion == null) {
try {
this.sqliteVersion = this.submit(new SQLiteVersionCallable()).get();
return sqliteVersion;
} catch (InterruptedException e) {
logger.log(Level.WARNING,... | [
"public",
"synchronized",
"String",
"getSQLiteVersion",
"(",
")",
"{",
"if",
"(",
"this",
".",
"sqliteVersion",
"==",
"null",
")",
"{",
"try",
"{",
"this",
".",
"sqliteVersion",
"=",
"this",
".",
"submit",
"(",
"new",
"SQLiteVersionCallable",
"(",
")",
")"... | Returns the SQLite Version.
@return The SQLite version or "Unknown" if the version could not be determined. | [
"Returns",
"the",
"SQLite",
"Version",
"."
] | 5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383 | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/sqlite/SQLDatabaseQueue.java#L183-L200 |
57,660 | cloudant/sync-android | cloudant-sync-datastore-android-encryption/src/main/java/com/cloudant/sync/datastore/encryption/KeyManager.java | KeyManager.validateEncryptionKeyData | private boolean validateEncryptionKeyData(KeyData data) {
if (data.getIv().length != ENCRYPTIONKEYCHAINMANAGER_AES_IV_SIZE) {
LOGGER.warning("IV does not have the expected size: " +
ENCRYPTIONKEYCHAINMANAGER_AES_IV_SIZE + " bytes");
return false;
}
ret... | java | private boolean validateEncryptionKeyData(KeyData data) {
if (data.getIv().length != ENCRYPTIONKEYCHAINMANAGER_AES_IV_SIZE) {
LOGGER.warning("IV does not have the expected size: " +
ENCRYPTIONKEYCHAINMANAGER_AES_IV_SIZE + " bytes");
return false;
}
ret... | [
"private",
"boolean",
"validateEncryptionKeyData",
"(",
"KeyData",
"data",
")",
"{",
"if",
"(",
"data",
".",
"getIv",
"(",
")",
".",
"length",
"!=",
"ENCRYPTIONKEYCHAINMANAGER_AES_IV_SIZE",
")",
"{",
"LOGGER",
".",
"warning",
"(",
"\"IV does not have the expected si... | PRIVATE HELPER METHODS | [
"PRIVATE",
"HELPER",
"METHODS"
] | 5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383 | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-android-encryption/src/main/java/com/cloudant/sync/datastore/encryption/KeyManager.java#L203-L210 |
57,661 | cloudant/sync-android | cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/query/callables/UpdateIndexCallable.java | UpdateIndexCallable.parametersToIndexRevision | @SuppressWarnings("unchecked")
private List<DBParameter> parametersToIndexRevision(DocumentRevision rev,
String indexName,
List<FieldSort> fieldNames) {
Misc.checkNotNull... | java | @SuppressWarnings("unchecked")
private List<DBParameter> parametersToIndexRevision(DocumentRevision rev,
String indexName,
List<FieldSort> fieldNames) {
Misc.checkNotNull... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"List",
"<",
"DBParameter",
">",
"parametersToIndexRevision",
"(",
"DocumentRevision",
"rev",
",",
"String",
"indexName",
",",
"List",
"<",
"FieldSort",
">",
"fieldNames",
")",
"{",
"Misc",
".",
"che... | Returns a List of DBParameters containing table name and ContentValues to index
a document in an index.
For most revisions, a single entry will be returned. If a field
is an array, however, multiple entries are required. | [
"Returns",
"a",
"List",
"of",
"DBParameters",
"containing",
"table",
"name",
"and",
"ContentValues",
"to",
"index",
"a",
"document",
"in",
"an",
"index",
"."
] | 5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383 | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/query/callables/UpdateIndexCallable.java#L91-L158 |
57,662 | cloudant/sync-android | cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/sqlite/SQLDatabaseFactory.java | SQLDatabaseFactory.internalOpenSQLDatabase | private static SQLDatabase internalOpenSQLDatabase(File dbFile, KeyProvider provider) throws SQLException {
boolean runningOnAndroid = Misc.isRunningOnAndroid();
boolean useSqlCipher = (provider.getEncryptionKey() != null);
try {
if (runningOnAndroid) {
if (useSql... | java | private static SQLDatabase internalOpenSQLDatabase(File dbFile, KeyProvider provider) throws SQLException {
boolean runningOnAndroid = Misc.isRunningOnAndroid();
boolean useSqlCipher = (provider.getEncryptionKey() != null);
try {
if (runningOnAndroid) {
if (useSql... | [
"private",
"static",
"SQLDatabase",
"internalOpenSQLDatabase",
"(",
"File",
"dbFile",
",",
"KeyProvider",
"provider",
")",
"throws",
"SQLException",
"{",
"boolean",
"runningOnAndroid",
"=",
"Misc",
".",
"isRunningOnAndroid",
"(",
")",
";",
"boolean",
"useSqlCipher",
... | Internal method for creating a SQLDatabase that allows a null filename to create an in-memory
database which can be useful for performing checks, but creating in-memory databases is not
permitted from outside of this class hence the private visibility.
@param dbFile full file path of the db file or {@code null} for an... | [
"Internal",
"method",
"for",
"creating",
"a",
"SQLDatabase",
"that",
"allows",
"a",
"null",
"filename",
"to",
"create",
"an",
"in",
"-",
"memory",
"database",
"which",
"can",
"be",
"useful",
"for",
"performing",
"checks",
"but",
"creating",
"in",
"-",
"memor... | 5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383 | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/sqlite/SQLDatabaseFactory.java#L113-L149 |
57,663 | cloudant/sync-android | sample/todo-sync/src/com/cloudant/todo/TasksModel.java | TasksModel.createDocument | public Task createDocument(Task task) {
DocumentRevision rev = new DocumentRevision();
rev.setBody(DocumentBodyFactory.create(task.asMap()));
try {
DocumentRevision created = this.mDocumentStore.database().create(rev);
return Task.fromRevision(created);
} catch (D... | java | public Task createDocument(Task task) {
DocumentRevision rev = new DocumentRevision();
rev.setBody(DocumentBodyFactory.create(task.asMap()));
try {
DocumentRevision created = this.mDocumentStore.database().create(rev);
return Task.fromRevision(created);
} catch (D... | [
"public",
"Task",
"createDocument",
"(",
"Task",
"task",
")",
"{",
"DocumentRevision",
"rev",
"=",
"new",
"DocumentRevision",
"(",
")",
";",
"rev",
".",
"setBody",
"(",
"DocumentBodyFactory",
".",
"create",
"(",
"task",
".",
"asMap",
"(",
")",
")",
")",
... | Creates a task, assigning an ID.
@param task task to create
@return new revision of the document | [
"Creates",
"a",
"task",
"assigning",
"an",
"ID",
"."
] | 5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383 | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/sample/todo-sync/src/com/cloudant/todo/TasksModel.java#L120-L131 |
57,664 | cloudant/sync-android | sample/todo-sync/src/com/cloudant/todo/TasksModel.java | TasksModel.updateDocument | public Task updateDocument(Task task) throws ConflictException, DocumentStoreException {
DocumentRevision rev = task.getDocumentRevision();
rev.setBody(DocumentBodyFactory.create(task.asMap()));
try {
DocumentRevision updated = this.mDocumentStore.database().update(rev);
... | java | public Task updateDocument(Task task) throws ConflictException, DocumentStoreException {
DocumentRevision rev = task.getDocumentRevision();
rev.setBody(DocumentBodyFactory.create(task.asMap()));
try {
DocumentRevision updated = this.mDocumentStore.database().update(rev);
... | [
"public",
"Task",
"updateDocument",
"(",
"Task",
"task",
")",
"throws",
"ConflictException",
",",
"DocumentStoreException",
"{",
"DocumentRevision",
"rev",
"=",
"task",
".",
"getDocumentRevision",
"(",
")",
";",
"rev",
".",
"setBody",
"(",
"DocumentBodyFactory",
"... | Updates a Task document within the DocumentStore.
@param task task to update
@return the updated revision of the Task
@throws ConflictException if the task passed in has a rev which doesn't
match the current rev in the DocumentStore.
@throws DocumentStoreException if there was an error updating the rev for this task | [
"Updates",
"a",
"Task",
"document",
"within",
"the",
"DocumentStore",
"."
] | 5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383 | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/sample/todo-sync/src/com/cloudant/todo/TasksModel.java#L141-L150 |
57,665 | cloudant/sync-android | sample/todo-sync/src/com/cloudant/todo/TasksModel.java | TasksModel.deleteDocument | public void deleteDocument(Task task) throws ConflictException, DocumentNotFoundException, DocumentStoreException {
this.mDocumentStore.database().delete(task.getDocumentRevision());
} | java | public void deleteDocument(Task task) throws ConflictException, DocumentNotFoundException, DocumentStoreException {
this.mDocumentStore.database().delete(task.getDocumentRevision());
} | [
"public",
"void",
"deleteDocument",
"(",
"Task",
"task",
")",
"throws",
"ConflictException",
",",
"DocumentNotFoundException",
",",
"DocumentStoreException",
"{",
"this",
".",
"mDocumentStore",
".",
"database",
"(",
")",
".",
"delete",
"(",
"task",
".",
"getDocume... | Deletes a Task document within the DocumentStore.
@param task task to delete
@throws ConflictException if the task passed in has a rev which doesn't
match the current rev in the DocumentStore.
@throws DocumentNotFoundException if the rev for this task does not exist
@throws DocumentStoreException if there was an error ... | [
"Deletes",
"a",
"Task",
"document",
"within",
"the",
"DocumentStore",
"."
] | 5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383 | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/sample/todo-sync/src/com/cloudant/todo/TasksModel.java#L160-L162 |
57,666 | cloudant/sync-android | cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/query/IndexCreator.java | IndexCreator.validFieldName | protected static boolean validFieldName(String fieldName) {
String[] parts = fieldName.split("\\.");
for (String part: parts) {
if (part.startsWith("$")) {
String msg = String.format("Field names cannot start with a $ in field %s", part);
logger.log(Level.SEVE... | java | protected static boolean validFieldName(String fieldName) {
String[] parts = fieldName.split("\\.");
for (String part: parts) {
if (part.startsWith("$")) {
String msg = String.format("Field names cannot start with a $ in field %s", part);
logger.log(Level.SEVE... | [
"protected",
"static",
"boolean",
"validFieldName",
"(",
"String",
"fieldName",
")",
"{",
"String",
"[",
"]",
"parts",
"=",
"fieldName",
".",
"split",
"(",
"\"\\\\.\"",
")",
";",
"for",
"(",
"String",
"part",
":",
"parts",
")",
"{",
"if",
"(",
"part",
... | Validate the field name string is usable.
The only restriction so far is that the parts don't start with
a $ sign, as this makes the query language ambiguous. | [
"Validate",
"the",
"field",
"name",
"string",
"is",
"usable",
"."
] | 5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383 | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/query/IndexCreator.java#L222-L233 |
57,667 | cloudant/sync-android | cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/query/TokenizerHelper.java | TokenizerHelper.tokenizerToJson | public static String tokenizerToJson(Tokenizer tokenizer) {
Map<String, String> settingsMap = new HashMap<String, String>();
if (tokenizer != null) {
settingsMap.put(TOKENIZE, tokenizer.tokenizerName);
// safe to store args even if they are null
settingsMap.put(TOKENI... | java | public static String tokenizerToJson(Tokenizer tokenizer) {
Map<String, String> settingsMap = new HashMap<String, String>();
if (tokenizer != null) {
settingsMap.put(TOKENIZE, tokenizer.tokenizerName);
// safe to store args even if they are null
settingsMap.put(TOKENI... | [
"public",
"static",
"String",
"tokenizerToJson",
"(",
"Tokenizer",
"tokenizer",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"settingsMap",
"=",
"new",
"HashMap",
"<",
"String",
",",
"String",
">",
"(",
")",
";",
"if",
"(",
"tokenizer",
"!=",
"nul... | Convert Tokenizer into serialized options, or empty map if null
@param tokenizer a {@link Tokenizer} used by a text index, or null
(this will be the case for JSON indexes)
@return a JSON string representing these options | [
"Convert",
"Tokenizer",
"into",
"serialized",
"options",
"or",
"empty",
"map",
"if",
"null"
] | 5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383 | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/query/TokenizerHelper.java#L39-L47 |
57,668 | cloudant/sync-android | cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/query/UnindexedMatcher.java | UnindexedMatcher.matcherWithSelector | public static UnindexedMatcher matcherWithSelector(Map<String, Object> selector) {
ChildrenQueryNode root = buildExecutionTreeForSelector(selector);
if (root == null) {
return null;
}
UnindexedMatcher matcher = new UnindexedMatcher();
matcher.root = root;
r... | java | public static UnindexedMatcher matcherWithSelector(Map<String, Object> selector) {
ChildrenQueryNode root = buildExecutionTreeForSelector(selector);
if (root == null) {
return null;
}
UnindexedMatcher matcher = new UnindexedMatcher();
matcher.root = root;
r... | [
"public",
"static",
"UnindexedMatcher",
"matcherWithSelector",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"selector",
")",
"{",
"ChildrenQueryNode",
"root",
"=",
"buildExecutionTreeForSelector",
"(",
"selector",
")",
";",
"if",
"(",
"root",
"==",
"null",
")"... | Return a new initialised matcher.
Assumes selector is valid as we're calling this late in
the query processing. | [
"Return",
"a",
"new",
"initialised",
"matcher",
"."
] | 5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383 | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/query/UnindexedMatcher.java#L99-L110 |
57,669 | cloudant/sync-android | cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/query/UnindexedMatcher.java | UnindexedMatcher.compareLT | protected static boolean compareLT(Object l, Object r) {
if (l == null || r == null) {
return false; // null fails all lt/gt/lte/gte tests
} else if (!(l instanceof String || l instanceof Number)) {
String msg = String.format("Value in document not a Number or String: %s", l);
... | java | protected static boolean compareLT(Object l, Object r) {
if (l == null || r == null) {
return false; // null fails all lt/gt/lte/gte tests
} else if (!(l instanceof String || l instanceof Number)) {
String msg = String.format("Value in document not a Number or String: %s", l);
... | [
"protected",
"static",
"boolean",
"compareLT",
"(",
"Object",
"l",
",",
"Object",
"r",
")",
"{",
"if",
"(",
"l",
"==",
"null",
"||",
"r",
"==",
"null",
")",
"{",
"return",
"false",
";",
"// null fails all lt/gt/lte/gte tests",
"}",
"else",
"if",
"(",
"!"... | 4. BLOB | [
"4",
".",
"BLOB"
] | 5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383 | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/query/UnindexedMatcher.java#L335-L361 |
57,670 | cloudant/sync-android | cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/query/QueryResult.java | QueryResult.documentIds | public List<String> documentIds() {
List<String> documentIds = new ArrayList<String>();
List<DocumentRevision> docs = CollectionUtils.newArrayList(iterator());
for (DocumentRevision doc : docs) {
documentIds.add(doc.getId());
}
return documentIds;
} | java | public List<String> documentIds() {
List<String> documentIds = new ArrayList<String>();
List<DocumentRevision> docs = CollectionUtils.newArrayList(iterator());
for (DocumentRevision doc : docs) {
documentIds.add(doc.getId());
}
return documentIds;
} | [
"public",
"List",
"<",
"String",
">",
"documentIds",
"(",
")",
"{",
"List",
"<",
"String",
">",
"documentIds",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"List",
"<",
"DocumentRevision",
">",
"docs",
"=",
"CollectionUtils",
".",
"newArra... | Returns a list of the document IDs in this query result.
This method is implemented this way to ensure that the list of document IDs is
consistent with the iterator results.
@return list of the document IDs | [
"Returns",
"a",
"list",
"of",
"the",
"document",
"IDs",
"in",
"this",
"query",
"result",
"."
] | 5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383 | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/query/QueryResult.java#L84-L91 |
57,671 | cloudant/sync-android | cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/DocumentRevsUtils.java | DocumentRevsUtils.createRevisionIdHistory | public static List<String> createRevisionIdHistory(DocumentRevs documentRevs) {
validateDocumentRevs(documentRevs);
String latestRevision = documentRevs.getRev();
int generation = CouchUtils.generationFromRevId(latestRevision);
assert generation == documentRevs.getRevisions().getStart()... | java | public static List<String> createRevisionIdHistory(DocumentRevs documentRevs) {
validateDocumentRevs(documentRevs);
String latestRevision = documentRevs.getRev();
int generation = CouchUtils.generationFromRevId(latestRevision);
assert generation == documentRevs.getRevisions().getStart()... | [
"public",
"static",
"List",
"<",
"String",
">",
"createRevisionIdHistory",
"(",
"DocumentRevs",
"documentRevs",
")",
"{",
"validateDocumentRevs",
"(",
"documentRevs",
")",
";",
"String",
"latestRevision",
"=",
"documentRevs",
".",
"getRev",
"(",
")",
";",
"int",
... | Create the list of the revision IDs in ascending order.
The DocumentRevs is for a single tree. There should be one DocumentRevs for each open revision.
@param documentRevs a deserialised JSON document including the _revisions structure. See
<a target="_blank" href="http://docs.couchdb.org/en/latest/api/document/common... | [
"Create",
"the",
"list",
"of",
"the",
"revision",
"IDs",
"in",
"ascending",
"order",
"."
] | 5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383 | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/DocumentRevsUtils.java#L41-L52 |
57,672 | cloudant/sync-android | cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/DatabaseImpl.java | DatabaseImpl.delete | @Override
public List<DocumentRevision> delete(final String id)
throws DocumentNotFoundException, DocumentStoreException {
Misc.checkNotNull(id, "ID");
try {
if (id.startsWith(CouchConstants._local_prefix)) {
String localId = id.substring(CouchConstants._local... | java | @Override
public List<DocumentRevision> delete(final String id)
throws DocumentNotFoundException, DocumentStoreException {
Misc.checkNotNull(id, "ID");
try {
if (id.startsWith(CouchConstants._local_prefix)) {
String localId = id.substring(CouchConstants._local... | [
"@",
"Override",
"public",
"List",
"<",
"DocumentRevision",
">",
"delete",
"(",
"final",
"String",
"id",
")",
"throws",
"DocumentNotFoundException",
",",
"DocumentStoreException",
"{",
"Misc",
".",
"checkNotNull",
"(",
"id",
",",
"\"ID\"",
")",
";",
"try",
"{"... | delete all leaf nodes | [
"delete",
"all",
"leaf",
"nodes"
] | 5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383 | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/DatabaseImpl.java#L1054-L1075 |
57,673 | cloudant/sync-android | cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/DatabaseImpl.java | DatabaseImpl.get | public static <T> T get(Future<T> future) throws ExecutionException {
try {
return future.get();
} catch (InterruptedException e) {
logger.log(Level.SEVERE, "Re-throwing InterruptedException as ExecutionException");
throw new ExecutionException(e);
}
} | java | public static <T> T get(Future<T> future) throws ExecutionException {
try {
return future.get();
} catch (InterruptedException e) {
logger.log(Level.SEVERE, "Re-throwing InterruptedException as ExecutionException");
throw new ExecutionException(e);
}
} | [
"public",
"static",
"<",
"T",
">",
"T",
"get",
"(",
"Future",
"<",
"T",
">",
"future",
")",
"throws",
"ExecutionException",
"{",
"try",
"{",
"return",
"future",
".",
"get",
"(",
")",
";",
"}",
"catch",
"(",
"InterruptedException",
"e",
")",
"{",
"log... | helper to avoid having to catch ExecutionExceptions | [
"helper",
"to",
"avoid",
"having",
"to",
"catch",
"ExecutionExceptions"
] | 5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383 | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/DatabaseImpl.java#L1082-L1089 |
57,674 | cloudant/sync-android | cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/util/Misc.java | Misc.join | public static String join(String separator, Collection<String> stringsToJoin) {
StringBuilder builder = new StringBuilder();
// Check if there is at least 1 element then use do/while to avoid trailing separator
int index = stringsToJoin.size();
for (String str : stringsToJoin) {
... | java | public static String join(String separator, Collection<String> stringsToJoin) {
StringBuilder builder = new StringBuilder();
// Check if there is at least 1 element then use do/while to avoid trailing separator
int index = stringsToJoin.size();
for (String str : stringsToJoin) {
... | [
"public",
"static",
"String",
"join",
"(",
"String",
"separator",
",",
"Collection",
"<",
"String",
">",
"stringsToJoin",
")",
"{",
"StringBuilder",
"builder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"// Check if there is at least 1 element then use do/while to avoi... | Utility to join strings with a separator. Skips null strings and does not append a trailing
separator.
@param separator the string to use to separate the entries
@param stringsToJoin the strings to join together
@return the joined string | [
"Utility",
"to",
"join",
"strings",
"with",
"a",
"separator",
".",
"Skips",
"null",
"strings",
"and",
"does",
"not",
"append",
"a",
"trailing",
"separator",
"."
] | 5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383 | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/util/Misc.java#L69-L83 |
57,675 | cloudant/sync-android | cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/util/Misc.java | Misc.checkNotNull | public static void checkNotNull(Object param, String errorMessagePrefix) throws
IllegalArgumentException {
checkArgument(param != null, (errorMessagePrefix != null ? errorMessagePrefix :
"Parameter") + " must not be null.");
} | java | public static void checkNotNull(Object param, String errorMessagePrefix) throws
IllegalArgumentException {
checkArgument(param != null, (errorMessagePrefix != null ? errorMessagePrefix :
"Parameter") + " must not be null.");
} | [
"public",
"static",
"void",
"checkNotNull",
"(",
"Object",
"param",
",",
"String",
"errorMessagePrefix",
")",
"throws",
"IllegalArgumentException",
"{",
"checkArgument",
"(",
"param",
"!=",
"null",
",",
"(",
"errorMessagePrefix",
"!=",
"null",
"?",
"errorMessagePref... | Check that a parameter is not null and throw IllegalArgumentException with a message of
errorMessagePrefix + " must not be null." if it is null, defaulting to "Parameter must not be
null.".
@param param the parameter to check
@param errorMessagePrefix the prefix of the error message to use for the
Illegal... | [
"Check",
"that",
"a",
"parameter",
"is",
"not",
"null",
"and",
"throw",
"IllegalArgumentException",
"with",
"a",
"message",
"of",
"errorMessagePrefix",
"+",
"must",
"not",
"be",
"null",
".",
"if",
"it",
"is",
"null",
"defaulting",
"to",
"Parameter",
"must",
... | 5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383 | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/util/Misc.java#L95-L99 |
57,676 | cloudant/sync-android | cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/util/Misc.java | Misc.checkNotNullOrEmpty | public static void checkNotNullOrEmpty(String param, String errorMessagePrefix) throws
IllegalArgumentException {
checkNotNull(param, errorMessagePrefix);
checkArgument(!param.isEmpty(), (errorMessagePrefix != null ?
errorMessagePrefix : "Parameter") + " must not be empty.");... | java | public static void checkNotNullOrEmpty(String param, String errorMessagePrefix) throws
IllegalArgumentException {
checkNotNull(param, errorMessagePrefix);
checkArgument(!param.isEmpty(), (errorMessagePrefix != null ?
errorMessagePrefix : "Parameter") + " must not be empty.");... | [
"public",
"static",
"void",
"checkNotNullOrEmpty",
"(",
"String",
"param",
",",
"String",
"errorMessagePrefix",
")",
"throws",
"IllegalArgumentException",
"{",
"checkNotNull",
"(",
"param",
",",
"errorMessagePrefix",
")",
";",
"checkArgument",
"(",
"!",
"param",
"."... | Check that a string parameter is not null or empty and throw IllegalArgumentException with a
message of errorMessagePrefix + " must not be empty." if it is empty, defaulting to
"Parameter must not be empty".
@param param the string to check
@param errorMessagePrefix the prefix of the error message to use ... | [
"Check",
"that",
"a",
"string",
"parameter",
"is",
"not",
"null",
"or",
"empty",
"and",
"throw",
"IllegalArgumentException",
"with",
"a",
"message",
"of",
"errorMessagePrefix",
"+",
"must",
"not",
"be",
"empty",
".",
"if",
"it",
"is",
"empty",
"defaulting",
... | 5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383 | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/util/Misc.java#L111-L116 |
57,677 | cloudant/sync-android | cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/MultipartAttachmentWriter.java | MultipartAttachmentWriter.setup | private void setup() {
try {
this.partBoundary = ("--" + boundary).getBytes("UTF-8");
this.trailingBoundary = ("--" + boundary + "--").getBytes("UTF-8");
this.contentType = "content-type: application/json".getBytes("UTF-8");
} catch (UnsupportedEncodingException e) {
... | java | private void setup() {
try {
this.partBoundary = ("--" + boundary).getBytes("UTF-8");
this.trailingBoundary = ("--" + boundary + "--").getBytes("UTF-8");
this.contentType = "content-type: application/json".getBytes("UTF-8");
} catch (UnsupportedEncodingException e) {
... | [
"private",
"void",
"setup",
"(",
")",
"{",
"try",
"{",
"this",
".",
"partBoundary",
"=",
"(",
"\"--\"",
"+",
"boundary",
")",
".",
"getBytes",
"(",
"\"UTF-8\"",
")",
";",
"this",
".",
"trailingBoundary",
"=",
"(",
"\"--\"",
"+",
"boundary",
"+",
"\"--\... | common constructor stuff | [
"common",
"constructor",
"stuff"
] | 5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383 | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/MultipartAttachmentWriter.java#L117-L136 |
57,678 | cloudant/sync-android | cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/query/IndexUpdater.java | IndexUpdater.updateAllIndexes | public static void updateAllIndexes(List<Index> indexes,
Database database,
SQLDatabaseQueue queue) throws QueryException {
IndexUpdater updater = new IndexUpdater(database, queue);
updater.updateAllIndexes(indexes);
... | java | public static void updateAllIndexes(List<Index> indexes,
Database database,
SQLDatabaseQueue queue) throws QueryException {
IndexUpdater updater = new IndexUpdater(database, queue);
updater.updateAllIndexes(indexes);
... | [
"public",
"static",
"void",
"updateAllIndexes",
"(",
"List",
"<",
"Index",
">",
"indexes",
",",
"Database",
"database",
",",
"SQLDatabaseQueue",
"queue",
")",
"throws",
"QueryException",
"{",
"IndexUpdater",
"updater",
"=",
"new",
"IndexUpdater",
"(",
"database",
... | Update all indexes in a set.
These indexes are assumed to already exist.
@param indexes Map of indexes and their definitions.
@param database The local {@link Database}
@param queue The executor service queue
@return index update success status (true/false) | [
"Update",
"all",
"indexes",
"in",
"a",
"set",
"."
] | 5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383 | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/query/IndexUpdater.java#L67-L73 |
57,679 | cloudant/sync-android | cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/query/IndexUpdater.java | IndexUpdater.updateIndex | public static void updateIndex(String indexName,
List<FieldSort> fieldNames,
Database database,
SQLDatabaseQueue queue) throws QueryException {
IndexUpdater updater = new IndexUpdater(database, queu... | java | public static void updateIndex(String indexName,
List<FieldSort> fieldNames,
Database database,
SQLDatabaseQueue queue) throws QueryException {
IndexUpdater updater = new IndexUpdater(database, queu... | [
"public",
"static",
"void",
"updateIndex",
"(",
"String",
"indexName",
",",
"List",
"<",
"FieldSort",
">",
"fieldNames",
",",
"Database",
"database",
",",
"SQLDatabaseQueue",
"queue",
")",
"throws",
"QueryException",
"{",
"IndexUpdater",
"updater",
"=",
"new",
"... | Update a single index.
This index is assumed to already exist.
@param indexName Name of index to update
@param fieldNames List of field names in the sort format
@param database The local {@link Database}
@param queue The executor service queue
@return index update success status (true/false) | [
"Update",
"a",
"single",
"index",
"."
] | 5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383 | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/query/IndexUpdater.java#L86-L93 |
57,680 | cloudant/sync-android | cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/mazha/DocumentRevs.java | DocumentRevs.setOthers | @JsonAnySetter
public void setOthers(String name, Object value) {
if(name.startsWith("_")) {
// Just be defensive
throw new RuntimeException("This is a reserved field, and should not be treated as document content.");
}
this.others.put(name, value);
} | java | @JsonAnySetter
public void setOthers(String name, Object value) {
if(name.startsWith("_")) {
// Just be defensive
throw new RuntimeException("This is a reserved field, and should not be treated as document content.");
}
this.others.put(name, value);
} | [
"@",
"JsonAnySetter",
"public",
"void",
"setOthers",
"(",
"String",
"name",
",",
"Object",
"value",
")",
"{",
"if",
"(",
"name",
".",
"startsWith",
"(",
"\"_\"",
")",
")",
"{",
"// Just be defensive",
"throw",
"new",
"RuntimeException",
"(",
"\"This is a reser... | Jackson will automatically put any field it can not find match to this @JsonAnySetter bucket. This is
effectively all the document content. | [
"Jackson",
"will",
"automatically",
"put",
"any",
"field",
"it",
"can",
"not",
"find",
"match",
"to",
"this"
] | 5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383 | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/mazha/DocumentRevs.java#L79-L86 |
57,681 | cloudant/sync-android | cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/query/QueryValidator.java | QueryValidator.normaliseAndValidateQuery | @SuppressWarnings("unchecked")
public static Map<String, Object> normaliseAndValidateQuery(Map<String, Object> query) throws QueryException{
boolean isWildCard = false;
if (query.isEmpty()) {
isWildCard = true;
}
// First expand the query to include a leading compound pr... | java | @SuppressWarnings("unchecked")
public static Map<String, Object> normaliseAndValidateQuery(Map<String, Object> query) throws QueryException{
boolean isWildCard = false;
if (query.isEmpty()) {
isWildCard = true;
}
// First expand the query to include a leading compound pr... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"static",
"Map",
"<",
"String",
",",
"Object",
">",
"normaliseAndValidateQuery",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"query",
")",
"throws",
"QueryException",
"{",
"boolean",
"isWildCard",
... | Expand implicit operators in a query, and validate | [
"Expand",
"implicit",
"operators",
"in",
"a",
"query",
"and",
"validate"
] | 5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383 | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/query/QueryValidator.java#L54-L111 |
57,682 | cloudant/sync-android | cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/query/QueryValidator.java | QueryValidator.validateSelector | @SuppressWarnings("unchecked")
private static void validateSelector(Map<String, Object> selector) throws QueryException {
String topLevelOp = (String) selector.keySet().toArray()[0];
// top level op can only be $and or $or after normalisation
if (topLevelOp.equals(AND) || topLevelOp.equals(... | java | @SuppressWarnings("unchecked")
private static void validateSelector(Map<String, Object> selector) throws QueryException {
String topLevelOp = (String) selector.keySet().toArray()[0];
// top level op can only be $and or $or after normalisation
if (topLevelOp.equals(AND) || topLevelOp.equals(... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"static",
"void",
"validateSelector",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"selector",
")",
"throws",
"QueryException",
"{",
"String",
"topLevelOp",
"=",
"(",
"String",
")",
"selector",
"... | we are going to need to walk the query tree to validate it before executing it | [
"we",
"are",
"going",
"to",
"need",
"to",
"walk",
"the",
"query",
"tree",
"to",
"validate",
"it",
"before",
"executing",
"it"
] | 5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383 | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/query/QueryValidator.java#L414-L427 |
57,683 | cloudant/sync-android | cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/query/QueryValidator.java | QueryValidator.validateCompoundOperatorClauses | @SuppressWarnings("unchecked")
private static void validateCompoundOperatorClauses(List<Object> clauses,
Boolean[] textClauseLimitReached) throws QueryException {
for (Object obj : clauses) {
if (!(obj instanceof Map)) {
... | java | @SuppressWarnings("unchecked")
private static void validateCompoundOperatorClauses(List<Object> clauses,
Boolean[] textClauseLimitReached) throws QueryException {
for (Object obj : clauses) {
if (!(obj instanceof Map)) {
... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"private",
"static",
"void",
"validateCompoundOperatorClauses",
"(",
"List",
"<",
"Object",
">",
"clauses",
",",
"Boolean",
"[",
"]",
"textClauseLimitReached",
")",
"throws",
"QueryException",
"{",
"for",
"(",
"O... | This method runs the list of clauses making up the selector through a series of
validation steps and returns whether the clause list is valid or not.
@param clauses A list of clauses making up a query selector
@param textClauseLimitReached A flag used to track the text clause limit
throughout the validation process. ... | [
"This",
"method",
"runs",
"the",
"list",
"of",
"clauses",
"making",
"up",
"the",
"selector",
"through",
"a",
"series",
"of",
"validation",
"steps",
"and",
"returns",
"whether",
"the",
"clause",
"list",
"is",
"valid",
"or",
"not",
"."
] | 5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383 | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/query/QueryValidator.java#L439-L479 |
57,684 | cloudant/sync-android | cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/AttachmentStreamFactory.java | AttachmentStreamFactory.getInputStream | public InputStream getInputStream(File file, Attachment.Encoding encoding) throws IOException {
// First, open a stream to the raw bytes on disk.
// Then, if we have a key assume the file is encrypted, so add a stream
// to the chain which decrypts the data as we read from disk.
// Fina... | java | public InputStream getInputStream(File file, Attachment.Encoding encoding) throws IOException {
// First, open a stream to the raw bytes on disk.
// Then, if we have a key assume the file is encrypted, so add a stream
// to the chain which decrypts the data as we read from disk.
// Fina... | [
"public",
"InputStream",
"getInputStream",
"(",
"File",
"file",
",",
"Attachment",
".",
"Encoding",
"encoding",
")",
"throws",
"IOException",
"{",
"// First, open a stream to the raw bytes on disk.",
"// Then, if we have a key assume the file is encrypted, so add a stream",
"// to ... | Return a stream to be used to read from the file on disk.
Stream's bytes will be unzipped, unencrypted attachment content.
@param file File object to read from.
@param encoding Encoding of attachment.
@return Stream for reading attachment data.
@throws IOException if there's a problem reading from disk, including iss... | [
"Return",
"a",
"stream",
"to",
"be",
"used",
"to",
"read",
"from",
"the",
"file",
"on",
"disk",
"."
] | 5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383 | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/AttachmentStreamFactory.java#L81-L113 |
57,685 | cloudant/sync-android | cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/AttachmentStreamFactory.java | AttachmentStreamFactory.getOutputStream | public OutputStream getOutputStream(File file, Attachment.Encoding encoding) throws
IOException {
// First, open a stream to the raw bytes on disk.
// Then, if we have a key assume the file should be encrypted before writing,
// so wrap the file stream in a stream which encrypts dur... | java | public OutputStream getOutputStream(File file, Attachment.Encoding encoding) throws
IOException {
// First, open a stream to the raw bytes on disk.
// Then, if we have a key assume the file should be encrypted before writing,
// so wrap the file stream in a stream which encrypts dur... | [
"public",
"OutputStream",
"getOutputStream",
"(",
"File",
"file",
",",
"Attachment",
".",
"Encoding",
"encoding",
")",
"throws",
"IOException",
"{",
"// First, open a stream to the raw bytes on disk.",
"// Then, if we have a key assume the file should be encrypted before writing,",
... | Get stream for writing attachment data to disk.
Opens the output stream using {@link FileUtils#openOutputStream(File)}.
Data should be written to the stream unencoded, unencrypted.
@param file File to write to.
@param encoding Encoding to use.
@return Stream for writing.
@throws IOException if there's a problem writ... | [
"Get",
"stream",
"for",
"writing",
"attachment",
"data",
"to",
"disk",
"."
] | 5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383 | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/AttachmentStreamFactory.java#L129-L176 |
57,686 | cloudant/sync-android | cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/common/ValueListMap.java | ValueListMap.addValueToKey | public void addValueToKey(K key, V value) {
this.addValuesToKey(key, Collections.singletonList(value));
} | java | public void addValueToKey(K key, V value) {
this.addValuesToKey(key, Collections.singletonList(value));
} | [
"public",
"void",
"addValueToKey",
"(",
"K",
"key",
",",
"V",
"value",
")",
"{",
"this",
".",
"addValuesToKey",
"(",
"key",
",",
"Collections",
".",
"singletonList",
"(",
"value",
")",
")",
";",
"}"
] | Add a value to the map under the existing key or creating a new key if it does not
yet exist.
@param key the key to associate the values with
@param value the value to add to the key | [
"Add",
"a",
"value",
"to",
"the",
"map",
"under",
"the",
"existing",
"key",
"or",
"creating",
"a",
"new",
"key",
"if",
"it",
"does",
"not",
"yet",
"exist",
"."
] | 5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383 | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/common/ValueListMap.java#L55-L57 |
57,687 | cloudant/sync-android | cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/common/ValueListMap.java | ValueListMap.addValuesToKey | public void addValuesToKey(K key, Collection<V> valueCollection) {
if (!valueCollection.isEmpty()) {
// Create a new collection to store the values (will be changed to internal type by call
// to putIfAbsent anyway)
List<V> collectionToAppendValuesOn = new ArrayList<V>();
... | java | public void addValuesToKey(K key, Collection<V> valueCollection) {
if (!valueCollection.isEmpty()) {
// Create a new collection to store the values (will be changed to internal type by call
// to putIfAbsent anyway)
List<V> collectionToAppendValuesOn = new ArrayList<V>();
... | [
"public",
"void",
"addValuesToKey",
"(",
"K",
"key",
",",
"Collection",
"<",
"V",
">",
"valueCollection",
")",
"{",
"if",
"(",
"!",
"valueCollection",
".",
"isEmpty",
"(",
")",
")",
"{",
"// Create a new collection to store the values (will be changed to internal type... | Add a collection of one or more values to the map under the existing key or creating a new key
if it does not yet exist in the map.
@param key the key to associate the values with
@param valueCollection a collection of values to add to the key | [
"Add",
"a",
"collection",
"of",
"one",
"or",
"more",
"values",
"to",
"the",
"map",
"under",
"the",
"existing",
"key",
"or",
"creating",
"a",
"new",
"key",
"if",
"it",
"does",
"not",
"yet",
"exist",
"in",
"the",
"map",
"."
] | 5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383 | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/common/ValueListMap.java#L66-L78 |
57,688 | cloudant/sync-android | cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/mazha/CouchURIHelper.java | CouchURIHelper.queryAsString | private String queryAsString(Map<String, Object> query) {
ArrayList<String> queryParts = new ArrayList<String>(query.size());
for(Map.Entry<String, Object> entry : query.entrySet()) {
String value = this.encodeQueryParameter(entry.getValue().toString());
String key = this.encodeQ... | java | private String queryAsString(Map<String, Object> query) {
ArrayList<String> queryParts = new ArrayList<String>(query.size());
for(Map.Entry<String, Object> entry : query.entrySet()) {
String value = this.encodeQueryParameter(entry.getValue().toString());
String key = this.encodeQ... | [
"private",
"String",
"queryAsString",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"query",
")",
"{",
"ArrayList",
"<",
"String",
">",
"queryParts",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
"query",
".",
"size",
"(",
")",
")",
";",
"for",
... | Joins the entries in a map into a URL-encoded query string.
@param query map containing query params
@return joined, URL-encoded query params | [
"Joins",
"the",
"entries",
"in",
"a",
"map",
"into",
"a",
"URL",
"-",
"encoded",
"query",
"string",
"."
] | 5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383 | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/mazha/CouchURIHelper.java#L165-L174 |
57,689 | cloudant/sync-android | sample/todo-sync/src/com/cloudant/todo/TodoActivity.java | TodoActivity.replicationComplete | void replicationComplete() {
reloadTasksFromModel();
Toast.makeText(getApplicationContext(),
R.string.replication_completed,
Toast.LENGTH_LONG).show();
dismissDialog(DIALOG_PROGRESS);
} | java | void replicationComplete() {
reloadTasksFromModel();
Toast.makeText(getApplicationContext(),
R.string.replication_completed,
Toast.LENGTH_LONG).show();
dismissDialog(DIALOG_PROGRESS);
} | [
"void",
"replicationComplete",
"(",
")",
"{",
"reloadTasksFromModel",
"(",
")",
";",
"Toast",
".",
"makeText",
"(",
"getApplicationContext",
"(",
")",
",",
"R",
".",
"string",
".",
"replication_completed",
",",
"Toast",
".",
"LENGTH_LONG",
")",
".",
"show",
... | Called by TasksModel when it receives a replication complete callback.
TasksModel takes care of calling this on the main thread. | [
"Called",
"by",
"TasksModel",
"when",
"it",
"receives",
"a",
"replication",
"complete",
"callback",
".",
"TasksModel",
"takes",
"care",
"of",
"calling",
"this",
"on",
"the",
"main",
"thread",
"."
] | 5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383 | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/sample/todo-sync/src/com/cloudant/todo/TodoActivity.java#L178-L184 |
57,690 | cloudant/sync-android | sample/todo-sync/src/com/cloudant/todo/TodoActivity.java | TodoActivity.replicationError | void replicationError() {
Log.i(LOG_TAG, "error()");
reloadTasksFromModel();
Toast.makeText(getApplicationContext(),
R.string.replication_error,
Toast.LENGTH_LONG).show();
dismissDialog(DIALOG_PROGRESS);
} | java | void replicationError() {
Log.i(LOG_TAG, "error()");
reloadTasksFromModel();
Toast.makeText(getApplicationContext(),
R.string.replication_error,
Toast.LENGTH_LONG).show();
dismissDialog(DIALOG_PROGRESS);
} | [
"void",
"replicationError",
"(",
")",
"{",
"Log",
".",
"i",
"(",
"LOG_TAG",
",",
"\"error()\"",
")",
";",
"reloadTasksFromModel",
"(",
")",
";",
"Toast",
".",
"makeText",
"(",
"getApplicationContext",
"(",
")",
",",
"R",
".",
"string",
".",
"replication_er... | Called by TasksModel when it receives a replication error callback.
TasksModel takes care of calling this on the main thread. | [
"Called",
"by",
"TasksModel",
"when",
"it",
"receives",
"a",
"replication",
"error",
"callback",
".",
"TasksModel",
"takes",
"care",
"of",
"calling",
"this",
"on",
"the",
"main",
"thread",
"."
] | 5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383 | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/sample/todo-sync/src/com/cloudant/todo/TodoActivity.java#L190-L197 |
57,691 | cloudant/sync-android | cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/AttachmentManager.java | AttachmentManager.prepareAttachment | protected static PreparedAttachment prepareAttachment(String attachmentsDir,
AttachmentStreamFactory attachmentStreamFactory, Attachment attachment, long length, long encodedLength) throws AttachmentException {
PreparedAttachment pa = new PreparedAttachm... | java | protected static PreparedAttachment prepareAttachment(String attachmentsDir,
AttachmentStreamFactory attachmentStreamFactory, Attachment attachment, long length, long encodedLength) throws AttachmentException {
PreparedAttachment pa = new PreparedAttachm... | [
"protected",
"static",
"PreparedAttachment",
"prepareAttachment",
"(",
"String",
"attachmentsDir",
",",
"AttachmentStreamFactory",
"attachmentStreamFactory",
",",
"Attachment",
"attachment",
",",
"long",
"length",
",",
"long",
"encodedLength",
")",
"throws",
"AttachmentExce... | prepare an attachment and check validity of length and encodedLength metadata | [
"prepare",
"an",
"attachment",
"and",
"check",
"validity",
"of",
"length",
"and",
"encodedLength",
"metadata"
] | 5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383 | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/AttachmentManager.java#L212-L228 |
57,692 | cloudant/sync-android | cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/AttachmentManager.java | AttachmentManager.findExistingAttachments | public static Map<String, SavedAttachment> findExistingAttachments(
Map<String, ? extends Attachment> attachments) {
Map<String, SavedAttachment> existingAttachments = new HashMap<String, SavedAttachment>();
for (Map.Entry<String, ? extends Attachment> a : attachments.entrySet()) {
... | java | public static Map<String, SavedAttachment> findExistingAttachments(
Map<String, ? extends Attachment> attachments) {
Map<String, SavedAttachment> existingAttachments = new HashMap<String, SavedAttachment>();
for (Map.Entry<String, ? extends Attachment> a : attachments.entrySet()) {
... | [
"public",
"static",
"Map",
"<",
"String",
",",
"SavedAttachment",
">",
"findExistingAttachments",
"(",
"Map",
"<",
"String",
",",
"?",
"extends",
"Attachment",
">",
"attachments",
")",
"{",
"Map",
"<",
"String",
",",
"SavedAttachment",
">",
"existingAttachments"... | Return a map of the existing attachments in the map passed in.
@param attachments Attachments to search.
@return Map of attachments which already exist in the attachment store, or an empty map if none. | [
"Return",
"a",
"map",
"of",
"the",
"existing",
"attachments",
"in",
"the",
"map",
"passed",
"in",
"."
] | 5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383 | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/AttachmentManager.java#L236-L245 |
57,693 | cloudant/sync-android | cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/AttachmentManager.java | AttachmentManager.findNewAttachments | public static Map<String, Attachment> findNewAttachments(Map<String, ? extends Attachment> attachments) {
Map<String, Attachment> newAttachments = new HashMap<String, Attachment>();
for (Map.Entry<String, ? extends Attachment> a : attachments.entrySet()) {
if (!(a instanceof SavedAttachment)... | java | public static Map<String, Attachment> findNewAttachments(Map<String, ? extends Attachment> attachments) {
Map<String, Attachment> newAttachments = new HashMap<String, Attachment>();
for (Map.Entry<String, ? extends Attachment> a : attachments.entrySet()) {
if (!(a instanceof SavedAttachment)... | [
"public",
"static",
"Map",
"<",
"String",
",",
"Attachment",
">",
"findNewAttachments",
"(",
"Map",
"<",
"String",
",",
"?",
"extends",
"Attachment",
">",
"attachments",
")",
"{",
"Map",
"<",
"String",
",",
"Attachment",
">",
"newAttachments",
"=",
"new",
... | Return a map of the new attachments in the map passed in.
@param attachments Attachments to search.
@return Map of attachments which need adding to the attachment store, or an empty map if none. | [
"Return",
"a",
"map",
"of",
"the",
"new",
"attachments",
"in",
"the",
"map",
"passed",
"in",
"."
] | 5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383 | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/AttachmentManager.java#L253-L261 |
57,694 | cloudant/sync-android | cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/AttachmentManager.java | AttachmentManager.copyAttachment | public static void copyAttachment(SQLDatabase db, long parentSequence, long newSequence,
String filename) throws SQLException {
Cursor c = null;
try{
c = db.rawQuery(SQL_ATTACHMENTS_SELECT,
new String[]{filename, String.valueOf(par... | java | public static void copyAttachment(SQLDatabase db, long parentSequence, long newSequence,
String filename) throws SQLException {
Cursor c = null;
try{
c = db.rawQuery(SQL_ATTACHMENTS_SELECT,
new String[]{filename, String.valueOf(par... | [
"public",
"static",
"void",
"copyAttachment",
"(",
"SQLDatabase",
"db",
",",
"long",
"parentSequence",
",",
"long",
"newSequence",
",",
"String",
"filename",
")",
"throws",
"SQLException",
"{",
"Cursor",
"c",
"=",
"null",
";",
"try",
"{",
"c",
"=",
"db",
"... | Copy a single attachment for a given revision to a new revision.
@param db database to use
@param parentSequence identifies sequence number of revision to copy attachment data from
@param newSequence identifies sequence number of revision to copy attachment data to
@param filename filename of attachment to copy | [
"Copy",
"a",
"single",
"attachment",
"for",
"a",
"given",
"revision",
"to",
"a",
"new",
"revision",
"."
] | 5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383 | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/AttachmentManager.java#L398-L408 |
57,695 | cloudant/sync-android | cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/AttachmentManager.java | AttachmentManager.purgeAttachments | public static void purgeAttachments(SQLDatabase db, String attachmentsDir) {
// it's easier to deal with Strings since java doesn't know how to compare byte[]s
Set<String> currentKeys = new HashSet<String>();
Cursor c = null;
try {
// delete attachment table entries for revs ... | java | public static void purgeAttachments(SQLDatabase db, String attachmentsDir) {
// it's easier to deal with Strings since java doesn't know how to compare byte[]s
Set<String> currentKeys = new HashSet<String>();
Cursor c = null;
try {
// delete attachment table entries for revs ... | [
"public",
"static",
"void",
"purgeAttachments",
"(",
"SQLDatabase",
"db",
",",
"String",
"attachmentsDir",
")",
"{",
"// it's easier to deal with Strings since java doesn't know how to compare byte[]s",
"Set",
"<",
"String",
">",
"currentKeys",
"=",
"new",
"HashSet",
"<",
... | Called by DatabaseImpl on the execution queue, this needs to have the db passed to it.
@param db database to purge attachments from | [
"Called",
"by",
"DatabaseImpl",
"on",
"the",
"execution",
"queue",
"this",
"needs",
"to",
"have",
"the",
"db",
"passed",
"to",
"it",
"."
] | 5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383 | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/AttachmentManager.java#L414-L471 |
57,696 | cloudant/sync-android | cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/AttachmentManager.java | AttachmentManager.generateFilenameForKey | static String generateFilenameForKey(SQLDatabase db, String keyString)
throws NameGenerationException {
String filename = null;
long result = -1; // -1 is error for insert call
int tries = 0;
while (result == -1 && tries < 200) {
byte[] randomBytes = new byte[2... | java | static String generateFilenameForKey(SQLDatabase db, String keyString)
throws NameGenerationException {
String filename = null;
long result = -1; // -1 is error for insert call
int tries = 0;
while (result == -1 && tries < 200) {
byte[] randomBytes = new byte[2... | [
"static",
"String",
"generateFilenameForKey",
"(",
"SQLDatabase",
"db",
",",
"String",
"keyString",
")",
"throws",
"NameGenerationException",
"{",
"String",
"filename",
"=",
"null",
";",
"long",
"result",
"=",
"-",
"1",
";",
"// -1 is error for insert call",
"int",
... | Iterate candidate filenames generated from the filenameRandom generator
until we find one which doesn't already exist.
We try inserting the new record into attachments_key_filename to find a
unique filename rather than checking on disk filenames. This is because we
can make use of the fact that this method is called o... | [
"Iterate",
"candidate",
"filenames",
"generated",
"from",
"the",
"filenameRandom",
"generator",
"until",
"we",
"find",
"one",
"which",
"doesn",
"t",
"already",
"exist",
"."
] | 5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383 | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/documentstore/AttachmentManager.java#L552-L582 |
57,697 | cloudant/sync-android | cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/sqlite/sqlite4java/Tuple.java | Tuple.put | public void put(int index, long value) {
if(desc.get(index) != Cursor.FIELD_TYPE_INTEGER) {
throw new IllegalArgumentException("Inserting an integer, but expecting " + getTypeName(desc.get(index)));
}
this.values.add(index, value);
} | java | public void put(int index, long value) {
if(desc.get(index) != Cursor.FIELD_TYPE_INTEGER) {
throw new IllegalArgumentException("Inserting an integer, but expecting " + getTypeName(desc.get(index)));
}
this.values.add(index, value);
} | [
"public",
"void",
"put",
"(",
"int",
"index",
",",
"long",
"value",
")",
"{",
"if",
"(",
"desc",
".",
"get",
"(",
"index",
")",
"!=",
"Cursor",
".",
"FIELD_TYPE_INTEGER",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Inserting an integer, but... | Internally we always store the SQLite number as long | [
"Internally",
"we",
"always",
"store",
"the",
"SQLite",
"number",
"as",
"long"
] | 5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383 | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/internal/sqlite/sqlite4java/Tuple.java#L65-L70 |
57,698 | cloudant/sync-android | cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/replication/ReplicatorBuilder.java | ReplicatorBuilder.addAuthInterceptorIfRequired | private URI addAuthInterceptorIfRequired(URI uri) {
String uriProtocol = uri.getScheme();
String uriHost = uri.getHost();
String uriPath = uri.getRawPath();
int uriPort = getDefaultPort(uri);
setUserInfo(uri);
setAuthInterceptor(uriHost, uriPath, uriProtocol, uriPort);
... | java | private URI addAuthInterceptorIfRequired(URI uri) {
String uriProtocol = uri.getScheme();
String uriHost = uri.getHost();
String uriPath = uri.getRawPath();
int uriPort = getDefaultPort(uri);
setUserInfo(uri);
setAuthInterceptor(uriHost, uriPath, uriProtocol, uriPort);
... | [
"private",
"URI",
"addAuthInterceptorIfRequired",
"(",
"URI",
"uri",
")",
"{",
"String",
"uriProtocol",
"=",
"uri",
".",
"getScheme",
"(",
")",
";",
"String",
"uriHost",
"=",
"uri",
".",
"getHost",
"(",
")",
";",
"String",
"uriPath",
"=",
"uri",
".",
"ge... | - else add cookie interceptor if needed | [
"-",
"else",
"add",
"cookie",
"interceptor",
"if",
"needed"
] | 5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383 | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/replication/ReplicatorBuilder.java#L157-L167 |
57,699 | cloudant/sync-android | cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/replication/ReplicatorBuilder.java | ReplicatorBuilder.username | public E username(String username) {
Misc.checkNotNull(username, "username");
this.username = username;
//noinspection unchecked
return (E) this;
} | java | public E username(String username) {
Misc.checkNotNull(username, "username");
this.username = username;
//noinspection unchecked
return (E) this;
} | [
"public",
"E",
"username",
"(",
"String",
"username",
")",
"{",
"Misc",
".",
"checkNotNull",
"(",
"username",
",",
"\"username\"",
")",
";",
"this",
".",
"username",
"=",
"username",
";",
"//noinspection unchecked",
"return",
"(",
"E",
")",
"this",
";",
"}... | Sets the username to use when authenticating with the server.
Setting the username and password (using the {@link ReplicatorBuilder#password(String)})
method
takes precedence over credentials passed via the URI.
@param username The username to use when authenticating.
@return The current instance of {@link Replicator... | [
"Sets",
"the",
"username",
"to",
"use",
"when",
"authenticating",
"with",
"the",
"server",
"."
] | 5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383 | https://github.com/cloudant/sync-android/blob/5f1416ed1bd9ab05d7a4b8736480c8ae68bd7383/cloudant-sync-datastore-core/src/main/java/com/cloudant/sync/replication/ReplicatorBuilder.java#L495-L500 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.