repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
devnied/Bit-lib4j | src/main/java/fr/devnied/bitlib/BitUtils.java | BitUtils.setNextValue | protected void setNextValue(final long pValue, final int pLength, final int pMaxSize) {
long value = pValue;
// Set to max value if pValue cannot be stored on pLength bits.
long bitMax = (long) Math.pow(2, Math.min(pLength, pMaxSize));
if (pValue > bitMax) {
value = bitMax - 1;
}
// size to wrote
... | java | protected void setNextValue(final long pValue, final int pLength, final int pMaxSize) {
long value = pValue;
// Set to max value if pValue cannot be stored on pLength bits.
long bitMax = (long) Math.pow(2, Math.min(pLength, pMaxSize));
if (pValue > bitMax) {
value = bitMax - 1;
}
// size to wrote
... | [
"protected",
"void",
"setNextValue",
"(",
"final",
"long",
"pValue",
",",
"final",
"int",
"pLength",
",",
"final",
"int",
"pMaxSize",
")",
"{",
"long",
"value",
"=",
"pValue",
";",
"// Set to max value if pValue cannot be stored on pLength bits.\r",
"long",
"bitMax",
... | Add Value to the current position with the specified size
@param pValue
value to add
@param pLength
length of the value
@param pMaxSize
max size in bits | [
"Add",
"Value",
"to",
"the",
"current",
"position",
"with",
"the",
"specified",
"size"
] | bdfa79fd12e7e3d5cf1196291825ef1bb12a1ee0 | https://github.com/devnied/Bit-lib4j/blob/bdfa79fd12e7e3d5cf1196291825ef1bb12a1ee0/src/main/java/fr/devnied/bitlib/BitUtils.java#L590-L616 | train |
devnied/Bit-lib4j | src/main/java/fr/devnied/bitlib/BitUtils.java | BitUtils.setNextInteger | public void setNextInteger(final int pValue, final int pLength) {
if (pLength > Integer.SIZE) {
throw new IllegalArgumentException("Integer overflow with length > 32");
}
setNextValue(pValue, pLength, Integer.SIZE - 1);
} | java | public void setNextInteger(final int pValue, final int pLength) {
if (pLength > Integer.SIZE) {
throw new IllegalArgumentException("Integer overflow with length > 32");
}
setNextValue(pValue, pLength, Integer.SIZE - 1);
} | [
"public",
"void",
"setNextInteger",
"(",
"final",
"int",
"pValue",
",",
"final",
"int",
"pLength",
")",
"{",
"if",
"(",
"pLength",
">",
"Integer",
".",
"SIZE",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Integer overflow with length > 32\"",
")... | Add Integer to the current position with the specified size
Be careful with java integer bit sign
@param pValue
the value to set
@param pLength
the length of the integer | [
"Add",
"Integer",
"to",
"the",
"current",
"position",
"with",
"the",
"specified",
"size"
] | bdfa79fd12e7e3d5cf1196291825ef1bb12a1ee0 | https://github.com/devnied/Bit-lib4j/blob/bdfa79fd12e7e3d5cf1196291825ef1bb12a1ee0/src/main/java/fr/devnied/bitlib/BitUtils.java#L629-L636 | train |
devnied/Bit-lib4j | src/main/java/fr/devnied/bitlib/BitUtils.java | BitUtils.setNextString | public void setNextString(final String pValue, final int pLength, final boolean pPaddedBefore) {
setNextByte(pValue.getBytes(Charset.defaultCharset()), pLength, pPaddedBefore);
} | java | public void setNextString(final String pValue, final int pLength, final boolean pPaddedBefore) {
setNextByte(pValue.getBytes(Charset.defaultCharset()), pLength, pPaddedBefore);
} | [
"public",
"void",
"setNextString",
"(",
"final",
"String",
"pValue",
",",
"final",
"int",
"pLength",
",",
"final",
"boolean",
"pPaddedBefore",
")",
"{",
"setNextByte",
"(",
"pValue",
".",
"getBytes",
"(",
"Charset",
".",
"defaultCharset",
"(",
")",
")",
",",... | Method to write a String
@param pValue
the string to write
@param pLength
the string length
@param pPaddedBefore
indicate if the string is padded before or after | [
"Method",
"to",
"write",
"a",
"String"
] | bdfa79fd12e7e3d5cf1196291825ef1bb12a1ee0 | https://github.com/devnied/Bit-lib4j/blob/bdfa79fd12e7e3d5cf1196291825ef1bb12a1ee0/src/main/java/fr/devnied/bitlib/BitUtils.java#L661-L663 | train |
killme2008/gecko | src/main/java/com/taobao/gecko/core/core/impl/FutureLockImpl.java | FutureLockImpl.setResult | public void setResult(R result) {
try {
lock.lock();
this.result = result;
notifyHaveResult();
}
finally {
lock.unlock();
}
} | java | public void setResult(R result) {
try {
lock.lock();
this.result = result;
notifyHaveResult();
}
finally {
lock.unlock();
}
} | [
"public",
"void",
"setResult",
"(",
"R",
"result",
")",
"{",
"try",
"{",
"lock",
".",
"lock",
"(",
")",
";",
"this",
".",
"result",
"=",
"result",
";",
"notifyHaveResult",
"(",
")",
";",
"}",
"finally",
"{",
"lock",
".",
"unlock",
"(",
")",
";",
... | Set the result value and notify about operation completion.
@param result
the result value | [
"Set",
"the",
"result",
"value",
"and",
"notify",
"about",
"operation",
"completion",
"."
] | 0873b690ffde51e40e6eadfcd5d599eb4e3b642d | https://github.com/killme2008/gecko/blob/0873b690ffde51e40e6eadfcd5d599eb4e3b642d/src/main/java/com/taobao/gecko/core/core/impl/FutureLockImpl.java#L121-L130 | train |
killme2008/gecko | src/main/java/com/taobao/gecko/core/core/impl/FutureLockImpl.java | FutureLockImpl.failure | public void failure(Throwable failure) {
try {
lock.lock();
this.failure = failure;
notifyHaveResult();
}
finally {
lock.unlock();
}
} | java | public void failure(Throwable failure) {
try {
lock.lock();
this.failure = failure;
notifyHaveResult();
}
finally {
lock.unlock();
}
} | [
"public",
"void",
"failure",
"(",
"Throwable",
"failure",
")",
"{",
"try",
"{",
"lock",
".",
"lock",
"(",
")",
";",
"this",
".",
"failure",
"=",
"failure",
";",
"notifyHaveResult",
"(",
")",
";",
"}",
"finally",
"{",
"lock",
".",
"unlock",
"(",
")",
... | Notify about the failure, occured during asynchronous operation
execution.
@param failure | [
"Notify",
"about",
"the",
"failure",
"occured",
"during",
"asynchronous",
"operation",
"execution",
"."
] | 0873b690ffde51e40e6eadfcd5d599eb4e3b642d | https://github.com/killme2008/gecko/blob/0873b690ffde51e40e6eadfcd5d599eb4e3b642d/src/main/java/com/taobao/gecko/core/core/impl/FutureLockImpl.java#L233-L242 | train |
killme2008/gecko | src/main/java/com/taobao/gecko/core/util/LinkedTransferQueue.java | LinkedTransferQueue.clean | void clean(QNode pred, QNode s) {
Thread w = s.waiter;
if (w != null) { // Wake up thread
s.waiter = null;
if (w != Thread.currentThread()) {
LockSupport.unpark(w);
}
}
/*
* At any given time, exactly one node on li... | java | void clean(QNode pred, QNode s) {
Thread w = s.waiter;
if (w != null) { // Wake up thread
s.waiter = null;
if (w != Thread.currentThread()) {
LockSupport.unpark(w);
}
}
/*
* At any given time, exactly one node on li... | [
"void",
"clean",
"(",
"QNode",
"pred",
",",
"QNode",
"s",
")",
"{",
"Thread",
"w",
"=",
"s",
".",
"waiter",
";",
"if",
"(",
"w",
"!=",
"null",
")",
"{",
"// Wake up thread",
"s",
".",
"waiter",
"=",
"null",
";",
"if",
"(",
"w",
"!=",
"Thread",
... | Gets rid of cancelled node s with original predecessor pred.
@param pred predecessor of cancelled node
@param s the cancelled node | [
"Gets",
"rid",
"of",
"cancelled",
"node",
"s",
"with",
"original",
"predecessor",
"pred",
"."
] | 0873b690ffde51e40e6eadfcd5d599eb4e3b642d | https://github.com/killme2008/gecko/blob/0873b690ffde51e40e6eadfcd5d599eb4e3b642d/src/main/java/com/taobao/gecko/core/util/LinkedTransferQueue.java#L433-L463 | train |
killme2008/gecko | src/main/java/com/taobao/gecko/core/util/LinkedTransferQueue.java | LinkedTransferQueue.reclean | private QNode reclean() {
/*
* cleanMe is, or at one time was, predecessor of cancelled
* node s that was the tail so could not be unspliced. If s
* is no longer the tail, try to unsplice if necessary and
* make cleanMe slot available. This differs from similar
* c... | java | private QNode reclean() {
/*
* cleanMe is, or at one time was, predecessor of cancelled
* node s that was the tail so could not be unspliced. If s
* is no longer the tail, try to unsplice if necessary and
* make cleanMe slot available. This differs from similar
* c... | [
"private",
"QNode",
"reclean",
"(",
")",
"{",
"/*\n * cleanMe is, or at one time was, predecessor of cancelled\n * node s that was the tail so could not be unspliced. If s\n * is no longer the tail, try to unsplice if necessary and\n * make cleanMe slot available. This ... | Tries to unsplice the cancelled node held in cleanMe that was
previously uncleanable because it was at tail.
@return current cleanMe node (or null) | [
"Tries",
"to",
"unsplice",
"the",
"cancelled",
"node",
"held",
"in",
"cleanMe",
"that",
"was",
"previously",
"uncleanable",
"because",
"it",
"was",
"at",
"tail",
"."
] | 0873b690ffde51e40e6eadfcd5d599eb4e3b642d | https://github.com/killme2008/gecko/blob/0873b690ffde51e40e6eadfcd5d599eb4e3b642d/src/main/java/com/taobao/gecko/core/util/LinkedTransferQueue.java#L470-L497 | train |
linkedin/PalDB | paldb/src/main/java/com/linkedin/paldb/impl/StorageCache.java | StorageCache.initCache | static StorageCache initCache(Configuration configuration) {
if (configuration.getBoolean(Configuration.CACHE_ENABLED) && configuration.getLong(Configuration.CACHE_BYTES) > 0) {
return new StorageCache(configuration);
} else {
return new DisabledCache();
}
} | java | static StorageCache initCache(Configuration configuration) {
if (configuration.getBoolean(Configuration.CACHE_ENABLED) && configuration.getLong(Configuration.CACHE_BYTES) > 0) {
return new StorageCache(configuration);
} else {
return new DisabledCache();
}
} | [
"static",
"StorageCache",
"initCache",
"(",
"Configuration",
"configuration",
")",
"{",
"if",
"(",
"configuration",
".",
"getBoolean",
"(",
"Configuration",
".",
"CACHE_ENABLED",
")",
"&&",
"configuration",
".",
"getLong",
"(",
"Configuration",
".",
"CACHE_BYTES",
... | Factory to create and initialize the cache.
@param configuration configuration
@return new cache | [
"Factory",
"to",
"create",
"and",
"initialize",
"the",
"cache",
"."
] | d05ccdd3f67855eb2675dbd82599f19aa7a9f650 | https://github.com/linkedin/PalDB/blob/d05ccdd3f67855eb2675dbd82599f19aa7a9f650/paldb/src/main/java/com/linkedin/paldb/impl/StorageCache.java#L52-L58 | train |
linkedin/PalDB | paldb/src/main/java/com/linkedin/paldb/impl/Serializers.java | Serializers.registerSerializer | public synchronized void registerSerializer(Serializer serializer) {
Class objClass = getSerializerType(serializer);
if (!serializers.containsKey(objClass)) {
int index = COUNTER.getAndIncrement();
serializers.put(objClass, new SerializerWrapper(index, serializer));
if (serializersArray.length... | java | public synchronized void registerSerializer(Serializer serializer) {
Class objClass = getSerializerType(serializer);
if (!serializers.containsKey(objClass)) {
int index = COUNTER.getAndIncrement();
serializers.put(objClass, new SerializerWrapper(index, serializer));
if (serializersArray.length... | [
"public",
"synchronized",
"void",
"registerSerializer",
"(",
"Serializer",
"serializer",
")",
"{",
"Class",
"objClass",
"=",
"getSerializerType",
"(",
"serializer",
")",
";",
"if",
"(",
"!",
"serializers",
".",
"containsKey",
"(",
"objClass",
")",
")",
"{",
"i... | Registers the serializer.
@param serializer serializer | [
"Registers",
"the",
"serializer",
"."
] | d05ccdd3f67855eb2675dbd82599f19aa7a9f650 | https://github.com/linkedin/PalDB/blob/d05ccdd3f67855eb2675dbd82599f19aa7a9f650/paldb/src/main/java/com/linkedin/paldb/impl/Serializers.java#L62-L76 | train |
linkedin/PalDB | paldb/src/main/java/com/linkedin/paldb/impl/Serializers.java | Serializers.serialize | static void serialize(DataOutput out, Serializers serializers)
throws IOException {
StringBuilder msg = new StringBuilder(String.format("Serialize %d serializer classes:", serializers.serializers.values().size()));
int size = serializers.serializers.values().size();
out.writeInt(size);
if (size >... | java | static void serialize(DataOutput out, Serializers serializers)
throws IOException {
StringBuilder msg = new StringBuilder(String.format("Serialize %d serializer classes:", serializers.serializers.values().size()));
int size = serializers.serializers.values().size();
out.writeInt(size);
if (size >... | [
"static",
"void",
"serialize",
"(",
"DataOutput",
"out",
",",
"Serializers",
"serializers",
")",
"throws",
"IOException",
"{",
"StringBuilder",
"msg",
"=",
"new",
"StringBuilder",
"(",
"String",
".",
"format",
"(",
"\"Serialize %d serializer classes:\"",
",",
"seria... | Serializes this class into a data output.
@param out data output
@param serializers serializers instance
@throws IOException if an io error occurs | [
"Serializes",
"this",
"class",
"into",
"a",
"data",
"output",
"."
] | d05ccdd3f67855eb2675dbd82599f19aa7a9f650 | https://github.com/linkedin/PalDB/blob/d05ccdd3f67855eb2675dbd82599f19aa7a9f650/paldb/src/main/java/com/linkedin/paldb/impl/Serializers.java#L110-L128 | train |
linkedin/PalDB | paldb/src/main/java/com/linkedin/paldb/impl/Serializers.java | Serializers.readObject | private void readObject(ObjectInputStream in)
throws IOException, ClassNotFoundException {
// Init
COUNTER = new AtomicInteger();
serializers = new HashMap<Class, SerializerWrapper>();
serializersArray = new Serializer[0];
deserialize(in, this);
} | java | private void readObject(ObjectInputStream in)
throws IOException, ClassNotFoundException {
// Init
COUNTER = new AtomicInteger();
serializers = new HashMap<Class, SerializerWrapper>();
serializersArray = new Serializer[0];
deserialize(in, this);
} | [
"private",
"void",
"readObject",
"(",
"ObjectInputStream",
"in",
")",
"throws",
"IOException",
",",
"ClassNotFoundException",
"{",
"// Init",
"COUNTER",
"=",
"new",
"AtomicInteger",
"(",
")",
";",
"serializers",
"=",
"new",
"HashMap",
"<",
"Class",
",",
"Seriali... | Deserializes this instance from an input stream.
@param in data input
@throws IOException if an io error occurs
@throws ClassNotFoundException if a class error occurs | [
"Deserializes",
"this",
"instance",
"from",
"an",
"input",
"stream",
"."
] | d05ccdd3f67855eb2675dbd82599f19aa7a9f650 | https://github.com/linkedin/PalDB/blob/d05ccdd3f67855eb2675dbd82599f19aa7a9f650/paldb/src/main/java/com/linkedin/paldb/impl/Serializers.java#L137-L145 | train |
linkedin/PalDB | paldb/src/main/java/com/linkedin/paldb/impl/Serializers.java | Serializers.deserialize | static void deserialize(DataInput in, Serializers serializers)
throws IOException, ClassNotFoundException {
int size = in.readInt();
if (size > 0) {
StringBuilder msg = new StringBuilder(String.format("Deserialize %d serializer classes:", size));
if (serializers.serializersArray.length < size... | java | static void deserialize(DataInput in, Serializers serializers)
throws IOException, ClassNotFoundException {
int size = in.readInt();
if (size > 0) {
StringBuilder msg = new StringBuilder(String.format("Deserialize %d serializer classes:", size));
if (serializers.serializersArray.length < size... | [
"static",
"void",
"deserialize",
"(",
"DataInput",
"in",
",",
"Serializers",
"serializers",
")",
"throws",
"IOException",
",",
"ClassNotFoundException",
"{",
"int",
"size",
"=",
"in",
".",
"readInt",
"(",
")",
";",
"if",
"(",
"size",
">",
"0",
")",
"{",
... | Deserializes this class from a data input.
@param in data input
@param serializers serializers instance
@throws IOException if an io error occurs
@throws ClassNotFoundException if a class error occurs | [
"Deserializes",
"this",
"class",
"from",
"a",
"data",
"input",
"."
] | d05ccdd3f67855eb2675dbd82599f19aa7a9f650 | https://github.com/linkedin/PalDB/blob/d05ccdd3f67855eb2675dbd82599f19aa7a9f650/paldb/src/main/java/com/linkedin/paldb/impl/Serializers.java#L155-L186 | train |
linkedin/PalDB | paldb/src/main/java/com/linkedin/paldb/impl/Serializers.java | Serializers.getSerializer | Serializer getSerializer(int index) {
if (index >= serializersArray.length) {
throw new IllegalArgumentException(String.format("The serializer can't be found at index %d", index));
}
return serializersArray[index];
} | java | Serializer getSerializer(int index) {
if (index >= serializersArray.length) {
throw new IllegalArgumentException(String.format("The serializer can't be found at index %d", index));
}
return serializersArray[index];
} | [
"Serializer",
"getSerializer",
"(",
"int",
"index",
")",
"{",
"if",
"(",
"index",
">=",
"serializersArray",
".",
"length",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"String",
".",
"format",
"(",
"\"The serializer can't be found at index %d\"",
",",
... | Returns the serializer given the index.
@param index serializer index
@return serializer | [
"Returns",
"the",
"serializer",
"given",
"the",
"index",
"."
] | d05ccdd3f67855eb2675dbd82599f19aa7a9f650 | https://github.com/linkedin/PalDB/blob/d05ccdd3f67855eb2675dbd82599f19aa7a9f650/paldb/src/main/java/com/linkedin/paldb/impl/Serializers.java#L237-L242 | train |
linkedin/PalDB | paldb/src/main/java/com/linkedin/paldb/impl/Serializers.java | Serializers.getSerializerType | private static Class<?> getSerializerType(Object instance) {
Type type = instance.getClass().getGenericInterfaces()[0];
if (type instanceof ParameterizedType) {
Class<?> cls = null;
Type clsType = ((ParameterizedType) type).getActualTypeArguments()[0];
if (clsType instanceof GenericArrayType)... | java | private static Class<?> getSerializerType(Object instance) {
Type type = instance.getClass().getGenericInterfaces()[0];
if (type instanceof ParameterizedType) {
Class<?> cls = null;
Type clsType = ((ParameterizedType) type).getActualTypeArguments()[0];
if (clsType instanceof GenericArrayType)... | [
"private",
"static",
"Class",
"<",
"?",
">",
"getSerializerType",
"(",
"Object",
"instance",
")",
"{",
"Type",
"type",
"=",
"instance",
".",
"getClass",
"(",
")",
".",
"getGenericInterfaces",
"(",
")",
"[",
"0",
"]",
";",
"if",
"(",
"type",
"instanceof",... | Returns the serializer's generic type.
@param instance serializer instance
@return the class the serializer can serialize | [
"Returns",
"the",
"serializer",
"s",
"generic",
"type",
"."
] | d05ccdd3f67855eb2675dbd82599f19aa7a9f650 | https://github.com/linkedin/PalDB/blob/d05ccdd3f67855eb2675dbd82599f19aa7a9f650/paldb/src/main/java/com/linkedin/paldb/impl/Serializers.java#L269-L290 | train |
linkedin/PalDB | paldb/src/main/java/com/linkedin/paldb/impl/StorageReader.java | StorageReader.get | public byte[] get(byte[] key)
throws IOException {
int keyLength = key.length;
if (keyLength >= slots.length || keyCounts[keyLength] == 0) {
return null;
}
long hash = (long) hashUtils.hash(key);
int numSlots = slots[keyLength];
int slotSize = slotSizes[keyLength];
int indexOffse... | java | public byte[] get(byte[] key)
throws IOException {
int keyLength = key.length;
if (keyLength >= slots.length || keyCounts[keyLength] == 0) {
return null;
}
long hash = (long) hashUtils.hash(key);
int numSlots = slots[keyLength];
int slotSize = slotSizes[keyLength];
int indexOffse... | [
"public",
"byte",
"[",
"]",
"get",
"(",
"byte",
"[",
"]",
"key",
")",
"throws",
"IOException",
"{",
"int",
"keyLength",
"=",
"key",
".",
"length",
";",
"if",
"(",
"keyLength",
">=",
"slots",
".",
"length",
"||",
"keyCounts",
"[",
"keyLength",
"]",
"=... | Get the value for the given key or null | [
"Get",
"the",
"value",
"for",
"the",
"given",
"key",
"or",
"null"
] | d05ccdd3f67855eb2675dbd82599f19aa7a9f650 | https://github.com/linkedin/PalDB/blob/d05ccdd3f67855eb2675dbd82599f19aa7a9f650/paldb/src/main/java/com/linkedin/paldb/impl/StorageReader.java#L243-L270 | train |
linkedin/PalDB | paldb/src/main/java/com/linkedin/paldb/impl/StorageReader.java | StorageReader.close | public void close()
throws IOException {
channel.close();
mappedFile.close();
indexBuffer = null;
dataBuffers = null;
mappedFile = null;
channel = null;
System.gc();
} | java | public void close()
throws IOException {
channel.close();
mappedFile.close();
indexBuffer = null;
dataBuffers = null;
mappedFile = null;
channel = null;
System.gc();
} | [
"public",
"void",
"close",
"(",
")",
"throws",
"IOException",
"{",
"channel",
".",
"close",
"(",
")",
";",
"mappedFile",
".",
"close",
"(",
")",
";",
"indexBuffer",
"=",
"null",
";",
"dataBuffers",
"=",
"null",
";",
"mappedFile",
"=",
"null",
";",
"cha... | Close the reader channel | [
"Close",
"the",
"reader",
"channel"
] | d05ccdd3f67855eb2675dbd82599f19aa7a9f650 | https://github.com/linkedin/PalDB/blob/d05ccdd3f67855eb2675dbd82599f19aa7a9f650/paldb/src/main/java/com/linkedin/paldb/impl/StorageReader.java#L282-L291 | train |
linkedin/PalDB | paldb/src/main/java/com/linkedin/paldb/impl/StorageReader.java | StorageReader.getMMapBytes | private byte[] getMMapBytes(long offset)
throws IOException {
//Read the first 4 bytes to get the size of the data
ByteBuffer buf = getDataBuffer(offset);
int maxLen = (int) Math.min(5, dataSize - offset);
int size;
if (buf.remaining() >= maxLen) {
//Continuous read
int pos = buf.... | java | private byte[] getMMapBytes(long offset)
throws IOException {
//Read the first 4 bytes to get the size of the data
ByteBuffer buf = getDataBuffer(offset);
int maxLen = (int) Math.min(5, dataSize - offset);
int size;
if (buf.remaining() >= maxLen) {
//Continuous read
int pos = buf.... | [
"private",
"byte",
"[",
"]",
"getMMapBytes",
"(",
"long",
"offset",
")",
"throws",
"IOException",
"{",
"//Read the first 4 bytes to get the size of the data",
"ByteBuffer",
"buf",
"=",
"getDataBuffer",
"(",
"offset",
")",
";",
"int",
"maxLen",
"=",
"(",
"int",
")"... | Read the data at the given offset, the data can be spread over multiple data buffers | [
"Read",
"the",
"data",
"at",
"the",
"given",
"offset",
"the",
"data",
"can",
"be",
"spread",
"over",
"multiple",
"data",
"buffers"
] | d05ccdd3f67855eb2675dbd82599f19aa7a9f650 | https://github.com/linkedin/PalDB/blob/d05ccdd3f67855eb2675dbd82599f19aa7a9f650/paldb/src/main/java/com/linkedin/paldb/impl/StorageReader.java#L298-L350 | train |
linkedin/PalDB | paldb/src/main/java/com/linkedin/paldb/impl/StorageReader.java | StorageReader.getDiskBytes | private byte[] getDiskBytes(long offset)
throws IOException {
mappedFile.seek(dataOffset + offset);
//Get size of data
int size = LongPacker.unpackInt(mappedFile);
//Create output bytes
byte[] res = new byte[size];
//Read data
if (mappedFile.read(res) == -1) {
throw new EOFExc... | java | private byte[] getDiskBytes(long offset)
throws IOException {
mappedFile.seek(dataOffset + offset);
//Get size of data
int size = LongPacker.unpackInt(mappedFile);
//Create output bytes
byte[] res = new byte[size];
//Read data
if (mappedFile.read(res) == -1) {
throw new EOFExc... | [
"private",
"byte",
"[",
"]",
"getDiskBytes",
"(",
"long",
"offset",
")",
"throws",
"IOException",
"{",
"mappedFile",
".",
"seek",
"(",
"dataOffset",
"+",
"offset",
")",
";",
"//Get size of data",
"int",
"size",
"=",
"LongPacker",
".",
"unpackInt",
"(",
"mapp... | Get data from disk | [
"Get",
"data",
"from",
"disk"
] | d05ccdd3f67855eb2675dbd82599f19aa7a9f650 | https://github.com/linkedin/PalDB/blob/d05ccdd3f67855eb2675dbd82599f19aa7a9f650/paldb/src/main/java/com/linkedin/paldb/impl/StorageReader.java#L353-L369 | train |
linkedin/PalDB | paldb/src/main/java/com/linkedin/paldb/impl/StorageReader.java | StorageReader.getDataBuffer | private ByteBuffer getDataBuffer(long index) {
ByteBuffer buf = dataBuffers[(int) (index / segmentSize)];
buf.position((int) (index % segmentSize));
return buf;
} | java | private ByteBuffer getDataBuffer(long index) {
ByteBuffer buf = dataBuffers[(int) (index / segmentSize)];
buf.position((int) (index % segmentSize));
return buf;
} | [
"private",
"ByteBuffer",
"getDataBuffer",
"(",
"long",
"index",
")",
"{",
"ByteBuffer",
"buf",
"=",
"dataBuffers",
"[",
"(",
"int",
")",
"(",
"index",
"/",
"segmentSize",
")",
"]",
";",
"buf",
".",
"position",
"(",
"(",
"int",
")",
"(",
"index",
"%",
... | Return the data buffer for the given position | [
"Return",
"the",
"data",
"buffer",
"for",
"the",
"given",
"position"
] | d05ccdd3f67855eb2675dbd82599f19aa7a9f650 | https://github.com/linkedin/PalDB/blob/d05ccdd3f67855eb2675dbd82599f19aa7a9f650/paldb/src/main/java/com/linkedin/paldb/impl/StorageReader.java#L372-L376 | train |
linkedin/PalDB | paldb/src/main/java/com/linkedin/paldb/utils/DataInputOutput.java | DataInputOutput.ensureAvail | private void ensureAvail(int n) {
if (pos + n >= buf.length) {
int newSize = Math.max(pos + n, buf.length * 2);
buf = Arrays.copyOf(buf, newSize);
}
} | java | private void ensureAvail(int n) {
if (pos + n >= buf.length) {
int newSize = Math.max(pos + n, buf.length * 2);
buf = Arrays.copyOf(buf, newSize);
}
} | [
"private",
"void",
"ensureAvail",
"(",
"int",
"n",
")",
"{",
"if",
"(",
"pos",
"+",
"n",
">=",
"buf",
".",
"length",
")",
"{",
"int",
"newSize",
"=",
"Math",
".",
"max",
"(",
"pos",
"+",
"n",
",",
"buf",
".",
"length",
"*",
"2",
")",
";",
"bu... | make sure there will be enought space in buffer to write N bytes | [
"make",
"sure",
"there",
"will",
"be",
"enought",
"space",
"in",
"buffer",
"to",
"write",
"N",
"bytes"
] | d05ccdd3f67855eb2675dbd82599f19aa7a9f650 | https://github.com/linkedin/PalDB/blob/d05ccdd3f67855eb2675dbd82599f19aa7a9f650/paldb/src/main/java/com/linkedin/paldb/utils/DataInputOutput.java#L184-L189 | train |
linkedin/PalDB | paldb/src/main/java/com/linkedin/paldb/utils/LongPacker.java | LongPacker.unpackInt | static public int unpackInt(DataInput is)
throws IOException {
for (int offset = 0, result = 0; offset < 32; offset += 7) {
int b = is.readUnsignedByte();
result |= (b & 0x7F) << offset;
if ((b & 0x80) == 0) {
return result;
}
}
throw new Error("Malformed integer.");
... | java | static public int unpackInt(DataInput is)
throws IOException {
for (int offset = 0, result = 0; offset < 32; offset += 7) {
int b = is.readUnsignedByte();
result |= (b & 0x7F) << offset;
if ((b & 0x80) == 0) {
return result;
}
}
throw new Error("Malformed integer.");
... | [
"static",
"public",
"int",
"unpackInt",
"(",
"DataInput",
"is",
")",
"throws",
"IOException",
"{",
"for",
"(",
"int",
"offset",
"=",
"0",
",",
"result",
"=",
"0",
";",
"offset",
"<",
"32",
";",
"offset",
"+=",
"7",
")",
"{",
"int",
"b",
"=",
"is",
... | Unpack positive int value from the input stream.
@param is The input stream.
@return the long value
@throws IOException if an error occurs with the stream | [
"Unpack",
"positive",
"int",
"value",
"from",
"the",
"input",
"stream",
"."
] | d05ccdd3f67855eb2675dbd82599f19aa7a9f650 | https://github.com/linkedin/PalDB/blob/d05ccdd3f67855eb2675dbd82599f19aa7a9f650/paldb/src/main/java/com/linkedin/paldb/utils/LongPacker.java#L174-L184 | train |
linkedin/PalDB | paldb/src/main/java/com/linkedin/paldb/utils/LongPacker.java | LongPacker.unpackInt | static public int unpackInt(ByteBuffer bb)
throws IOException {
for (int offset = 0, result = 0; offset < 32; offset += 7) {
int b = bb.get() & 0xffff;
result |= (b & 0x7F) << offset;
if ((b & 0x80) == 0) {
return result;
}
}
throw new Error("Malformed integer.");
} | java | static public int unpackInt(ByteBuffer bb)
throws IOException {
for (int offset = 0, result = 0; offset < 32; offset += 7) {
int b = bb.get() & 0xffff;
result |= (b & 0x7F) << offset;
if ((b & 0x80) == 0) {
return result;
}
}
throw new Error("Malformed integer.");
} | [
"static",
"public",
"int",
"unpackInt",
"(",
"ByteBuffer",
"bb",
")",
"throws",
"IOException",
"{",
"for",
"(",
"int",
"offset",
"=",
"0",
",",
"result",
"=",
"0",
";",
"offset",
"<",
"32",
";",
"offset",
"+=",
"7",
")",
"{",
"int",
"b",
"=",
"bb",... | Unpack positive int value from the input byte buffer.
@param bb The byte buffer
@return the long value
@throws IOException if an error occurs with the stream | [
"Unpack",
"positive",
"int",
"value",
"from",
"the",
"input",
"byte",
"buffer",
"."
] | d05ccdd3f67855eb2675dbd82599f19aa7a9f650 | https://github.com/linkedin/PalDB/blob/d05ccdd3f67855eb2675dbd82599f19aa7a9f650/paldb/src/main/java/com/linkedin/paldb/utils/LongPacker.java#L193-L203 | train |
linkedin/PalDB | paldb/src/main/java/com/linkedin/paldb/impl/StorageWriter.java | StorageWriter.mergeFiles | private void mergeFiles(List<File> inputFiles, OutputStream outputStream)
throws IOException {
long startTime = System.nanoTime();
//Merge files
for (File f : inputFiles) {
if (f.exists()) {
FileInputStream fileInputStream = new FileInputStream(f);
BufferedInputStream bufferedIn... | java | private void mergeFiles(List<File> inputFiles, OutputStream outputStream)
throws IOException {
long startTime = System.nanoTime();
//Merge files
for (File f : inputFiles) {
if (f.exists()) {
FileInputStream fileInputStream = new FileInputStream(f);
BufferedInputStream bufferedIn... | [
"private",
"void",
"mergeFiles",
"(",
"List",
"<",
"File",
">",
"inputFiles",
",",
"OutputStream",
"outputStream",
")",
"throws",
"IOException",
"{",
"long",
"startTime",
"=",
"System",
".",
"nanoTime",
"(",
")",
";",
"//Merge files",
"for",
"(",
"File",
"f"... | Merge files to the provided fileChannel | [
"Merge",
"files",
"to",
"the",
"provided",
"fileChannel"
] | d05ccdd3f67855eb2675dbd82599f19aa7a9f650 | https://github.com/linkedin/PalDB/blob/d05ccdd3f67855eb2675dbd82599f19aa7a9f650/paldb/src/main/java/com/linkedin/paldb/impl/StorageWriter.java#L385-L412 | train |
linkedin/PalDB | paldb/src/main/java/com/linkedin/paldb/impl/StorageWriter.java | StorageWriter.getDataStream | private DataOutputStream getDataStream(int keyLength)
throws IOException {
// Resize array if necessary
if (dataStreams.length <= keyLength) {
dataStreams = Arrays.copyOf(dataStreams, keyLength + 1);
dataFiles = Arrays.copyOf(dataFiles, keyLength + 1);
}
DataOutputStream dos = dataStr... | java | private DataOutputStream getDataStream(int keyLength)
throws IOException {
// Resize array if necessary
if (dataStreams.length <= keyLength) {
dataStreams = Arrays.copyOf(dataStreams, keyLength + 1);
dataFiles = Arrays.copyOf(dataFiles, keyLength + 1);
}
DataOutputStream dos = dataStr... | [
"private",
"DataOutputStream",
"getDataStream",
"(",
"int",
"keyLength",
")",
"throws",
"IOException",
"{",
"// Resize array if necessary",
"if",
"(",
"dataStreams",
".",
"length",
"<=",
"keyLength",
")",
"{",
"dataStreams",
"=",
"Arrays",
".",
"copyOf",
"(",
"dat... | Get the data stream for the specified keyLength, create it if needed | [
"Get",
"the",
"data",
"stream",
"for",
"the",
"specified",
"keyLength",
"create",
"it",
"if",
"needed"
] | d05ccdd3f67855eb2675dbd82599f19aa7a9f650 | https://github.com/linkedin/PalDB/blob/d05ccdd3f67855eb2675dbd82599f19aa7a9f650/paldb/src/main/java/com/linkedin/paldb/impl/StorageWriter.java#L429-L450 | train |
linkedin/PalDB | paldb/src/main/java/com/linkedin/paldb/impl/StorageWriter.java | StorageWriter.getIndexStream | private DataOutputStream getIndexStream(int keyLength)
throws IOException {
// Resize array if necessary
if (indexStreams.length <= keyLength) {
indexStreams = Arrays.copyOf(indexStreams, keyLength + 1);
indexFiles = Arrays.copyOf(indexFiles, keyLength + 1);
keyCounts = Arrays.copyOf(key... | java | private DataOutputStream getIndexStream(int keyLength)
throws IOException {
// Resize array if necessary
if (indexStreams.length <= keyLength) {
indexStreams = Arrays.copyOf(indexStreams, keyLength + 1);
indexFiles = Arrays.copyOf(indexFiles, keyLength + 1);
keyCounts = Arrays.copyOf(key... | [
"private",
"DataOutputStream",
"getIndexStream",
"(",
"int",
"keyLength",
")",
"throws",
"IOException",
"{",
"// Resize array if necessary",
"if",
"(",
"indexStreams",
".",
"length",
"<=",
"keyLength",
")",
"{",
"indexStreams",
"=",
"Arrays",
".",
"copyOf",
"(",
"... | Get the index stream for the specified keyLength, create it if needed | [
"Get",
"the",
"index",
"stream",
"for",
"the",
"specified",
"keyLength",
"create",
"it",
"if",
"needed"
] | d05ccdd3f67855eb2675dbd82599f19aa7a9f650 | https://github.com/linkedin/PalDB/blob/d05ccdd3f67855eb2675dbd82599f19aa7a9f650/paldb/src/main/java/com/linkedin/paldb/impl/StorageWriter.java#L453-L479 | train |
patrickfav/bcrypt | modules/bcrypt-cli/src/main/java/at/favre/lib/crypto/bcrypt/cli/BcryptTool.java | BcryptTool.execute | static int execute(Arg arguments, PrintStream stream, PrintStream errorStream) {
if (arguments == null) {
return 2;
}
if (arguments.checkBcryptHash != null) { // verify mode
BCrypt.Result result = BCrypt.verifyer().verify(arguments.password, arguments.checkBcryptHash);
... | java | static int execute(Arg arguments, PrintStream stream, PrintStream errorStream) {
if (arguments == null) {
return 2;
}
if (arguments.checkBcryptHash != null) { // verify mode
BCrypt.Result result = BCrypt.verifyer().verify(arguments.password, arguments.checkBcryptHash);
... | [
"static",
"int",
"execute",
"(",
"Arg",
"arguments",
",",
"PrintStream",
"stream",
",",
"PrintStream",
"errorStream",
")",
"{",
"if",
"(",
"arguments",
"==",
"null",
")",
"{",
"return",
"2",
";",
"}",
"if",
"(",
"arguments",
".",
"checkBcryptHash",
"!=",
... | Execute the given arguments and executes the appropriate actions
@param arguments
@param stream
@param errorStream
@return the exit code of the tool | [
"Execute",
"the",
"given",
"arguments",
"and",
"executes",
"the",
"appropriate",
"actions"
] | 40e75be395b4e1b57b9872b22d98a9fb560e0184 | https://github.com/patrickfav/bcrypt/blob/40e75be395b4e1b57b9872b22d98a9fb560e0184/modules/bcrypt-cli/src/main/java/at/favre/lib/crypto/bcrypt/cli/BcryptTool.java#L42-L66 | train |
patrickfav/bcrypt | modules/bcrypt/src/main/java/at/favre/lib/crypto/bcrypt/BCrypt.java | BCrypt.with | public static Hasher with(Version version, SecureRandom secureRandom, LongPasswordStrategy longPasswordStrategy) {
return new Hasher(version, secureRandom, longPasswordStrategy);
} | java | public static Hasher with(Version version, SecureRandom secureRandom, LongPasswordStrategy longPasswordStrategy) {
return new Hasher(version, secureRandom, longPasswordStrategy);
} | [
"public",
"static",
"Hasher",
"with",
"(",
"Version",
"version",
",",
"SecureRandom",
"secureRandom",
",",
"LongPasswordStrategy",
"longPasswordStrategy",
")",
"{",
"return",
"new",
"Hasher",
"(",
"version",
",",
"secureRandom",
",",
"longPasswordStrategy",
")",
";"... | Create a new instance with custom version, secureRandom and long password strategy
@param version defines what version of bcrypt will be generated (mostly the version identifier changes)
@param secureRandom to use for random salt generation
@param longPasswordStrategy decides what to do on pw that... | [
"Create",
"a",
"new",
"instance",
"with",
"custom",
"version",
"secureRandom",
"and",
"long",
"password",
"strategy"
] | 40e75be395b4e1b57b9872b22d98a9fb560e0184 | https://github.com/patrickfav/bcrypt/blob/40e75be395b4e1b57b9872b22d98a9fb560e0184/modules/bcrypt/src/main/java/at/favre/lib/crypto/bcrypt/BCrypt.java#L114-L116 | train |
patrickfav/bcrypt | modules/bcrypt/src/main/java/at/favre/lib/crypto/bcrypt/BCryptOpenBSDProtocol.java | BCryptOpenBSDProtocol.streamToWord | private static int streamToWord(byte[] data, int[] offp) {
int i;
int word = 0;
int off = offp[0];
for (i = 0; i < 4; i++) {
word = (word << 8) | (data[off] & 0xff);
off = (off + 1) % data.length;
}
offp[0] = off;
return word;
} | java | private static int streamToWord(byte[] data, int[] offp) {
int i;
int word = 0;
int off = offp[0];
for (i = 0; i < 4; i++) {
word = (word << 8) | (data[off] & 0xff);
off = (off + 1) % data.length;
}
offp[0] = off;
return word;
} | [
"private",
"static",
"int",
"streamToWord",
"(",
"byte",
"[",
"]",
"data",
",",
"int",
"[",
"]",
"offp",
")",
"{",
"int",
"i",
";",
"int",
"word",
"=",
"0",
";",
"int",
"off",
"=",
"offp",
"[",
"0",
"]",
";",
"for",
"(",
"i",
"=",
"0",
";",
... | Cyclically extract a word of key material
@param data the string to extract the data from
@param offp a "pointer" (as a one-entry array) to the
current offset into data
@return the next word of material from data | [
"Cyclically",
"extract",
"a",
"word",
"of",
"key",
"material"
] | 40e75be395b4e1b57b9872b22d98a9fb560e0184 | https://github.com/patrickfav/bcrypt/blob/40e75be395b4e1b57b9872b22d98a9fb560e0184/modules/bcrypt/src/main/java/at/favre/lib/crypto/bcrypt/BCryptOpenBSDProtocol.java#L403-L415 | train |
patrickfav/bcrypt | modules/bcrypt/src/main/java/at/favre/lib/crypto/bcrypt/BCryptOpenBSDProtocol.java | BCryptOpenBSDProtocol.encipher | private void encipher(int[] P, int[] S, int[] lr, int off) {
int i, n, l = lr[off], r = lr[off + 1];
l ^= P[0];
for (i = 0; i <= BLOWFISH_NUM_ROUNDS - 2; ) {
// Feistel substitution on left word
n = S[(l >> 24) & 0xff];
n += S[0x100 | ((l >> 16) & 0xff)];
... | java | private void encipher(int[] P, int[] S, int[] lr, int off) {
int i, n, l = lr[off], r = lr[off + 1];
l ^= P[0];
for (i = 0; i <= BLOWFISH_NUM_ROUNDS - 2; ) {
// Feistel substitution on left word
n = S[(l >> 24) & 0xff];
n += S[0x100 | ((l >> 16) & 0xff)];
... | [
"private",
"void",
"encipher",
"(",
"int",
"[",
"]",
"P",
",",
"int",
"[",
"]",
"S",
",",
"int",
"[",
"]",
"lr",
",",
"int",
"off",
")",
"{",
"int",
"i",
",",
"n",
",",
"l",
"=",
"lr",
"[",
"off",
"]",
",",
"r",
"=",
"lr",
"[",
"off",
"... | Blowfish encipher a single 64-bit block encoded as
two 32-bit halves
@param lr an array containing the two 32-bit half blocks
@param off the position in the array of the blocks | [
"Blowfish",
"encipher",
"a",
"single",
"64",
"-",
"bit",
"block",
"encoded",
"as",
"two",
"32",
"-",
"bit",
"halves"
] | 40e75be395b4e1b57b9872b22d98a9fb560e0184 | https://github.com/patrickfav/bcrypt/blob/40e75be395b4e1b57b9872b22d98a9fb560e0184/modules/bcrypt/src/main/java/at/favre/lib/crypto/bcrypt/BCryptOpenBSDProtocol.java#L451-L472 | train |
belaban/jgroups-raft | src/org/jgroups/protocols/raft/InMemoryLog.java | InMemoryLog.expand | protected void expand(int min_size_needed) {
LogEntry[] new_entries=new LogEntry[Math.max(entries.length + INCR, entries.length + min_size_needed)];
System.arraycopy(entries, 0, new_entries, 0, entries.length);
entries=new_entries;
} | java | protected void expand(int min_size_needed) {
LogEntry[] new_entries=new LogEntry[Math.max(entries.length + INCR, entries.length + min_size_needed)];
System.arraycopy(entries, 0, new_entries, 0, entries.length);
entries=new_entries;
} | [
"protected",
"void",
"expand",
"(",
"int",
"min_size_needed",
")",
"{",
"LogEntry",
"[",
"]",
"new_entries",
"=",
"new",
"LogEntry",
"[",
"Math",
".",
"max",
"(",
"entries",
".",
"length",
"+",
"INCR",
",",
"entries",
".",
"length",
"+",
"min_size_needed",... | Lock must be held to call this method | [
"Lock",
"must",
"be",
"held",
"to",
"call",
"this",
"method"
] | 5923a4761df50bfd203cc82cefc138694b4d7fc3 | https://github.com/belaban/jgroups-raft/blob/5923a4761df50bfd203cc82cefc138694b4d7fc3/src/org/jgroups/protocols/raft/InMemoryLog.java#L178-L182 | train |
belaban/jgroups-raft | src/org/jgroups/raft/blocks/ReplicatedStateMachine.java | ReplicatedStateMachine.remove | public V remove(K key) throws Exception {
return invoke(REMOVE, key, null, true);
} | java | public V remove(K key) throws Exception {
return invoke(REMOVE, key, null, true);
} | [
"public",
"V",
"remove",
"(",
"K",
"key",
")",
"throws",
"Exception",
"{",
"return",
"invoke",
"(",
"REMOVE",
",",
"key",
",",
"null",
",",
"true",
")",
";",
"}"
] | Removes a key-value pair from the state machine. The data is not removed directly from the hashmap, but an
update is sent via RAFT and the actual removal from the hashmap is only done when that change has been committed.
@param key The key to be removed | [
"Removes",
"a",
"key",
"-",
"value",
"pair",
"from",
"the",
"state",
"machine",
".",
"The",
"data",
"is",
"not",
"removed",
"directly",
"from",
"the",
"hashmap",
"but",
"an",
"update",
"is",
"sent",
"via",
"RAFT",
"and",
"the",
"actual",
"removal",
"from... | 5923a4761df50bfd203cc82cefc138694b4d7fc3 | https://github.com/belaban/jgroups-raft/blob/5923a4761df50bfd203cc82cefc138694b4d7fc3/src/org/jgroups/raft/blocks/ReplicatedStateMachine.java#L151-L153 | train |
belaban/jgroups-raft | src/org/jgroups/protocols/raft/LevelDBLog.java | LevelDBLog.printMetadata | public void printMetadata() throws Exception {
log.info("-----------------");
log.info("RAFT Log Metadata");
log.info("-----------------");
byte[] firstAppendedBytes = db.get(FIRSTAPPENDED);
log.info("First Appended: %d", fromByteArrayToInt(firstAppendedBytes));
byte[] ... | java | public void printMetadata() throws Exception {
log.info("-----------------");
log.info("RAFT Log Metadata");
log.info("-----------------");
byte[] firstAppendedBytes = db.get(FIRSTAPPENDED);
log.info("First Appended: %d", fromByteArrayToInt(firstAppendedBytes));
byte[] ... | [
"public",
"void",
"printMetadata",
"(",
")",
"throws",
"Exception",
"{",
"log",
".",
"info",
"(",
"\"-----------------\"",
")",
";",
"log",
".",
"info",
"(",
"\"RAFT Log Metadata\"",
")",
";",
"log",
".",
"info",
"(",
"\"-----------------\"",
")",
";",
"byte... | Useful in debugging | [
"Useful",
"in",
"debugging"
] | 5923a4761df50bfd203cc82cefc138694b4d7fc3 | https://github.com/belaban/jgroups-raft/blob/5923a4761df50bfd203cc82cefc138694b4d7fc3/src/org/jgroups/protocols/raft/LevelDBLog.java#L254-L270 | train |
belaban/jgroups-raft | src/org/jgroups/raft/blocks/CounterService.java | CounterService.getOrCreateCounter | public Counter getOrCreateCounter(String name, long initial_value) throws Exception {
Object existing_value=allow_dirty_reads? _get(name) : invoke(Command.get, name, false);
if(existing_value != null)
counters.put(name, (Long)existing_value);
else {
Object retval=invoke(C... | java | public Counter getOrCreateCounter(String name, long initial_value) throws Exception {
Object existing_value=allow_dirty_reads? _get(name) : invoke(Command.get, name, false);
if(existing_value != null)
counters.put(name, (Long)existing_value);
else {
Object retval=invoke(C... | [
"public",
"Counter",
"getOrCreateCounter",
"(",
"String",
"name",
",",
"long",
"initial_value",
")",
"throws",
"Exception",
"{",
"Object",
"existing_value",
"=",
"allow_dirty_reads",
"?",
"_get",
"(",
"name",
")",
":",
"invoke",
"(",
"Command",
".",
"get",
","... | Returns an existing counter, or creates a new one if none exists
@param name Name of the counter, different counters have to have different names
@param initial_value The initial value of a new counter if there is no existing counter. Ignored
if the counter already exists
@return The counter implementation | [
"Returns",
"an",
"existing",
"counter",
"or",
"creates",
"a",
"new",
"one",
"if",
"none",
"exists"
] | 5923a4761df50bfd203cc82cefc138694b4d7fc3 | https://github.com/belaban/jgroups-raft/blob/5923a4761df50bfd203cc82cefc138694b4d7fc3/src/org/jgroups/raft/blocks/CounterService.java#L67-L77 | train |
belaban/jgroups-raft | src/org/jgroups/protocols/raft/RaftImpl.java | RaftImpl.getFirstIndexOfConflictingTerm | protected int getFirstIndexOfConflictingTerm(int start_index, int conflicting_term) {
Log log=raft.log_impl;
int first=Math.max(1, log.firstAppended()), last=log.lastAppended();
int retval=Math.min(start_index, last);
for(int i=retval; i >= first; i--) {
LogEntry entry=log.ge... | java | protected int getFirstIndexOfConflictingTerm(int start_index, int conflicting_term) {
Log log=raft.log_impl;
int first=Math.max(1, log.firstAppended()), last=log.lastAppended();
int retval=Math.min(start_index, last);
for(int i=retval; i >= first; i--) {
LogEntry entry=log.ge... | [
"protected",
"int",
"getFirstIndexOfConflictingTerm",
"(",
"int",
"start_index",
",",
"int",
"conflicting_term",
")",
"{",
"Log",
"log",
"=",
"raft",
".",
"log_impl",
";",
"int",
"first",
"=",
"Math",
".",
"max",
"(",
"1",
",",
"log",
".",
"firstAppended",
... | Finds the first index at which conflicting_term starts, going back from start_index towards the head of the log | [
"Finds",
"the",
"first",
"index",
"at",
"which",
"conflicting_term",
"starts",
"going",
"back",
"from",
"start_index",
"towards",
"the",
"head",
"of",
"the",
"log"
] | 5923a4761df50bfd203cc82cefc138694b4d7fc3 | https://github.com/belaban/jgroups-raft/blob/5923a4761df50bfd203cc82cefc138694b4d7fc3/src/org/jgroups/protocols/raft/RaftImpl.java#L83-L94 | train |
networknt/json-schema-validator | src/main/java/com/networknt/schema/TypeValidator.java | TypeValidator.isNumber | public static boolean isNumber(JsonNode node, boolean isTypeLoose) {
if (node.isNumber()) {
return true;
} else if (isTypeLoose) {
if (TypeFactory.getValueNodeType(node) == JsonType.STRING) {
return isNumeric(node.textValue());
}
}
retu... | java | public static boolean isNumber(JsonNode node, boolean isTypeLoose) {
if (node.isNumber()) {
return true;
} else if (isTypeLoose) {
if (TypeFactory.getValueNodeType(node) == JsonType.STRING) {
return isNumeric(node.textValue());
}
}
retu... | [
"public",
"static",
"boolean",
"isNumber",
"(",
"JsonNode",
"node",
",",
"boolean",
"isTypeLoose",
")",
"{",
"if",
"(",
"node",
".",
"isNumber",
"(",
")",
")",
"{",
"return",
"true",
";",
"}",
"else",
"if",
"(",
"isTypeLoose",
")",
"{",
"if",
"(",
"T... | Check if the type of the JsonNode's value is number based on the
status of typeLoose flag.
@param node the JsonNode to check
@param isTypeLoose The flag to show whether typeLoose is enabled
@return boolean to indicate if it is a number | [
"Check",
"if",
"the",
"type",
"of",
"the",
"JsonNode",
"s",
"value",
"is",
"number",
"based",
"on",
"the",
"status",
"of",
"typeLoose",
"flag",
"."
] | d2a3a8d2085e72eb5c25c2fd8c8c9e641a62376d | https://github.com/networknt/json-schema-validator/blob/d2a3a8d2085e72eb5c25c2fd8c8c9e641a62376d/src/main/java/com/networknt/schema/TypeValidator.java#L208-L217 | train |
networknt/json-schema-validator | src/main/java/com/networknt/schema/EnumValidator.java | EnumValidator.isTypeLooseContainsInEnum | private boolean isTypeLooseContainsInEnum(JsonNode node) {
if (TypeFactory.getValueNodeType(node) == JsonType.STRING) {
String nodeText = node.textValue();
for (JsonNode n : nodes) {
String value = n.asText();
if (value != null && value.equals(nodeText)) {... | java | private boolean isTypeLooseContainsInEnum(JsonNode node) {
if (TypeFactory.getValueNodeType(node) == JsonType.STRING) {
String nodeText = node.textValue();
for (JsonNode n : nodes) {
String value = n.asText();
if (value != null && value.equals(nodeText)) {... | [
"private",
"boolean",
"isTypeLooseContainsInEnum",
"(",
"JsonNode",
"node",
")",
"{",
"if",
"(",
"TypeFactory",
".",
"getValueNodeType",
"(",
"node",
")",
"==",
"JsonType",
".",
"STRING",
")",
"{",
"String",
"nodeText",
"=",
"node",
".",
"textValue",
"(",
")... | Check whether enum contains the value of the JsonNode if the typeLoose is enabled.
@param node JsonNode to check | [
"Check",
"whether",
"enum",
"contains",
"the",
"value",
"of",
"the",
"JsonNode",
"if",
"the",
"typeLoose",
"is",
"enabled",
"."
] | d2a3a8d2085e72eb5c25c2fd8c8c9e641a62376d | https://github.com/networknt/json-schema-validator/blob/d2a3a8d2085e72eb5c25c2fd8c8c9e641a62376d/src/main/java/com/networknt/schema/EnumValidator.java#L79-L90 | train |
biezhi/excel-plus | src/main/java/io/github/biezhi/excel/plus/Writer.java | Writer.sheet | public Writer sheet(String sheetName) {
if (StringUtil.isEmpty(sheetName)) {
throw new IllegalArgumentException("sheet cannot be empty");
}
this.sheetName = sheetName;
return this;
} | java | public Writer sheet(String sheetName) {
if (StringUtil.isEmpty(sheetName)) {
throw new IllegalArgumentException("sheet cannot be empty");
}
this.sheetName = sheetName;
return this;
} | [
"public",
"Writer",
"sheet",
"(",
"String",
"sheetName",
")",
"{",
"if",
"(",
"StringUtil",
".",
"isEmpty",
"(",
"sheetName",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"sheet cannot be empty\"",
")",
";",
"}",
"this",
".",
"sheetName",
... | Configure the name of the sheet to be written. The default is Sheet0.
@param sheetName sheet name
@return Writer | [
"Configure",
"the",
"name",
"of",
"the",
"sheet",
"to",
"be",
"written",
".",
"The",
"default",
"is",
"Sheet0",
"."
] | 7591a6283c2801b46ab53daf7f312f16a44cb773 | https://github.com/biezhi/excel-plus/blob/7591a6283c2801b46ab53daf7f312f16a44cb773/src/main/java/io/github/biezhi/excel/plus/Writer.java#L135-L141 | train |
biezhi/excel-plus | src/main/java/io/github/biezhi/excel/plus/Writer.java | Writer.withTemplate | public Writer withTemplate(File template) {
if (null == template || !template.exists()) {
throw new IllegalArgumentException("template file not exist");
}
this.template = template;
return this;
} | java | public Writer withTemplate(File template) {
if (null == template || !template.exists()) {
throw new IllegalArgumentException("template file not exist");
}
this.template = template;
return this;
} | [
"public",
"Writer",
"withTemplate",
"(",
"File",
"template",
")",
"{",
"if",
"(",
"null",
"==",
"template",
"||",
"!",
"template",
".",
"exists",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"template file not exist\"",
")",
";",
"}... | Specify to write an Excel table from a template file
@param template template file instance
@return Writer | [
"Specify",
"to",
"write",
"an",
"Excel",
"table",
"from",
"a",
"template",
"file"
] | 7591a6283c2801b46ab53daf7f312f16a44cb773 | https://github.com/biezhi/excel-plus/blob/7591a6283c2801b46ab53daf7f312f16a44cb773/src/main/java/io/github/biezhi/excel/plus/Writer.java#L221-L227 | train |
biezhi/excel-plus | src/main/java/io/github/biezhi/excel/plus/Writer.java | Writer.to | public void to(File file) throws WriterException {
try {
this.to(new FileOutputStream(file));
} catch (FileNotFoundException e) {
throw new WriterException(e);
}
} | java | public void to(File file) throws WriterException {
try {
this.to(new FileOutputStream(file));
} catch (FileNotFoundException e) {
throw new WriterException(e);
}
} | [
"public",
"void",
"to",
"(",
"File",
"file",
")",
"throws",
"WriterException",
"{",
"try",
"{",
"this",
".",
"to",
"(",
"new",
"FileOutputStream",
"(",
"file",
")",
")",
";",
"}",
"catch",
"(",
"FileNotFoundException",
"e",
")",
"{",
"throw",
"new",
"W... | Write an Excel document to a file
@param file excel file
@throws WriterException | [
"Write",
"an",
"Excel",
"document",
"to",
"a",
"file"
] | 7591a6283c2801b46ab53daf7f312f16a44cb773 | https://github.com/biezhi/excel-plus/blob/7591a6283c2801b46ab53daf7f312f16a44cb773/src/main/java/io/github/biezhi/excel/plus/Writer.java#L265-L271 | train |
biezhi/excel-plus | src/main/java/io/github/biezhi/excel/plus/Writer.java | Writer.to | public void to(OutputStream outputStream) throws WriterException {
if (!withRaw && (null == rows || rows.isEmpty())) {
throw new WriterException("write rows cannot be empty, please check it");
}
if (excelType == ExcelType.XLSX) {
new WriterWith2007(outputStream).writeShee... | java | public void to(OutputStream outputStream) throws WriterException {
if (!withRaw && (null == rows || rows.isEmpty())) {
throw new WriterException("write rows cannot be empty, please check it");
}
if (excelType == ExcelType.XLSX) {
new WriterWith2007(outputStream).writeShee... | [
"public",
"void",
"to",
"(",
"OutputStream",
"outputStream",
")",
"throws",
"WriterException",
"{",
"if",
"(",
"!",
"withRaw",
"&&",
"(",
"null",
"==",
"rows",
"||",
"rows",
".",
"isEmpty",
"(",
")",
")",
")",
"{",
"throw",
"new",
"WriterException",
"(",... | Write an Excel document to the output stream
@param outputStream outputStream
@throws WriterException | [
"Write",
"an",
"Excel",
"document",
"to",
"the",
"output",
"stream"
] | 7591a6283c2801b46ab53daf7f312f16a44cb773 | https://github.com/biezhi/excel-plus/blob/7591a6283c2801b46ab53daf7f312f16a44cb773/src/main/java/io/github/biezhi/excel/plus/Writer.java#L279-L292 | train |
biezhi/excel-plus | src/main/java/io/github/biezhi/excel/plus/Reader.java | Reader.from | public Reader<T> from(File fromFile) {
if (null == fromFile || !fromFile.exists()) {
throw new IllegalArgumentException("excel file must be exist");
}
this.fromFile = fromFile;
return this;
} | java | public Reader<T> from(File fromFile) {
if (null == fromFile || !fromFile.exists()) {
throw new IllegalArgumentException("excel file must be exist");
}
this.fromFile = fromFile;
return this;
} | [
"public",
"Reader",
"<",
"T",
">",
"from",
"(",
"File",
"fromFile",
")",
"{",
"if",
"(",
"null",
"==",
"fromFile",
"||",
"!",
"fromFile",
".",
"exists",
"(",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"excel file must be exist\"",
")... | Read row data from an Excel file
@param fromFile excel file object
@return Reader | [
"Read",
"row",
"data",
"from",
"an",
"Excel",
"file"
] | 7591a6283c2801b46ab53daf7f312f16a44cb773 | https://github.com/biezhi/excel-plus/blob/7591a6283c2801b46ab53daf7f312f16a44cb773/src/main/java/io/github/biezhi/excel/plus/Reader.java#L99-L105 | train |
biezhi/excel-plus | src/main/java/io/github/biezhi/excel/plus/Reader.java | Reader.sheet | public Reader<T> sheet(String sheetName) {
if (StringUtil.isEmpty(sheetName)) {
throw new IllegalArgumentException("sheet cannot be empty");
}
this.sheetName = sheetName;
return this;
} | java | public Reader<T> sheet(String sheetName) {
if (StringUtil.isEmpty(sheetName)) {
throw new IllegalArgumentException("sheet cannot be empty");
}
this.sheetName = sheetName;
return this;
} | [
"public",
"Reader",
"<",
"T",
">",
"sheet",
"(",
"String",
"sheetName",
")",
"{",
"if",
"(",
"StringUtil",
".",
"isEmpty",
"(",
"sheetName",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"sheet cannot be empty\"",
")",
";",
"}",
"this",
... | Set the name of the sheet to be read. If you set the name, sheet will be invalid.
@param sheetName sheet name
@return | [
"Set",
"the",
"name",
"of",
"the",
"sheet",
"to",
"be",
"read",
".",
"If",
"you",
"set",
"the",
"name",
"sheet",
"will",
"be",
"invalid",
"."
] | 7591a6283c2801b46ab53daf7f312f16a44cb773 | https://github.com/biezhi/excel-plus/blob/7591a6283c2801b46ab53daf7f312f16a44cb773/src/main/java/io/github/biezhi/excel/plus/Reader.java#L152-L158 | train |
biezhi/excel-plus | src/main/java/io/github/biezhi/excel/plus/Reader.java | Reader.asStream | public Stream<T> asStream() {
if (modelType == null) {
throw new IllegalArgumentException("modelType can be not null");
}
if (fromFile == null && fromStream == null) {
throw new IllegalArgumentException("Excel source not is null");
}
if (fromFile != null... | java | public Stream<T> asStream() {
if (modelType == null) {
throw new IllegalArgumentException("modelType can be not null");
}
if (fromFile == null && fromStream == null) {
throw new IllegalArgumentException("Excel source not is null");
}
if (fromFile != null... | [
"public",
"Stream",
"<",
"T",
">",
"asStream",
"(",
")",
"{",
"if",
"(",
"modelType",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"modelType can be not null\"",
")",
";",
"}",
"if",
"(",
"fromFile",
"==",
"null",
"&&",
"fromS... | Return the read result as a Stream
@return Stream
@throws ReaderException Thrown when an exception occurs during reading | [
"Return",
"the",
"read",
"result",
"as",
"a",
"Stream"
] | 7591a6283c2801b46ab53daf7f312f16a44cb773 | https://github.com/biezhi/excel-plus/blob/7591a6283c2801b46ab53daf7f312f16a44cb773/src/main/java/io/github/biezhi/excel/plus/Reader.java#L171-L185 | train |
biezhi/excel-plus | src/main/java/io/github/biezhi/excel/plus/Reader.java | Reader.asList | public List<T> asList() throws ReaderException {
Stream<T> stream = this.asStream();
return stream.collect(toList());
} | java | public List<T> asList() throws ReaderException {
Stream<T> stream = this.asStream();
return stream.collect(toList());
} | [
"public",
"List",
"<",
"T",
">",
"asList",
"(",
")",
"throws",
"ReaderException",
"{",
"Stream",
"<",
"T",
">",
"stream",
"=",
"this",
".",
"asStream",
"(",
")",
";",
"return",
"stream",
".",
"collect",
"(",
"toList",
"(",
")",
")",
";",
"}"
] | Convert the read result to a List
@return List
@throws ReaderException Thrown when an exception occurs during reading | [
"Convert",
"the",
"read",
"result",
"to",
"a",
"List"
] | 7591a6283c2801b46ab53daf7f312f16a44cb773 | https://github.com/biezhi/excel-plus/blob/7591a6283c2801b46ab53daf7f312f16a44cb773/src/main/java/io/github/biezhi/excel/plus/Reader.java#L193-L196 | train |
norbsoft/android-typeface-helper | lib/src/main/java/com/norbsoft/typefacehelper/TypefaceHelper.java | TypefaceHelper.applyTypeface | private static void applyTypeface(ViewGroup viewGroup, TypefaceCollection typefaceCollection) {
for (int i = 0; i < viewGroup.getChildCount(); i++) {
View childView = viewGroup.getChildAt(i);
if (childView instanceof ViewGroup) {
applyTypeface((ViewGroup) childView, typefaceCollection);
} else {
app... | java | private static void applyTypeface(ViewGroup viewGroup, TypefaceCollection typefaceCollection) {
for (int i = 0; i < viewGroup.getChildCount(); i++) {
View childView = viewGroup.getChildAt(i);
if (childView instanceof ViewGroup) {
applyTypeface((ViewGroup) childView, typefaceCollection);
} else {
app... | [
"private",
"static",
"void",
"applyTypeface",
"(",
"ViewGroup",
"viewGroup",
",",
"TypefaceCollection",
"typefaceCollection",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"viewGroup",
".",
"getChildCount",
"(",
")",
";",
"i",
"++",
")",
"{",
... | Apply typeface to all ViewGroup childs
@param viewGroup to typeface typeface
@param typefaceCollection typeface collection | [
"Apply",
"typeface",
"to",
"all",
"ViewGroup",
"childs"
] | f9e12655f01144efa937c1172f5de7f9b29c4df7 | https://github.com/norbsoft/android-typeface-helper/blob/f9e12655f01144efa937c1172f5de7f9b29c4df7/lib/src/main/java/com/norbsoft/typefacehelper/TypefaceHelper.java#L226-L236 | train |
norbsoft/android-typeface-helper | lib/src/main/java/com/norbsoft/typefacehelper/TypefaceHelper.java | TypefaceHelper.applyForView | private static void applyForView(View view, TypefaceCollection typefaceCollection) {
if (view instanceof TextView) {
TextView textView = (TextView) view;
Typeface oldTypeface = textView.getTypeface();
final int style = oldTypeface == null ? Typeface.NORMAL : oldTypeface.getStyle();
textView.setTypeface(t... | java | private static void applyForView(View view, TypefaceCollection typefaceCollection) {
if (view instanceof TextView) {
TextView textView = (TextView) view;
Typeface oldTypeface = textView.getTypeface();
final int style = oldTypeface == null ? Typeface.NORMAL : oldTypeface.getStyle();
textView.setTypeface(t... | [
"private",
"static",
"void",
"applyForView",
"(",
"View",
"view",
",",
"TypefaceCollection",
"typefaceCollection",
")",
"{",
"if",
"(",
"view",
"instanceof",
"TextView",
")",
"{",
"TextView",
"textView",
"=",
"(",
"TextView",
")",
"view",
";",
"Typeface",
"old... | Apply typeface to single view
@param view to typeface typeface
@param typefaceCollection typeface collection | [
"Apply",
"typeface",
"to",
"single",
"view"
] | f9e12655f01144efa937c1172f5de7f9b29c4df7 | https://github.com/norbsoft/android-typeface-helper/blob/f9e12655f01144efa937c1172f5de7f9b29c4df7/lib/src/main/java/com/norbsoft/typefacehelper/TypefaceHelper.java#L244-L253 | train |
docusign/docusign-java-client | src/main/java/com/docusign/esign/api/AccountsApi.java | AccountsApi.createPermissionProfile | public PermissionProfile createPermissionProfile(String accountId, PermissionProfile permissionProfile) throws ApiException {
return createPermissionProfile(accountId, permissionProfile, null);
} | java | public PermissionProfile createPermissionProfile(String accountId, PermissionProfile permissionProfile) throws ApiException {
return createPermissionProfile(accountId, permissionProfile, null);
} | [
"public",
"PermissionProfile",
"createPermissionProfile",
"(",
"String",
"accountId",
",",
"PermissionProfile",
"permissionProfile",
")",
"throws",
"ApiException",
"{",
"return",
"createPermissionProfile",
"(",
"accountId",
",",
"permissionProfile",
",",
"null",
")",
";",... | Creates a new permission profile in the specified account.
@param accountId The external account number (int) or account ID Guid. (required)
@param permissionProfile (optional)
@return PermissionProfile | [
"Creates",
"a",
"new",
"permission",
"profile",
"in",
"the",
"specified",
"account",
"."
] | 17ae82ace0f023e98edf813be832950568212e34 | https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/AccountsApi.java#L274-L276 | train |
docusign/docusign-java-client | src/main/java/com/docusign/esign/api/AccountsApi.java | AccountsApi.getBrand | public Brand getBrand(String accountId, String brandId) throws ApiException {
return getBrand(accountId, brandId, null);
} | java | public Brand getBrand(String accountId, String brandId) throws ApiException {
return getBrand(accountId, brandId, null);
} | [
"public",
"Brand",
"getBrand",
"(",
"String",
"accountId",
",",
"String",
"brandId",
")",
"throws",
"ApiException",
"{",
"return",
"getBrand",
"(",
"accountId",
",",
"brandId",
",",
"null",
")",
";",
"}"
] | Get information for a specific brand.
@param accountId The external account number (int) or account ID Guid. (required)
@param brandId The unique identifier of a brand. (required)
@return Brand | [
"Get",
"information",
"for",
"a",
"specific",
"brand",
"."
] | 17ae82ace0f023e98edf813be832950568212e34 | https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/AccountsApi.java#L1048-L1050 | train |
docusign/docusign-java-client | src/main/java/com/docusign/esign/api/AccountsApi.java | AccountsApi.getPermissionProfile | public PermissionProfile getPermissionProfile(String accountId, String permissionProfileId) throws ApiException {
return getPermissionProfile(accountId, permissionProfileId, null);
} | java | public PermissionProfile getPermissionProfile(String accountId, String permissionProfileId) throws ApiException {
return getPermissionProfile(accountId, permissionProfileId, null);
} | [
"public",
"PermissionProfile",
"getPermissionProfile",
"(",
"String",
"accountId",
",",
"String",
"permissionProfileId",
")",
"throws",
"ApiException",
"{",
"return",
"getPermissionProfile",
"(",
"accountId",
",",
"permissionProfileId",
",",
"null",
")",
";",
"}"
] | Returns a permissions profile in the specified account.
@param accountId The external account number (int) or account ID Guid. (required)
@param permissionProfileId (required)
@return PermissionProfile | [
"Returns",
"a",
"permissions",
"profile",
"in",
"the",
"specified",
"account",
"."
] | 17ae82ace0f023e98edf813be832950568212e34 | https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/AccountsApi.java#L1631-L1633 | train |
docusign/docusign-java-client | src/main/java/com/docusign/esign/api/AccountsApi.java | AccountsApi.updateConsumerDisclosure | public ConsumerDisclosure updateConsumerDisclosure(String accountId, String langCode, ConsumerDisclosure consumerDisclosure) throws ApiException {
return updateConsumerDisclosure(accountId, langCode, consumerDisclosure, null);
} | java | public ConsumerDisclosure updateConsumerDisclosure(String accountId, String langCode, ConsumerDisclosure consumerDisclosure) throws ApiException {
return updateConsumerDisclosure(accountId, langCode, consumerDisclosure, null);
} | [
"public",
"ConsumerDisclosure",
"updateConsumerDisclosure",
"(",
"String",
"accountId",
",",
"String",
"langCode",
",",
"ConsumerDisclosure",
"consumerDisclosure",
")",
"throws",
"ApiException",
"{",
"return",
"updateConsumerDisclosure",
"(",
"accountId",
",",
"langCode",
... | Update Consumer Disclosure.
@param accountId The external account number (int) or account ID Guid. (required)
@param langCode The simple type enumeration the language used in the response. The supported languages, with the language value shown in parenthesis, are:Arabic (ar), Bulgarian (bg), Czech (cs), Chinese Simpli... | [
"Update",
"Consumer",
"Disclosure",
"."
] | 17ae82ace0f023e98edf813be832950568212e34 | https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/AccountsApi.java#L2653-L2655 | train |
docusign/docusign-java-client | src/main/java/com/docusign/esign/api/AccountsApi.java | AccountsApi.updateCustomField | public CustomFields updateCustomField(String accountId, String customFieldId, CustomField customField) throws ApiException {
return updateCustomField(accountId, customFieldId, customField, null);
} | java | public CustomFields updateCustomField(String accountId, String customFieldId, CustomField customField) throws ApiException {
return updateCustomField(accountId, customFieldId, customField, null);
} | [
"public",
"CustomFields",
"updateCustomField",
"(",
"String",
"accountId",
",",
"String",
"customFieldId",
",",
"CustomField",
"customField",
")",
"throws",
"ApiException",
"{",
"return",
"updateCustomField",
"(",
"accountId",
",",
"customFieldId",
",",
"customField",
... | Updates an existing account custom field.
@param accountId The external account number (int) or account ID Guid. (required)
@param customFieldId (required)
@param customField (optional)
@return CustomFields | [
"Updates",
"an",
"existing",
"account",
"custom",
"field",
"."
] | 17ae82ace0f023e98edf813be832950568212e34 | https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/AccountsApi.java#L2736-L2738 | train |
docusign/docusign-java-client | src/main/java/com/docusign/esign/api/AccountsApi.java | AccountsApi.updatePermissionProfile | public PermissionProfile updatePermissionProfile(String accountId, String permissionProfileId, PermissionProfile permissionProfile) throws ApiException {
return updatePermissionProfile(accountId, permissionProfileId, permissionProfile, null);
} | java | public PermissionProfile updatePermissionProfile(String accountId, String permissionProfileId, PermissionProfile permissionProfile) throws ApiException {
return updatePermissionProfile(accountId, permissionProfileId, permissionProfile, null);
} | [
"public",
"PermissionProfile",
"updatePermissionProfile",
"(",
"String",
"accountId",
",",
"String",
"permissionProfileId",
",",
"PermissionProfile",
"permissionProfile",
")",
"throws",
"ApiException",
"{",
"return",
"updatePermissionProfile",
"(",
"accountId",
",",
"permis... | Updates a permission profile within the specified account.
@param accountId The external account number (int) or account ID Guid. (required)
@param permissionProfileId (required)
@param permissionProfile (optional)
@return PermissionProfile | [
"Updates",
"a",
"permission",
"profile",
"within",
"the",
"specified",
"account",
"."
] | 17ae82ace0f023e98edf813be832950568212e34 | https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/AccountsApi.java#L2907-L2909 | train |
docusign/docusign-java-client | src/main/java/com/docusign/esign/api/CloudStorageApi.java | CloudStorageApi.getProvider | public CloudStorageProviders getProvider(String accountId, String userId, String serviceId) throws ApiException {
return getProvider(accountId, userId, serviceId, null);
} | java | public CloudStorageProviders getProvider(String accountId, String userId, String serviceId) throws ApiException {
return getProvider(accountId, userId, serviceId, null);
} | [
"public",
"CloudStorageProviders",
"getProvider",
"(",
"String",
"accountId",
",",
"String",
"userId",
",",
"String",
"serviceId",
")",
"throws",
"ApiException",
"{",
"return",
"getProvider",
"(",
"accountId",
",",
"userId",
",",
"serviceId",
",",
"null",
")",
"... | Gets the specified Cloud Storage Provider configuration for the User.
Retrieves the list of cloud storage providers enabled for the account and the configuration information for the user.
@param accountId The external account number (int) or account ID Guid. (required)
@param userId The user ID of the user being access... | [
"Gets",
"the",
"specified",
"Cloud",
"Storage",
"Provider",
"configuration",
"for",
"the",
"User",
".",
"Retrieves",
"the",
"list",
"of",
"cloud",
"storage",
"providers",
"enabled",
"for",
"the",
"account",
"and",
"the",
"configuration",
"information",
"for",
"t... | 17ae82ace0f023e98edf813be832950568212e34 | https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/CloudStorageApi.java#L221-L223 | train |
docusign/docusign-java-client | src/main/java/com/docusign/esign/api/CloudStorageApi.java | CloudStorageApi.listFolders | public ExternalFolder listFolders(String accountId, String userId, String serviceId) throws ApiException {
return listFolders(accountId, userId, serviceId, null);
} | java | public ExternalFolder listFolders(String accountId, String userId, String serviceId) throws ApiException {
return listFolders(accountId, userId, serviceId, null);
} | [
"public",
"ExternalFolder",
"listFolders",
"(",
"String",
"accountId",
",",
"String",
"userId",
",",
"String",
"serviceId",
")",
"throws",
"ApiException",
"{",
"return",
"listFolders",
"(",
"accountId",
",",
"userId",
",",
"serviceId",
",",
"null",
")",
";",
"... | Retrieves a list of all the items in a specified folder from the specified cloud storage provider.
Retrieves a list of all the items in a specified folder from the specified cloud storage provider.
@param accountId The external account number (int) or account ID Guid. (required)
@param userId The user ID of the user be... | [
"Retrieves",
"a",
"list",
"of",
"all",
"the",
"items",
"in",
"a",
"specified",
"folder",
"from",
"the",
"specified",
"cloud",
"storage",
"provider",
".",
"Retrieves",
"a",
"list",
"of",
"all",
"the",
"items",
"in",
"a",
"specified",
"folder",
"from",
"the"... | 17ae82ace0f023e98edf813be832950568212e34 | https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/CloudStorageApi.java#L522-L524 | train |
docusign/docusign-java-client | src/main/java/com/docusign/esign/api/BulkEnvelopesApi.java | BulkEnvelopesApi.get | public BulkEnvelopeStatus get(String accountId, String batchId) throws ApiException {
return get(accountId, batchId, null);
} | java | public BulkEnvelopeStatus get(String accountId, String batchId) throws ApiException {
return get(accountId, batchId, null);
} | [
"public",
"BulkEnvelopeStatus",
"get",
"(",
"String",
"accountId",
",",
"String",
"batchId",
")",
"throws",
"ApiException",
"{",
"return",
"get",
"(",
"accountId",
",",
"batchId",
",",
"null",
")",
";",
"}"
] | Gets the status of a specified bulk send operation.
Retrieves the status information of a single bulk recipient batch. A bulk recipient batch is the set of envelopes sent from a single bulk recipient file.
@param accountId The external account number (int) or account ID Guid. (required)
@param batchId (required)
@retu... | [
"Gets",
"the",
"status",
"of",
"a",
"specified",
"bulk",
"send",
"operation",
".",
"Retrieves",
"the",
"status",
"information",
"of",
"a",
"single",
"bulk",
"recipient",
"batch",
".",
"A",
"bulk",
"recipient",
"batch",
"is",
"the",
"set",
"of",
"envelopes",
... | 17ae82ace0f023e98edf813be832950568212e34 | https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/BulkEnvelopesApi.java#L144-L146 | train |
docusign/docusign-java-client | src/main/java/com/docusign/esign/api/BulkEnvelopesApi.java | BulkEnvelopesApi.getRecipients | public BulkRecipientsResponse getRecipients(String accountId, String envelopeId, String recipientId) throws ApiException {
return getRecipients(accountId, envelopeId, recipientId, null);
} | java | public BulkRecipientsResponse getRecipients(String accountId, String envelopeId, String recipientId) throws ApiException {
return getRecipients(accountId, envelopeId, recipientId, null);
} | [
"public",
"BulkRecipientsResponse",
"getRecipients",
"(",
"String",
"accountId",
",",
"String",
"envelopeId",
",",
"String",
"recipientId",
")",
"throws",
"ApiException",
"{",
"return",
"getRecipients",
"(",
"accountId",
",",
"envelopeId",
",",
"recipientId",
",",
"... | Gets the bulk recipient file from an envelope.
Retrieves the bulk recipient file information from an envelope that has a bulk recipient.
@param accountId The external account number (int) or account ID Guid. (required)
@param envelopeId The envelopeId Guid of the envelope being accessed. (required)
@param recipientId T... | [
"Gets",
"the",
"bulk",
"recipient",
"file",
"from",
"an",
"envelope",
".",
"Retrieves",
"the",
"bulk",
"recipient",
"file",
"information",
"from",
"an",
"envelope",
"that",
"has",
"a",
"bulk",
"recipient",
"."
] | 17ae82ace0f023e98edf813be832950568212e34 | https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/BulkEnvelopesApi.java#L239-L241 | train |
docusign/docusign-java-client | src/main/java/com/docusign/esign/api/EnvelopesApi.java | EnvelopesApi.getChunkedUpload | public ChunkedUploadResponse getChunkedUpload(String accountId, String chunkedUploadId) throws ApiException {
return getChunkedUpload(accountId, chunkedUploadId, null);
} | java | public ChunkedUploadResponse getChunkedUpload(String accountId, String chunkedUploadId) throws ApiException {
return getChunkedUpload(accountId, chunkedUploadId, null);
} | [
"public",
"ChunkedUploadResponse",
"getChunkedUpload",
"(",
"String",
"accountId",
",",
"String",
"chunkedUploadId",
")",
"throws",
"ApiException",
"{",
"return",
"getChunkedUpload",
"(",
"accountId",
",",
"chunkedUploadId",
",",
"null",
")",
";",
"}"
] | Retrieves the current metadata of a ChunkedUpload.
@param accountId The external account number (int) or account ID Guid. (required)
@param chunkedUploadId (required)
@return ChunkedUploadResponse | [
"Retrieves",
"the",
"current",
"metadata",
"of",
"a",
"ChunkedUpload",
"."
] | 17ae82ace0f023e98edf813be832950568212e34 | https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/EnvelopesApi.java#L1883-L1885 | train |
docusign/docusign-java-client | src/main/java/com/docusign/esign/api/EnvelopesApi.java | EnvelopesApi.getConsumerDisclosureDefault | public ConsumerDisclosure getConsumerDisclosureDefault(String accountId, String envelopeId, String recipientId) throws ApiException {
return getConsumerDisclosureDefault(accountId, envelopeId, recipientId, null);
} | java | public ConsumerDisclosure getConsumerDisclosureDefault(String accountId, String envelopeId, String recipientId) throws ApiException {
return getConsumerDisclosureDefault(accountId, envelopeId, recipientId, null);
} | [
"public",
"ConsumerDisclosure",
"getConsumerDisclosureDefault",
"(",
"String",
"accountId",
",",
"String",
"envelopeId",
",",
"String",
"recipientId",
")",
"throws",
"ApiException",
"{",
"return",
"getConsumerDisclosureDefault",
"(",
"accountId",
",",
"envelopeId",
",",
... | Gets the Electronic Record and Signature Disclosure associated with the account.
Retrieves the Electronic Record and Signature Disclosure, with html formatting, associated with the account. You can use an optional query string to set the language for the disclosure.
@param accountId The external account number (int) or... | [
"Gets",
"the",
"Electronic",
"Record",
"and",
"Signature",
"Disclosure",
"associated",
"with",
"the",
"account",
".",
"Retrieves",
"the",
"Electronic",
"Record",
"and",
"Signature",
"Disclosure",
"with",
"html",
"formatting",
"associated",
"with",
"the",
"account",
... | 17ae82ace0f023e98edf813be832950568212e34 | https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/EnvelopesApi.java#L2062-L2064 | train |
docusign/docusign-java-client | src/main/java/com/docusign/esign/api/EnvelopesApi.java | EnvelopesApi.getDocumentPageImage | public byte[] getDocumentPageImage(String accountId, String envelopeId, String documentId, String pageNumber) throws ApiException {
return getDocumentPageImage(accountId, envelopeId, documentId, pageNumber, null);
} | java | public byte[] getDocumentPageImage(String accountId, String envelopeId, String documentId, String pageNumber) throws ApiException {
return getDocumentPageImage(accountId, envelopeId, documentId, pageNumber, null);
} | [
"public",
"byte",
"[",
"]",
"getDocumentPageImage",
"(",
"String",
"accountId",
",",
"String",
"envelopeId",
",",
"String",
"documentId",
",",
"String",
"pageNumber",
")",
"throws",
"ApiException",
"{",
"return",
"getDocumentPageImage",
"(",
"accountId",
",",
"env... | Gets a page image from an envelope for display.
Retrieves a page image for display from the specified envelope.
@param accountId The external account number (int) or account ID Guid. (required)
@param envelopeId The envelopeId Guid of the envelope being accessed. (required)
@param documentId The ID of the document bein... | [
"Gets",
"a",
"page",
"image",
"from",
"an",
"envelope",
"for",
"display",
".",
"Retrieves",
"a",
"page",
"image",
"for",
"display",
"from",
"the",
"specified",
"envelope",
"."
] | 17ae82ace0f023e98edf813be832950568212e34 | https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/EnvelopesApi.java#L2346-L2348 | train |
docusign/docusign-java-client | src/main/java/com/docusign/esign/api/EnvelopesApi.java | EnvelopesApi.getEnvelope | public Envelope getEnvelope(String accountId, String envelopeId) throws ApiException {
return getEnvelope(accountId, envelopeId, null);
} | java | public Envelope getEnvelope(String accountId, String envelopeId) throws ApiException {
return getEnvelope(accountId, envelopeId, null);
} | [
"public",
"Envelope",
"getEnvelope",
"(",
"String",
"accountId",
",",
"String",
"envelopeId",
")",
"throws",
"ApiException",
"{",
"return",
"getEnvelope",
"(",
"accountId",
",",
"envelopeId",
",",
"null",
")",
";",
"}"
] | Gets the status of a envelope.
Retrieves the overall status for the specified envelope.
@param accountId The external account number (int) or account ID Guid. (required)
@param envelopeId The envelopeId Guid of the envelope being accessed. (required)
@return Envelope | [
"Gets",
"the",
"status",
"of",
"a",
"envelope",
".",
"Retrieves",
"the",
"overall",
"status",
"for",
"the",
"specified",
"envelope",
"."
] | 17ae82ace0f023e98edf813be832950568212e34 | https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/EnvelopesApi.java#L2594-L2596 | train |
docusign/docusign-java-client | src/main/java/com/docusign/esign/api/EnvelopesApi.java | EnvelopesApi.listTabs | public Tabs listTabs(String accountId, String envelopeId, String recipientId) throws ApiException {
return listTabs(accountId, envelopeId, recipientId, null);
} | java | public Tabs listTabs(String accountId, String envelopeId, String recipientId) throws ApiException {
return listTabs(accountId, envelopeId, recipientId, null);
} | [
"public",
"Tabs",
"listTabs",
"(",
"String",
"accountId",
",",
"String",
"envelopeId",
",",
"String",
"recipientId",
")",
"throws",
"ApiException",
"{",
"return",
"listTabs",
"(",
"accountId",
",",
"envelopeId",
",",
"recipientId",
",",
"null",
")",
";",
"}"
] | Gets the tabs information for a signer or sign-in-person recipient in an envelope.
Retrieves information about the tabs associated with a recipient in a draft envelope.
@param accountId The external account number (int) or account ID Guid. (required)
@param envelopeId The envelopeId Guid of the envelope being accessed.... | [
"Gets",
"the",
"tabs",
"information",
"for",
"a",
"signer",
"or",
"sign",
"-",
"in",
"-",
"person",
"recipient",
"in",
"an",
"envelope",
".",
"Retrieves",
"information",
"about",
"the",
"tabs",
"associated",
"with",
"a",
"recipient",
"in",
"a",
"draft",
"e... | 17ae82ace0f023e98edf813be832950568212e34 | https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/EnvelopesApi.java#L4255-L4257 | train |
docusign/docusign-java-client | src/main/java/com/docusign/esign/api/EnvelopesApi.java | EnvelopesApi.listTemplates | public TemplateInformation listTemplates(String accountId, String envelopeId) throws ApiException {
return listTemplates(accountId, envelopeId, null);
} | java | public TemplateInformation listTemplates(String accountId, String envelopeId) throws ApiException {
return listTemplates(accountId, envelopeId, null);
} | [
"public",
"TemplateInformation",
"listTemplates",
"(",
"String",
"accountId",
",",
"String",
"envelopeId",
")",
"throws",
"ApiException",
"{",
"return",
"listTemplates",
"(",
"accountId",
",",
"envelopeId",
",",
"null",
")",
";",
"}"
] | Get List of Templates used in an Envelope
This returns a list of the server-side templates, their name and ID, used in an envelope.
@param accountId The external account number (int) or account ID Guid. (required)
@param envelopeId The envelopeId Guid of the envelope being accessed. (required)
@return TemplateInformati... | [
"Get",
"List",
"of",
"Templates",
"used",
"in",
"an",
"Envelope",
"This",
"returns",
"a",
"list",
"of",
"the",
"server",
"-",
"side",
"templates",
"their",
"name",
"and",
"ID",
"used",
"in",
"an",
"envelope",
"."
] | 17ae82ace0f023e98edf813be832950568212e34 | https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/EnvelopesApi.java#L4344-L4346 | train |
docusign/docusign-java-client | src/main/java/com/docusign/esign/api/EnvelopesApi.java | EnvelopesApi.listTemplatesForDocument | public TemplateInformation listTemplatesForDocument(String accountId, String envelopeId, String documentId) throws ApiException {
return listTemplatesForDocument(accountId, envelopeId, documentId, null);
} | java | public TemplateInformation listTemplatesForDocument(String accountId, String envelopeId, String documentId) throws ApiException {
return listTemplatesForDocument(accountId, envelopeId, documentId, null);
} | [
"public",
"TemplateInformation",
"listTemplatesForDocument",
"(",
"String",
"accountId",
",",
"String",
"envelopeId",
",",
"String",
"documentId",
")",
"throws",
"ApiException",
"{",
"return",
"listTemplatesForDocument",
"(",
"accountId",
",",
"envelopeId",
",",
"docume... | Gets the templates associated with a document in an existing envelope.
Retrieves the templates associated with a document in the specified envelope.
@param accountId The external account number (int) or account ID Guid. (required)
@param envelopeId The envelopeId Guid of the envelope being accessed. (required)
@param d... | [
"Gets",
"the",
"templates",
"associated",
"with",
"a",
"document",
"in",
"an",
"existing",
"envelope",
".",
"Retrieves",
"the",
"templates",
"associated",
"with",
"a",
"document",
"in",
"the",
"specified",
"envelope",
"."
] | 17ae82ace0f023e98edf813be832950568212e34 | https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/EnvelopesApi.java#L4426-L4428 | train |
docusign/docusign-java-client | src/main/java/com/docusign/esign/api/EnvelopesApi.java | EnvelopesApi.updateChunkedUpload | public ChunkedUploadResponse updateChunkedUpload(String accountId, String chunkedUploadId) throws ApiException {
return updateChunkedUpload(accountId, chunkedUploadId, null);
} | java | public ChunkedUploadResponse updateChunkedUpload(String accountId, String chunkedUploadId) throws ApiException {
return updateChunkedUpload(accountId, chunkedUploadId, null);
} | [
"public",
"ChunkedUploadResponse",
"updateChunkedUpload",
"(",
"String",
"accountId",
",",
"String",
"chunkedUploadId",
")",
"throws",
"ApiException",
"{",
"return",
"updateChunkedUpload",
"(",
"accountId",
",",
"chunkedUploadId",
",",
"null",
")",
";",
"}"
] | Integrity-Check and Commit a ChunkedUpload, readying it for use elsewhere.
@param accountId The external account number (int) or account ID Guid. (required)
@param chunkedUploadId (required)
@return ChunkedUploadResponse | [
"Integrity",
"-",
"Check",
"and",
"Commit",
"a",
"ChunkedUpload",
"readying",
"it",
"for",
"use",
"elsewhere",
"."
] | 17ae82ace0f023e98edf813be832950568212e34 | https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/EnvelopesApi.java#L4782-L4784 | train |
docusign/docusign-java-client | src/main/java/com/docusign/esign/api/CommentsApi.java | CommentsApi.getCommentsTranscript | public byte[] getCommentsTranscript(String accountId, String envelopeId) throws ApiException {
return getCommentsTranscript(accountId, envelopeId, null);
} | java | public byte[] getCommentsTranscript(String accountId, String envelopeId) throws ApiException {
return getCommentsTranscript(accountId, envelopeId, null);
} | [
"public",
"byte",
"[",
"]",
"getCommentsTranscript",
"(",
"String",
"accountId",
",",
"String",
"envelopeId",
")",
"throws",
"ApiException",
"{",
"return",
"getCommentsTranscript",
"(",
"accountId",
",",
"envelopeId",
",",
"null",
")",
";",
"}"
] | Gets comment transcript for envelope and user
@param accountId The external account number (int) or account ID Guid. (required)
@param envelopeId The envelopeId Guid of the envelope being accessed. (required)
@return byte[] | [
"Gets",
"comment",
"transcript",
"for",
"envelope",
"and",
"user"
] | 17ae82ace0f023e98edf813be832950568212e34 | https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/CommentsApi.java#L59-L61 | train |
docusign/docusign-java-client | src/main/java/com/docusign/esign/client/ApiClient.java | ApiClient.registerAccessTokenListener | public void registerAccessTokenListener(AccessTokenListener accessTokenListener) {
for(Authentication auth : authentications.values()) {
if (auth instanceof OAuth) {
OAuth oauth = (OAuth) auth;
oauth.registerAccessTokenListener(accessTokenListener);
return;
}
}
} | java | public void registerAccessTokenListener(AccessTokenListener accessTokenListener) {
for(Authentication auth : authentications.values()) {
if (auth instanceof OAuth) {
OAuth oauth = (OAuth) auth;
oauth.registerAccessTokenListener(accessTokenListener);
return;
}
}
} | [
"public",
"void",
"registerAccessTokenListener",
"(",
"AccessTokenListener",
"accessTokenListener",
")",
"{",
"for",
"(",
"Authentication",
"auth",
":",
"authentications",
".",
"values",
"(",
")",
")",
"{",
"if",
"(",
"auth",
"instanceof",
"OAuth",
")",
"{",
"OA... | Configures a listener which is notified when a new access token is received.
@param accessTokenListener | [
"Configures",
"a",
"listener",
"which",
"is",
"notified",
"when",
"a",
"new",
"access",
"token",
"is",
"received",
"."
] | 17ae82ace0f023e98edf813be832950568212e34 | https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/client/ApiClient.java#L634-L642 | train |
docusign/docusign-java-client | src/main/java/com/docusign/esign/client/ApiClient.java | ApiClient.getXWWWFormUrlencodedParams | private String getXWWWFormUrlencodedParams(Map<String, Object> formParams) {
StringBuilder formParamBuilder = new StringBuilder();
for (Entry<String, Object> param : formParams.entrySet()) {
String valueStr = parameterToString(param.getValue());
try {
formParamBuilder.append(URLEncoder.enco... | java | private String getXWWWFormUrlencodedParams(Map<String, Object> formParams) {
StringBuilder formParamBuilder = new StringBuilder();
for (Entry<String, Object> param : formParams.entrySet()) {
String valueStr = parameterToString(param.getValue());
try {
formParamBuilder.append(URLEncoder.enco... | [
"private",
"String",
"getXWWWFormUrlencodedParams",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"formParams",
")",
"{",
"StringBuilder",
"formParamBuilder",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"for",
"(",
"Entry",
"<",
"String",
",",
"Object",
">",
... | Encode the given form parameters as request body. | [
"Encode",
"the",
"given",
"form",
"parameters",
"as",
"request",
"body",
"."
] | 17ae82ace0f023e98edf813be832950568212e34 | https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/client/ApiClient.java#L1105-L1126 | train |
docusign/docusign-java-client | src/main/java/com/docusign/esign/client/ApiClient.java | ApiClient.serializeToCsv | private <T> String serializeToCsv(T obj) {
if(obj == null) {
return "";
}
for (Method method: obj.getClass().getMethods()) {
if ("java.util.List".equals(method.getReturnType().getName())) {
try {
@SuppressWarnings("rawtypes")
java.util.List itemList = (java.util.List) me... | java | private <T> String serializeToCsv(T obj) {
if(obj == null) {
return "";
}
for (Method method: obj.getClass().getMethods()) {
if ("java.util.List".equals(method.getReturnType().getName())) {
try {
@SuppressWarnings("rawtypes")
java.util.List itemList = (java.util.List) me... | [
"private",
"<",
"T",
">",
"String",
"serializeToCsv",
"(",
"T",
"obj",
")",
"{",
"if",
"(",
"obj",
"==",
"null",
")",
"{",
"return",
"\"\"",
";",
"}",
"for",
"(",
"Method",
"method",
":",
"obj",
".",
"getClass",
"(",
")",
".",
"getMethods",
"(",
... | Encode the given request object in CSV format. | [
"Encode",
"the",
"given",
"request",
"object",
"in",
"CSV",
"format",
"."
] | 17ae82ace0f023e98edf813be832950568212e34 | https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/client/ApiClient.java#L1131-L1177 | train |
docusign/docusign-java-client | src/main/java/com/docusign/esign/api/TemplatesApi.java | TemplatesApi.createRecipients | public Recipients createRecipients(String accountId, String templateId, TemplateRecipients templateRecipients) throws ApiException {
return createRecipients(accountId, templateId, templateRecipients, null);
} | java | public Recipients createRecipients(String accountId, String templateId, TemplateRecipients templateRecipients) throws ApiException {
return createRecipients(accountId, templateId, templateRecipients, null);
} | [
"public",
"Recipients",
"createRecipients",
"(",
"String",
"accountId",
",",
"String",
"templateId",
",",
"TemplateRecipients",
"templateRecipients",
")",
"throws",
"ApiException",
"{",
"return",
"createRecipients",
"(",
"accountId",
",",
"templateId",
",",
"templateRec... | Adds tabs for a recipient.
Adds one or more recipients to a template.
@param accountId The external account number (int) or account ID Guid. (required)
@param templateId The ID of the template being accessed. (required)
@param templateRecipients (optional)
@return Recipients | [
"Adds",
"tabs",
"for",
"a",
"recipient",
".",
"Adds",
"one",
"or",
"more",
"recipients",
"to",
"a",
"template",
"."
] | 17ae82ace0f023e98edf813be832950568212e34 | https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/TemplatesApi.java#L302-L304 | train |
docusign/docusign-java-client | src/main/java/com/docusign/esign/api/TemplatesApi.java | TemplatesApi.get | public EnvelopeTemplate get(String accountId, String templateId) throws ApiException {
return get(accountId, templateId, null);
} | java | public EnvelopeTemplate get(String accountId, String templateId) throws ApiException {
return get(accountId, templateId, null);
} | [
"public",
"EnvelopeTemplate",
"get",
"(",
"String",
"accountId",
",",
"String",
"templateId",
")",
"throws",
"ApiException",
"{",
"return",
"get",
"(",
"accountId",
",",
"templateId",
",",
"null",
")",
";",
"}"
] | Gets a list of templates for a specified account.
Retrieves the definition of the specified template.
@param accountId The external account number (int) or account ID Guid. (required)
@param templateId The ID of the template being accessed. (required)
@return EnvelopeTemplate | [
"Gets",
"a",
"list",
"of",
"templates",
"for",
"a",
"specified",
"account",
".",
"Retrieves",
"the",
"definition",
"of",
"the",
"specified",
"template",
"."
] | 17ae82ace0f023e98edf813be832950568212e34 | https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/TemplatesApi.java#L1152-L1154 | train |
docusign/docusign-java-client | src/main/java/com/docusign/esign/api/TemplatesApi.java | TemplatesApi.getDocumentPageImage | public byte[] getDocumentPageImage(String accountId, String templateId, String documentId, String pageNumber) throws ApiException {
return getDocumentPageImage(accountId, templateId, documentId, pageNumber, null);
} | java | public byte[] getDocumentPageImage(String accountId, String templateId, String documentId, String pageNumber) throws ApiException {
return getDocumentPageImage(accountId, templateId, documentId, pageNumber, null);
} | [
"public",
"byte",
"[",
"]",
"getDocumentPageImage",
"(",
"String",
"accountId",
",",
"String",
"templateId",
",",
"String",
"documentId",
",",
"String",
"pageNumber",
")",
"throws",
"ApiException",
"{",
"return",
"getDocumentPageImage",
"(",
"accountId",
",",
"tem... | Gets a page image from a template for display.
Retrieves a page image for display from the specified template.
@param accountId The external account number (int) or account ID Guid. (required)
@param templateId The ID of the template being accessed. (required)
@param documentId The ID of the document being accessed. (r... | [
"Gets",
"a",
"page",
"image",
"from",
"a",
"template",
"for",
"display",
".",
"Retrieves",
"a",
"page",
"image",
"for",
"display",
"from",
"the",
"specified",
"template",
"."
] | 17ae82ace0f023e98edf813be832950568212e34 | https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/TemplatesApi.java#L1369-L1371 | train |
docusign/docusign-java-client | src/main/java/com/docusign/esign/api/TemplatesApi.java | TemplatesApi.listRecipients | public Recipients listRecipients(String accountId, String templateId) throws ApiException {
return listRecipients(accountId, templateId, null);
} | java | public Recipients listRecipients(String accountId, String templateId) throws ApiException {
return listRecipients(accountId, templateId, null);
} | [
"public",
"Recipients",
"listRecipients",
"(",
"String",
"accountId",
",",
"String",
"templateId",
")",
"throws",
"ApiException",
"{",
"return",
"listRecipients",
"(",
"accountId",
",",
"templateId",
",",
"null",
")",
";",
"}"
] | Gets recipient information from a template.
Retrieves the information for all recipients in the specified template.
@param accountId The external account number (int) or account ID Guid. (required)
@param templateId The ID of the template being accessed. (required)
@return Recipients | [
"Gets",
"recipient",
"information",
"from",
"a",
"template",
".",
"Retrieves",
"the",
"information",
"for",
"all",
"recipients",
"in",
"the",
"specified",
"template",
"."
] | 17ae82ace0f023e98edf813be832950568212e34 | https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/TemplatesApi.java#L2268-L2270 | train |
docusign/docusign-java-client | src/main/java/com/docusign/esign/api/TemplatesApi.java | TemplatesApi.listTabs | public Tabs listTabs(String accountId, String templateId, String recipientId) throws ApiException {
return listTabs(accountId, templateId, recipientId, null);
} | java | public Tabs listTabs(String accountId, String templateId, String recipientId) throws ApiException {
return listTabs(accountId, templateId, recipientId, null);
} | [
"public",
"Tabs",
"listTabs",
"(",
"String",
"accountId",
",",
"String",
"templateId",
",",
"String",
"recipientId",
")",
"throws",
"ApiException",
"{",
"return",
"listTabs",
"(",
"accountId",
",",
"templateId",
",",
"recipientId",
",",
"null",
")",
";",
"}"
] | Gets the tabs information for a signer or sign-in-person recipient in a template.
Gets the tabs information for a signer or sign-in-person recipient in a template.
@param accountId The external account number (int) or account ID Guid. (required)
@param templateId The ID of the template being accessed. (required)
@param... | [
"Gets",
"the",
"tabs",
"information",
"for",
"a",
"signer",
"or",
"sign",
"-",
"in",
"-",
"person",
"recipient",
"in",
"a",
"template",
".",
"Gets",
"the",
"tabs",
"information",
"for",
"a",
"signer",
"or",
"sign",
"-",
"in",
"-",
"person",
"recipient",
... | 17ae82ace0f023e98edf813be832950568212e34 | https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/TemplatesApi.java#L2363-L2365 | train |
docusign/docusign-java-client | src/main/java/com/docusign/esign/api/TemplatesApi.java | TemplatesApi.updateDocument | public EnvelopeDocument updateDocument(String accountId, String templateId, String documentId, EnvelopeDefinition envelopeDefinition) throws ApiException {
return updateDocument(accountId, templateId, documentId, envelopeDefinition, null);
} | java | public EnvelopeDocument updateDocument(String accountId, String templateId, String documentId, EnvelopeDefinition envelopeDefinition) throws ApiException {
return updateDocument(accountId, templateId, documentId, envelopeDefinition, null);
} | [
"public",
"EnvelopeDocument",
"updateDocument",
"(",
"String",
"accountId",
",",
"String",
"templateId",
",",
"String",
"documentId",
",",
"EnvelopeDefinition",
"envelopeDefinition",
")",
"throws",
"ApiException",
"{",
"return",
"updateDocument",
"(",
"accountId",
",",
... | Adds a document to a template document.
Adds the specified document to an existing template document.
@param accountId The external account number (int) or account ID Guid. (required)
@param templateId The ID of the template being accessed. (required)
@param documentId The ID of the document being accessed. (required)
... | [
"Adds",
"a",
"document",
"to",
"a",
"template",
"document",
".",
"Adds",
"the",
"specified",
"document",
"to",
"an",
"existing",
"template",
"document",
"."
] | 17ae82ace0f023e98edf813be832950568212e34 | https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/TemplatesApi.java#L2954-L2956 | train |
docusign/docusign-java-client | src/main/java/com/docusign/esign/api/TemplatesApi.java | TemplatesApi.updateDocuments | public TemplateDocumentsResult updateDocuments(String accountId, String templateId, EnvelopeDefinition envelopeDefinition) throws ApiException {
return updateDocuments(accountId, templateId, envelopeDefinition, null);
} | java | public TemplateDocumentsResult updateDocuments(String accountId, String templateId, EnvelopeDefinition envelopeDefinition) throws ApiException {
return updateDocuments(accountId, templateId, envelopeDefinition, null);
} | [
"public",
"TemplateDocumentsResult",
"updateDocuments",
"(",
"String",
"accountId",
",",
"String",
"templateId",
",",
"EnvelopeDefinition",
"envelopeDefinition",
")",
"throws",
"ApiException",
"{",
"return",
"updateDocuments",
"(",
"accountId",
",",
"templateId",
",",
"... | Adds documents to a template document.
Adds one or more documents to an existing template document.
@param accountId The external account number (int) or account ID Guid. (required)
@param templateId The ID of the template being accessed. (required)
@param envelopeDefinition (optional)
@return TemplateDocumentsResult | [
"Adds",
"documents",
"to",
"a",
"template",
"document",
".",
"Adds",
"one",
"or",
"more",
"documents",
"to",
"an",
"existing",
"template",
"document",
"."
] | 17ae82ace0f023e98edf813be832950568212e34 | https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/TemplatesApi.java#L3114-L3116 | train |
docusign/docusign-java-client | src/main/java/com/docusign/esign/api/NotaryApi.java | NotaryApi.listNotaryJournals | public NotaryJournalList listNotaryJournals(NotaryApi.ListNotaryJournalsOptions options) throws ApiException {
Object localVarPostBody = "{}";
// create path and map variables
String localVarPath = "/v2/current_user/notary/journals".replaceAll("\\{format\\}","json");
// query params
java.util.... | java | public NotaryJournalList listNotaryJournals(NotaryApi.ListNotaryJournalsOptions options) throws ApiException {
Object localVarPostBody = "{}";
// create path and map variables
String localVarPath = "/v2/current_user/notary/journals".replaceAll("\\{format\\}","json");
// query params
java.util.... | [
"public",
"NotaryJournalList",
"listNotaryJournals",
"(",
"NotaryApi",
".",
"ListNotaryJournalsOptions",
"options",
")",
"throws",
"ApiException",
"{",
"Object",
"localVarPostBody",
"=",
"\"{}\"",
";",
"// create path and map variables",
"String",
"localVarPath",
"=",
"\"/v... | Get notary jurisdictions for a user
@param options for modifying the method behavior.
@return NotaryJournalList
@throws ApiException if fails to make API call | [
"Get",
"notary",
"jurisdictions",
"for",
"a",
"user"
] | 17ae82ace0f023e98edf813be832950568212e34 | https://github.com/docusign/docusign-java-client/blob/17ae82ace0f023e98edf813be832950568212e34/src/main/java/com/docusign/esign/api/NotaryApi.java#L91-L123 | train |
hsiafan/requests | src/main/java/net/dongliu/requests/utils/Cookies.java | Cookies.calculatePath | public static String calculatePath(String uri) {
if (!uri.startsWith("/")) {
return "/";
}
int idx = uri.lastIndexOf('/');
return uri.substring(0, idx + 1);
} | java | public static String calculatePath(String uri) {
if (!uri.startsWith("/")) {
return "/";
}
int idx = uri.lastIndexOf('/');
return uri.substring(0, idx + 1);
} | [
"public",
"static",
"String",
"calculatePath",
"(",
"String",
"uri",
")",
"{",
"if",
"(",
"!",
"uri",
".",
"startsWith",
"(",
"\"/\"",
")",
")",
"{",
"return",
"\"/\"",
";",
"}",
"int",
"idx",
"=",
"uri",
".",
"lastIndexOf",
"(",
"'",
"'",
")",
";"... | Get cookie default path from url path | [
"Get",
"cookie",
"default",
"path",
"from",
"url",
"path"
] | a6cc6f8293e808cc937d3789aec2616a8383dee0 | https://github.com/hsiafan/requests/blob/a6cc6f8293e808cc937d3789aec2616a8383dee0/src/main/java/net/dongliu/requests/utils/Cookies.java#L27-L33 | train |
hsiafan/requests | src/main/java/net/dongliu/requests/utils/Cookies.java | Cookies.isDomainSuffix | public static boolean isDomainSuffix(String domain, String domainSuffix) {
if (domain.length() < domainSuffix.length()) {
return false;
}
if (domain.length() == domainSuffix.length()) {
return domain.equals(domainSuffix);
}
return domain.endsWith(domainSu... | java | public static boolean isDomainSuffix(String domain, String domainSuffix) {
if (domain.length() < domainSuffix.length()) {
return false;
}
if (domain.length() == domainSuffix.length()) {
return domain.equals(domainSuffix);
}
return domain.endsWith(domainSu... | [
"public",
"static",
"boolean",
"isDomainSuffix",
"(",
"String",
"domain",
",",
"String",
"domainSuffix",
")",
"{",
"if",
"(",
"domain",
".",
"length",
"(",
")",
"<",
"domainSuffix",
".",
"length",
"(",
")",
")",
"{",
"return",
"false",
";",
"}",
"if",
... | If domainSuffix is suffix of domain
@param domain start with "."
@param domainSuffix not start with "." | [
"If",
"domainSuffix",
"is",
"suffix",
"of",
"domain"
] | a6cc6f8293e808cc937d3789aec2616a8383dee0 | https://github.com/hsiafan/requests/blob/a6cc6f8293e808cc937d3789aec2616a8383dee0/src/main/java/net/dongliu/requests/utils/Cookies.java#L95-L104 | train |
hsiafan/requests | src/main/java/net/dongliu/requests/utils/Cookies.java | Cookies.match | public static boolean match(Cookie cookie, String protocol, String host, String path) {
if (cookie.secure() && !protocol.equalsIgnoreCase("https")) {
return false;
}
// check domain
if (isIP(host) || cookie.hostOnly()) {
if (!host.equals(cookie.domain())) {
... | java | public static boolean match(Cookie cookie, String protocol, String host, String path) {
if (cookie.secure() && !protocol.equalsIgnoreCase("https")) {
return false;
}
// check domain
if (isIP(host) || cookie.hostOnly()) {
if (!host.equals(cookie.domain())) {
... | [
"public",
"static",
"boolean",
"match",
"(",
"Cookie",
"cookie",
",",
"String",
"protocol",
",",
"String",
"host",
",",
"String",
"path",
")",
"{",
"if",
"(",
"cookie",
".",
"secure",
"(",
")",
"&&",
"!",
"protocol",
".",
"equalsIgnoreCase",
"(",
"\"http... | If cookie match the given scheme, host, and path.
@param host should be lower case | [
"If",
"cookie",
"match",
"the",
"given",
"scheme",
"host",
"and",
"path",
"."
] | a6cc6f8293e808cc937d3789aec2616a8383dee0 | https://github.com/hsiafan/requests/blob/a6cc6f8293e808cc937d3789aec2616a8383dee0/src/main/java/net/dongliu/requests/utils/Cookies.java#L112-L143 | train |
hsiafan/requests | src/main/java/net/dongliu/requests/utils/Cookies.java | Cookies.parseCookie | @Nullable
public static Cookie parseCookie(String cookieStr, String host, String defaultPath) {
String[] items = cookieStr.split(";");
Parameter<String> param = parseCookieNameValue(items[0]);
if (param == null) {
return null;
}
String domain = "";
String... | java | @Nullable
public static Cookie parseCookie(String cookieStr, String host, String defaultPath) {
String[] items = cookieStr.split(";");
Parameter<String> param = parseCookieNameValue(items[0]);
if (param == null) {
return null;
}
String domain = "";
String... | [
"@",
"Nullable",
"public",
"static",
"Cookie",
"parseCookie",
"(",
"String",
"cookieStr",
",",
"String",
"host",
",",
"String",
"defaultPath",
")",
"{",
"String",
"[",
"]",
"items",
"=",
"cookieStr",
".",
"split",
"(",
"\";\"",
")",
";",
"Parameter",
"<",
... | Parse one cookie header value, return the cookie.
@param host should be lower case
@return return null means is not a valid cookie str. | [
"Parse",
"one",
"cookie",
"header",
"value",
"return",
"the",
"cookie",
"."
] | a6cc6f8293e808cc937d3789aec2616a8383dee0 | https://github.com/hsiafan/requests/blob/a6cc6f8293e808cc937d3789aec2616a8383dee0/src/main/java/net/dongliu/requests/utils/Cookies.java#L151-L228 | train |
hsiafan/requests | src/main/java/net/dongliu/requests/utils/Cookies.java | Cookies.normalizeDomain | private static String normalizeDomain(String value) {
if (value.startsWith(".")) {
return value.substring(1);
}
return value.toLowerCase();
} | java | private static String normalizeDomain(String value) {
if (value.startsWith(".")) {
return value.substring(1);
}
return value.toLowerCase();
} | [
"private",
"static",
"String",
"normalizeDomain",
"(",
"String",
"value",
")",
"{",
"if",
"(",
"value",
".",
"startsWith",
"(",
"\".\"",
")",
")",
"{",
"return",
"value",
".",
"substring",
"(",
"1",
")",
";",
"}",
"return",
"value",
".",
"toLowerCase",
... | Parse cookie domain.
In RFC 6265, the leading dot will be ignored, and cookie always available in sub domains.
@return the final domain | [
"Parse",
"cookie",
"domain",
".",
"In",
"RFC",
"6265",
"the",
"leading",
"dot",
"will",
"be",
"ignored",
"and",
"cookie",
"always",
"available",
"in",
"sub",
"domains",
"."
] | a6cc6f8293e808cc937d3789aec2616a8383dee0 | https://github.com/hsiafan/requests/blob/a6cc6f8293e808cc937d3789aec2616a8383dee0/src/main/java/net/dongliu/requests/utils/Cookies.java#L266-L271 | train |
hsiafan/requests | src/main/java/net/dongliu/requests/Proxies.java | Proxies.httpProxy | public static Proxy httpProxy(String host, int port) {
return new Proxy(Proxy.Type.HTTP, new InetSocketAddress(Objects.requireNonNull(host), port));
} | java | public static Proxy httpProxy(String host, int port) {
return new Proxy(Proxy.Type.HTTP, new InetSocketAddress(Objects.requireNonNull(host), port));
} | [
"public",
"static",
"Proxy",
"httpProxy",
"(",
"String",
"host",
",",
"int",
"port",
")",
"{",
"return",
"new",
"Proxy",
"(",
"Proxy",
".",
"Type",
".",
"HTTP",
",",
"new",
"InetSocketAddress",
"(",
"Objects",
".",
"requireNonNull",
"(",
"host",
")",
","... | Create http proxy | [
"Create",
"http",
"proxy"
] | a6cc6f8293e808cc937d3789aec2616a8383dee0 | https://github.com/hsiafan/requests/blob/a6cc6f8293e808cc937d3789aec2616a8383dee0/src/main/java/net/dongliu/requests/Proxies.java#L16-L18 | train |
hsiafan/requests | src/main/java/net/dongliu/requests/Proxies.java | Proxies.socksProxy | public static Proxy socksProxy(String host, int port) {
return new Proxy(Proxy.Type.SOCKS, new InetSocketAddress(Objects.requireNonNull(host), port));
} | java | public static Proxy socksProxy(String host, int port) {
return new Proxy(Proxy.Type.SOCKS, new InetSocketAddress(Objects.requireNonNull(host), port));
} | [
"public",
"static",
"Proxy",
"socksProxy",
"(",
"String",
"host",
",",
"int",
"port",
")",
"{",
"return",
"new",
"Proxy",
"(",
"Proxy",
".",
"Type",
".",
"SOCKS",
",",
"new",
"InetSocketAddress",
"(",
"Objects",
".",
"requireNonNull",
"(",
"host",
")",
"... | Create socks5 proxy | [
"Create",
"socks5",
"proxy"
] | a6cc6f8293e808cc937d3789aec2616a8383dee0 | https://github.com/hsiafan/requests/blob/a6cc6f8293e808cc937d3789aec2616a8383dee0/src/main/java/net/dongliu/requests/Proxies.java#L33-L35 | train |
hsiafan/requests | src/main/java/net/dongliu/requests/Requests.java | Requests.newRequest | public static RequestBuilder newRequest(String method, String url) {
return new RequestBuilder().method(method).url(url);
} | java | public static RequestBuilder newRequest(String method, String url) {
return new RequestBuilder().method(method).url(url);
} | [
"public",
"static",
"RequestBuilder",
"newRequest",
"(",
"String",
"method",
",",
"String",
"url",
")",
"{",
"return",
"new",
"RequestBuilder",
"(",
")",
".",
"method",
"(",
"method",
")",
".",
"url",
"(",
"url",
")",
";",
"}"
] | Create new request with method and url | [
"Create",
"new",
"request",
"with",
"method",
"and",
"url"
] | a6cc6f8293e808cc937d3789aec2616a8383dee0 | https://github.com/hsiafan/requests/blob/a6cc6f8293e808cc937d3789aec2616a8383dee0/src/main/java/net/dongliu/requests/Requests.java#L91-L93 | train |
hsiafan/requests | src/main/java/net/dongliu/requests/RequestBuilder.java | RequestBuilder.headers | @SafeVarargs
public final RequestBuilder headers(Map.Entry<String, ?>... headers) {
headers(Lists.of(headers));
return this;
} | java | @SafeVarargs
public final RequestBuilder headers(Map.Entry<String, ?>... headers) {
headers(Lists.of(headers));
return this;
} | [
"@",
"SafeVarargs",
"public",
"final",
"RequestBuilder",
"headers",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"?",
">",
"...",
"headers",
")",
"{",
"headers",
"(",
"Lists",
".",
"of",
"(",
"headers",
")",
")",
";",
"return",
"this",
";",
"}"
] | Set request headers. | [
"Set",
"request",
"headers",
"."
] | a6cc6f8293e808cc937d3789aec2616a8383dee0 | https://github.com/hsiafan/requests/blob/a6cc6f8293e808cc937d3789aec2616a8383dee0/src/main/java/net/dongliu/requests/RequestBuilder.java#L109-L113 | train |
hsiafan/requests | src/main/java/net/dongliu/requests/RequestBuilder.java | RequestBuilder.cookies | @SafeVarargs
public final RequestBuilder cookies(Map.Entry<String, ?>... cookies) {
cookies(Lists.of(cookies));
return this;
} | java | @SafeVarargs
public final RequestBuilder cookies(Map.Entry<String, ?>... cookies) {
cookies(Lists.of(cookies));
return this;
} | [
"@",
"SafeVarargs",
"public",
"final",
"RequestBuilder",
"cookies",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"?",
">",
"...",
"cookies",
")",
"{",
"cookies",
"(",
"Lists",
".",
"of",
"(",
"cookies",
")",
")",
";",
"return",
"this",
";",
"}"
] | Set request cookies. | [
"Set",
"request",
"cookies",
"."
] | a6cc6f8293e808cc937d3789aec2616a8383dee0 | https://github.com/hsiafan/requests/blob/a6cc6f8293e808cc937d3789aec2616a8383dee0/src/main/java/net/dongliu/requests/RequestBuilder.java#L134-L138 | train |
hsiafan/requests | src/main/java/net/dongliu/requests/RequestBuilder.java | RequestBuilder.params | @SafeVarargs
public final RequestBuilder params(Map.Entry<String, ?>... params) {
this.params = Lists.of(params);
return this;
} | java | @SafeVarargs
public final RequestBuilder params(Map.Entry<String, ?>... params) {
this.params = Lists.of(params);
return this;
} | [
"@",
"SafeVarargs",
"public",
"final",
"RequestBuilder",
"params",
"(",
"Map",
".",
"Entry",
"<",
"String",
",",
"?",
">",
"...",
"params",
")",
"{",
"this",
".",
"params",
"=",
"Lists",
".",
"of",
"(",
"params",
")",
";",
"return",
"this",
";",
"}"
... | Set url query params. | [
"Set",
"url",
"query",
"params",
"."
] | a6cc6f8293e808cc937d3789aec2616a8383dee0 | https://github.com/hsiafan/requests/blob/a6cc6f8293e808cc937d3789aec2616a8383dee0/src/main/java/net/dongliu/requests/RequestBuilder.java#L164-L168 | train |
hsiafan/requests | src/main/java/net/dongliu/requests/RequestBuilder.java | RequestBuilder.send | public RawResponse send() {
Request request = build();
RequestExecutorFactory factory = RequestExecutorFactory.getInstance();
HttpExecutor executor = factory.getHttpExecutor();
return new InterceptorChain(interceptors, executor).proceed(request);
} | java | public RawResponse send() {
Request request = build();
RequestExecutorFactory factory = RequestExecutorFactory.getInstance();
HttpExecutor executor = factory.getHttpExecutor();
return new InterceptorChain(interceptors, executor).proceed(request);
} | [
"public",
"RawResponse",
"send",
"(",
")",
"{",
"Request",
"request",
"=",
"build",
"(",
")",
";",
"RequestExecutorFactory",
"factory",
"=",
"RequestExecutorFactory",
".",
"getInstance",
"(",
")",
";",
"HttpExecutor",
"executor",
"=",
"factory",
".",
"getHttpExe... | build http request, and send out | [
"build",
"http",
"request",
"and",
"send",
"out"
] | a6cc6f8293e808cc937d3789aec2616a8383dee0 | https://github.com/hsiafan/requests/blob/a6cc6f8293e808cc937d3789aec2616a8383dee0/src/main/java/net/dongliu/requests/RequestBuilder.java#L405-L410 | train |
hsiafan/requests | src/main/java/net/dongliu/requests/body/Part.java | Part.contentType | public Part<T> contentType(String contentType) {
requireNonNull(contentType);
return new Part<>(name, fileName, body, contentType, charset, partWriter);
} | java | public Part<T> contentType(String contentType) {
requireNonNull(contentType);
return new Part<>(name, fileName, body, contentType, charset, partWriter);
} | [
"public",
"Part",
"<",
"T",
">",
"contentType",
"(",
"String",
"contentType",
")",
"{",
"requireNonNull",
"(",
"contentType",
")",
";",
"return",
"new",
"Part",
"<>",
"(",
"name",
",",
"fileName",
",",
"body",
",",
"contentType",
",",
"charset",
",",
"pa... | Set content type for this part. | [
"Set",
"content",
"type",
"for",
"this",
"part",
"."
] | a6cc6f8293e808cc937d3789aec2616a8383dee0 | https://github.com/hsiafan/requests/blob/a6cc6f8293e808cc937d3789aec2616a8383dee0/src/main/java/net/dongliu/requests/body/Part.java#L65-L68 | train |
hsiafan/requests | src/main/java/net/dongliu/requests/body/Part.java | Part.charset | public Part<T> charset(Charset charset) {
requireNonNull(charset);
return new Part<>(name, fileName, body, contentType, charset, partWriter);
} | java | public Part<T> charset(Charset charset) {
requireNonNull(charset);
return new Part<>(name, fileName, body, contentType, charset, partWriter);
} | [
"public",
"Part",
"<",
"T",
">",
"charset",
"(",
"Charset",
"charset",
")",
"{",
"requireNonNull",
"(",
"charset",
")",
";",
"return",
"new",
"Part",
"<>",
"(",
"name",
",",
"fileName",
",",
"body",
",",
"contentType",
",",
"charset",
",",
"partWriter",
... | The charset of this part's content. Each part of MultiPart body can has it's own charset set.
Default not set.
@param charset the charset
@return self | [
"The",
"charset",
"of",
"this",
"part",
"s",
"content",
".",
"Each",
"part",
"of",
"MultiPart",
"body",
"can",
"has",
"it",
"s",
"own",
"charset",
"set",
".",
"Default",
"not",
"set",
"."
] | a6cc6f8293e808cc937d3789aec2616a8383dee0 | https://github.com/hsiafan/requests/blob/a6cc6f8293e808cc937d3789aec2616a8383dee0/src/main/java/net/dongliu/requests/body/Part.java#L77-L80 | train |
hsiafan/requests | src/main/java/net/dongliu/requests/utils/URLUtils.java | URLUtils.encodeForm | public static String encodeForm(Parameter<String> query, Charset charset) {
try {
return URLEncoder.encode(query.name(), charset.name()) + "=" + URLEncoder.encode(query.value(),
charset.name());
} catch (UnsupportedEncodingException e) {
// should not happen
... | java | public static String encodeForm(Parameter<String> query, Charset charset) {
try {
return URLEncoder.encode(query.name(), charset.name()) + "=" + URLEncoder.encode(query.value(),
charset.name());
} catch (UnsupportedEncodingException e) {
// should not happen
... | [
"public",
"static",
"String",
"encodeForm",
"(",
"Parameter",
"<",
"String",
">",
"query",
",",
"Charset",
"charset",
")",
"{",
"try",
"{",
"return",
"URLEncoder",
".",
"encode",
"(",
"query",
".",
"name",
"(",
")",
",",
"charset",
".",
"name",
"(",
")... | Encode key-value form parameter | [
"Encode",
"key",
"-",
"value",
"form",
"parameter"
] | a6cc6f8293e808cc937d3789aec2616a8383dee0 | https://github.com/hsiafan/requests/blob/a6cc6f8293e808cc937d3789aec2616a8383dee0/src/main/java/net/dongliu/requests/utils/URLUtils.java#L25-L33 | train |
hsiafan/requests | src/main/java/net/dongliu/requests/utils/URLUtils.java | URLUtils.encodeForms | public static String encodeForms(Collection<? extends Parameter<String>> queries, Charset charset) {
StringBuilder sb = new StringBuilder();
try {
for (Parameter<String> query : queries) {
sb.append(URLEncoder.encode(query.name(), charset.name()));
sb.append('... | java | public static String encodeForms(Collection<? extends Parameter<String>> queries, Charset charset) {
StringBuilder sb = new StringBuilder();
try {
for (Parameter<String> query : queries) {
sb.append(URLEncoder.encode(query.name(), charset.name()));
sb.append('... | [
"public",
"static",
"String",
"encodeForms",
"(",
"Collection",
"<",
"?",
"extends",
"Parameter",
"<",
"String",
">",
">",
"queries",
",",
"Charset",
"charset",
")",
"{",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"try",
"{",
"for",... | Encode multi form parameters | [
"Encode",
"multi",
"form",
"parameters"
] | a6cc6f8293e808cc937d3789aec2616a8383dee0 | https://github.com/hsiafan/requests/blob/a6cc6f8293e808cc937d3789aec2616a8383dee0/src/main/java/net/dongliu/requests/utils/URLUtils.java#L38-L55 | train |
hsiafan/requests | src/main/java/net/dongliu/requests/utils/URLUtils.java | URLUtils.decodeForm | public static Parameter<String> decodeForm(String s, Charset charset) {
int idx = s.indexOf("=");
try {
if (idx < 0) {
return Parameter.of("", URLDecoder.decode(s, charset.name()));
}
return Parameter.of(URLDecoder.decode(s.substring(0, idx), charset.n... | java | public static Parameter<String> decodeForm(String s, Charset charset) {
int idx = s.indexOf("=");
try {
if (idx < 0) {
return Parameter.of("", URLDecoder.decode(s, charset.name()));
}
return Parameter.of(URLDecoder.decode(s.substring(0, idx), charset.n... | [
"public",
"static",
"Parameter",
"<",
"String",
">",
"decodeForm",
"(",
"String",
"s",
",",
"Charset",
"charset",
")",
"{",
"int",
"idx",
"=",
"s",
".",
"indexOf",
"(",
"\"=\"",
")",
";",
"try",
"{",
"if",
"(",
"idx",
"<",
"0",
")",
"{",
"return",
... | Decode key-value query parameter | [
"Decode",
"key",
"-",
"value",
"query",
"parameter"
] | a6cc6f8293e808cc937d3789aec2616a8383dee0 | https://github.com/hsiafan/requests/blob/a6cc6f8293e808cc937d3789aec2616a8383dee0/src/main/java/net/dongliu/requests/utils/URLUtils.java#L60-L72 | train |
hsiafan/requests | src/main/java/net/dongliu/requests/utils/URLUtils.java | URLUtils.decodeForms | public static List<Parameter<String>> decodeForms(String queryStr, Charset charset) {
String[] queries = queryStr.split("&");
List<Parameter<String>> list = new ArrayList<>(queries.length);
for (String query : queries) {
list.add(decodeForm(query, charset));
}
return... | java | public static List<Parameter<String>> decodeForms(String queryStr, Charset charset) {
String[] queries = queryStr.split("&");
List<Parameter<String>> list = new ArrayList<>(queries.length);
for (String query : queries) {
list.add(decodeForm(query, charset));
}
return... | [
"public",
"static",
"List",
"<",
"Parameter",
"<",
"String",
">",
">",
"decodeForms",
"(",
"String",
"queryStr",
",",
"Charset",
"charset",
")",
"{",
"String",
"[",
"]",
"queries",
"=",
"queryStr",
".",
"split",
"(",
"\"&\"",
")",
";",
"List",
"<",
"Pa... | Parse query params | [
"Parse",
"query",
"params"
] | a6cc6f8293e808cc937d3789aec2616a8383dee0 | https://github.com/hsiafan/requests/blob/a6cc6f8293e808cc937d3789aec2616a8383dee0/src/main/java/net/dongliu/requests/utils/URLUtils.java#L77-L85 | train |
hsiafan/requests | src/main/java/net/dongliu/requests/AbstractResponse.java | AbstractResponse.getCookie | @Nullable
public Cookie getCookie(String name) {
for (Cookie cookie : cookies) {
if (cookie.name().equals(name)) {
return cookie;
}
}
return null;
} | java | @Nullable
public Cookie getCookie(String name) {
for (Cookie cookie : cookies) {
if (cookie.name().equals(name)) {
return cookie;
}
}
return null;
} | [
"@",
"Nullable",
"public",
"Cookie",
"getCookie",
"(",
"String",
"name",
")",
"{",
"for",
"(",
"Cookie",
"cookie",
":",
"cookies",
")",
"{",
"if",
"(",
"cookie",
".",
"name",
"(",
")",
".",
"equals",
"(",
"name",
")",
")",
"{",
"return",
"cookie",
... | Get first cookie match the name returned by this response, return null if not found | [
"Get",
"first",
"cookie",
"match",
"the",
"name",
"returned",
"by",
"this",
"response",
"return",
"null",
"if",
"not",
"found"
] | a6cc6f8293e808cc937d3789aec2616a8383dee0 | https://github.com/hsiafan/requests/blob/a6cc6f8293e808cc937d3789aec2616a8383dee0/src/main/java/net/dongliu/requests/AbstractResponse.java#L105-L113 | train |
hsiafan/requests | src/main/java/net/dongliu/requests/json/GsonProcessor.java | GsonProcessor.registerAllTypeFactories | private static void registerAllTypeFactories(GsonBuilder gsonBuilder) {
ServiceLoader<TypeAdapterFactory> loader = ServiceLoader.load(TypeAdapterFactory.class);
for (TypeAdapterFactory typeFactory : loader) {
if (logger.isLoggable(Level.FINE)) {
logger.fine("Add gson type fac... | java | private static void registerAllTypeFactories(GsonBuilder gsonBuilder) {
ServiceLoader<TypeAdapterFactory> loader = ServiceLoader.load(TypeAdapterFactory.class);
for (TypeAdapterFactory typeFactory : loader) {
if (logger.isLoggable(Level.FINE)) {
logger.fine("Add gson type fac... | [
"private",
"static",
"void",
"registerAllTypeFactories",
"(",
"GsonBuilder",
"gsonBuilder",
")",
"{",
"ServiceLoader",
"<",
"TypeAdapterFactory",
">",
"loader",
"=",
"ServiceLoader",
".",
"load",
"(",
"TypeAdapterFactory",
".",
"class",
")",
";",
"for",
"(",
"Type... | Find and register all gson type factory using spi | [
"Find",
"and",
"register",
"all",
"gson",
"type",
"factory",
"using",
"spi"
] | a6cc6f8293e808cc937d3789aec2616a8383dee0 | https://github.com/hsiafan/requests/blob/a6cc6f8293e808cc937d3789aec2616a8383dee0/src/main/java/net/dongliu/requests/json/GsonProcessor.java#L36-L44 | train |
hsiafan/requests | src/main/java/net/dongliu/requests/KeyStores.java | KeyStores.load | public static KeyStore load(String path, char[] password) {
try {
return load(new FileInputStream(path), password);
} catch (FileNotFoundException e) {
throw new TrustManagerLoadFailedException(e);
}
} | java | public static KeyStore load(String path, char[] password) {
try {
return load(new FileInputStream(path), password);
} catch (FileNotFoundException e) {
throw new TrustManagerLoadFailedException(e);
}
} | [
"public",
"static",
"KeyStore",
"load",
"(",
"String",
"path",
",",
"char",
"[",
"]",
"password",
")",
"{",
"try",
"{",
"return",
"load",
"(",
"new",
"FileInputStream",
"(",
"path",
")",
",",
"password",
")",
";",
"}",
"catch",
"(",
"FileNotFoundExceptio... | Load keystore from file. | [
"Load",
"keystore",
"from",
"file",
"."
] | a6cc6f8293e808cc937d3789aec2616a8383dee0 | https://github.com/hsiafan/requests/blob/a6cc6f8293e808cc937d3789aec2616a8383dee0/src/main/java/net/dongliu/requests/KeyStores.java#L20-L26 | train |
hsiafan/requests | src/main/java/net/dongliu/requests/KeyStores.java | KeyStores.load | public static KeyStore load(InputStream in, char[] password) {
try {
KeyStore myTrustStore = KeyStore.getInstance(KeyStore.getDefaultType());
myTrustStore.load(in, password);
return myTrustStore;
} catch (CertificateException | NoSuchAlgorithmException | KeyStoreExce... | java | public static KeyStore load(InputStream in, char[] password) {
try {
KeyStore myTrustStore = KeyStore.getInstance(KeyStore.getDefaultType());
myTrustStore.load(in, password);
return myTrustStore;
} catch (CertificateException | NoSuchAlgorithmException | KeyStoreExce... | [
"public",
"static",
"KeyStore",
"load",
"(",
"InputStream",
"in",
",",
"char",
"[",
"]",
"password",
")",
"{",
"try",
"{",
"KeyStore",
"myTrustStore",
"=",
"KeyStore",
".",
"getInstance",
"(",
"KeyStore",
".",
"getDefaultType",
"(",
")",
")",
";",
"myTrust... | Load keystore from InputStream, close the stream after load succeed or failed. | [
"Load",
"keystore",
"from",
"InputStream",
"close",
"the",
"stream",
"after",
"load",
"succeed",
"or",
"failed",
"."
] | a6cc6f8293e808cc937d3789aec2616a8383dee0 | https://github.com/hsiafan/requests/blob/a6cc6f8293e808cc937d3789aec2616a8383dee0/src/main/java/net/dongliu/requests/KeyStores.java#L31-L42 | train |
hsiafan/requests | src/main/java/net/dongliu/requests/executor/URLConnectionExecutor.java | URLConnectionExecutor.getResponse | private RawResponse getResponse(URL url, HttpURLConnection conn, CookieJar cookieJar, String method)
throws IOException {
// read result
int status = conn.getResponseCode();
String host = url.getHost().toLowerCase();
String statusLine = null;
// headers and cookies
... | java | private RawResponse getResponse(URL url, HttpURLConnection conn, CookieJar cookieJar, String method)
throws IOException {
// read result
int status = conn.getResponseCode();
String host = url.getHost().toLowerCase();
String statusLine = null;
// headers and cookies
... | [
"private",
"RawResponse",
"getResponse",
"(",
"URL",
"url",
",",
"HttpURLConnection",
"conn",
",",
"CookieJar",
"cookieJar",
",",
"String",
"method",
")",
"throws",
"IOException",
"{",
"// read result",
"int",
"status",
"=",
"conn",
".",
"getResponseCode",
"(",
... | Wrap response, deal with headers and cookies | [
"Wrap",
"response",
"deal",
"with",
"headers",
"and",
"cookies"
] | a6cc6f8293e808cc937d3789aec2616a8383dee0 | https://github.com/hsiafan/requests/blob/a6cc6f8293e808cc937d3789aec2616a8383dee0/src/main/java/net/dongliu/requests/executor/URLConnectionExecutor.java#L215-L262 | train |
hsiafan/requests | src/main/java/net/dongliu/requests/json/JsonLookup.java | JsonLookup.lookup | @NonNull
public JsonProcessor lookup() {
JsonProcessor registeredJsonProcessor = this.registeredJsonProcessor;
if (registeredJsonProcessor != null) {
return registeredJsonProcessor;
}
if (!init) {
synchronized (this) {
if (!init) {
... | java | @NonNull
public JsonProcessor lookup() {
JsonProcessor registeredJsonProcessor = this.registeredJsonProcessor;
if (registeredJsonProcessor != null) {
return registeredJsonProcessor;
}
if (!init) {
synchronized (this) {
if (!init) {
... | [
"@",
"NonNull",
"public",
"JsonProcessor",
"lookup",
"(",
")",
"{",
"JsonProcessor",
"registeredJsonProcessor",
"=",
"this",
".",
"registeredJsonProcessor",
";",
"if",
"(",
"registeredJsonProcessor",
"!=",
"null",
")",
"{",
"return",
"registeredJsonProcessor",
";",
... | Find one json provider.
@throws JsonProcessorNotFoundException if no json provider found | [
"Find",
"one",
"json",
"provider",
"."
] | a6cc6f8293e808cc937d3789aec2616a8383dee0 | https://github.com/hsiafan/requests/blob/a6cc6f8293e808cc937d3789aec2616a8383dee0/src/main/java/net/dongliu/requests/json/JsonLookup.java#L93-L113 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.