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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
msgpack/msgpack-java | msgpack-core/src/main/java/org/msgpack/core/buffer/MessageBuffer.java | MessageBuffer.sliceAsByteBuffer | public ByteBuffer sliceAsByteBuffer(int index, int length)
{
if (hasArray()) {
return ByteBuffer.wrap((byte[]) base, (int) ((address - ARRAY_BYTE_BASE_OFFSET) + index), length);
}
else {
assert (!isUniversalBuffer);
return DirectBufferAccess.newByteBuffer(... | java | public ByteBuffer sliceAsByteBuffer(int index, int length)
{
if (hasArray()) {
return ByteBuffer.wrap((byte[]) base, (int) ((address - ARRAY_BYTE_BASE_OFFSET) + index), length);
}
else {
assert (!isUniversalBuffer);
return DirectBufferAccess.newByteBuffer(... | [
"public",
"ByteBuffer",
"sliceAsByteBuffer",
"(",
"int",
"index",
",",
"int",
"length",
")",
"{",
"if",
"(",
"hasArray",
"(",
")",
")",
"{",
"return",
"ByteBuffer",
".",
"wrap",
"(",
"(",
"byte",
"[",
"]",
")",
"base",
",",
"(",
"int",
")",
"(",
"(... | Create a ByteBuffer view of the range [index, index+length) of this memory
@param index
@param length
@return | [
"Create",
"a",
"ByteBuffer",
"view",
"of",
"the",
"range",
"[",
"index",
"index",
"+",
"length",
")",
"of",
"this",
"memory"
] | 16e370e348215a72a14c210b42d448d513aee015 | https://github.com/msgpack/msgpack-java/blob/16e370e348215a72a14c210b42d448d513aee015/msgpack-core/src/main/java/org/msgpack/core/buffer/MessageBuffer.java#L570-L579 | train |
msgpack/msgpack-java | msgpack-core/src/main/java/org/msgpack/core/buffer/MessageBuffer.java | MessageBuffer.toByteArray | public byte[] toByteArray()
{
byte[] b = new byte[size()];
unsafe.copyMemory(base, address, b, ARRAY_BYTE_BASE_OFFSET, size());
return b;
} | java | public byte[] toByteArray()
{
byte[] b = new byte[size()];
unsafe.copyMemory(base, address, b, ARRAY_BYTE_BASE_OFFSET, size());
return b;
} | [
"public",
"byte",
"[",
"]",
"toByteArray",
"(",
")",
"{",
"byte",
"[",
"]",
"b",
"=",
"new",
"byte",
"[",
"size",
"(",
")",
"]",
";",
"unsafe",
".",
"copyMemory",
"(",
"base",
",",
"address",
",",
"b",
",",
"ARRAY_BYTE_BASE_OFFSET",
",",
"size",
"(... | Get a copy of this buffer
@return | [
"Get",
"a",
"copy",
"of",
"this",
"buffer"
] | 16e370e348215a72a14c210b42d448d513aee015 | https://github.com/msgpack/msgpack-java/blob/16e370e348215a72a14c210b42d448d513aee015/msgpack-core/src/main/java/org/msgpack/core/buffer/MessageBuffer.java#L601-L606 | train |
msgpack/msgpack-java | msgpack-core/src/main/java/org/msgpack/core/buffer/MessageBuffer.java | MessageBuffer.copyTo | public void copyTo(int index, MessageBuffer dst, int offset, int length)
{
unsafe.copyMemory(base, address + index, dst.base, dst.address + offset, length);
} | java | public void copyTo(int index, MessageBuffer dst, int offset, int length)
{
unsafe.copyMemory(base, address + index, dst.base, dst.address + offset, length);
} | [
"public",
"void",
"copyTo",
"(",
"int",
"index",
",",
"MessageBuffer",
"dst",
",",
"int",
"offset",
",",
"int",
"length",
")",
"{",
"unsafe",
".",
"copyMemory",
"(",
"base",
",",
"address",
"+",
"index",
",",
"dst",
".",
"base",
",",
"dst",
".",
"add... | Copy this buffer contents to another MessageBuffer
@param index
@param dst
@param offset
@param length | [
"Copy",
"this",
"buffer",
"contents",
"to",
"another",
"MessageBuffer"
] | 16e370e348215a72a14c210b42d448d513aee015 | https://github.com/msgpack/msgpack-java/blob/16e370e348215a72a14c210b42d448d513aee015/msgpack-core/src/main/java/org/msgpack/core/buffer/MessageBuffer.java#L626-L629 | train |
msgpack/msgpack-java | msgpack-jackson/src/main/java/org/msgpack/jackson/dataformat/JsonArrayFormat.java | JsonArrayFormat.findFormat | @Override
public JsonFormat.Value findFormat(Annotated ann)
{
// If the entity contains JsonFormat annotation, give it higher priority.
JsonFormat.Value precedenceFormat = super.findFormat(ann);
if (precedenceFormat != null) {
return precedenceFormat;
}
return ARRAY_FORMAT;
} | java | @Override
public JsonFormat.Value findFormat(Annotated ann)
{
// If the entity contains JsonFormat annotation, give it higher priority.
JsonFormat.Value precedenceFormat = super.findFormat(ann);
if (precedenceFormat != null) {
return precedenceFormat;
}
return ARRAY_FORMAT;
} | [
"@",
"Override",
"public",
"JsonFormat",
".",
"Value",
"findFormat",
"(",
"Annotated",
"ann",
")",
"{",
"// If the entity contains JsonFormat annotation, give it higher priority.",
"JsonFormat",
".",
"Value",
"precedenceFormat",
"=",
"super",
".",
"findFormat",
"(",
"ann"... | Defines array format for serialized entities with ObjectMapper, without actually
including the schema | [
"Defines",
"array",
"format",
"for",
"serialized",
"entities",
"with",
"ObjectMapper",
"without",
"actually",
"including",
"the",
"schema"
] | 16e370e348215a72a14c210b42d448d513aee015 | https://github.com/msgpack/msgpack-java/blob/16e370e348215a72a14c210b42d448d513aee015/msgpack-jackson/src/main/java/org/msgpack/jackson/dataformat/JsonArrayFormat.java#L25-L35 | train |
msgpack/msgpack-java | msgpack-jackson/src/main/java/org/msgpack/jackson/dataformat/JsonArrayFormat.java | JsonArrayFormat.findIgnoreUnknownProperties | @Override
public Boolean findIgnoreUnknownProperties(AnnotatedClass ac)
{
// If the entity contains JsonIgnoreProperties annotation, give it higher priority.
final Boolean precedenceIgnoreUnknownProperties = super.findIgnoreUnknownProperties(ac);
if (precedenceIgnoreUnknownProperties != null) {
re... | java | @Override
public Boolean findIgnoreUnknownProperties(AnnotatedClass ac)
{
// If the entity contains JsonIgnoreProperties annotation, give it higher priority.
final Boolean precedenceIgnoreUnknownProperties = super.findIgnoreUnknownProperties(ac);
if (precedenceIgnoreUnknownProperties != null) {
re... | [
"@",
"Override",
"public",
"Boolean",
"findIgnoreUnknownProperties",
"(",
"AnnotatedClass",
"ac",
")",
"{",
"// If the entity contains JsonIgnoreProperties annotation, give it higher priority.",
"final",
"Boolean",
"precedenceIgnoreUnknownProperties",
"=",
"super",
".",
"findIgnore... | Defines that unknown properties will be ignored, and won't fail the un-marshalling process.
Happens in case of de-serialization of a payload that contains more properties than the actual
value type | [
"Defines",
"that",
"unknown",
"properties",
"will",
"be",
"ignored",
"and",
"won",
"t",
"fail",
"the",
"un",
"-",
"marshalling",
"process",
".",
"Happens",
"in",
"case",
"of",
"de",
"-",
"serialization",
"of",
"a",
"payload",
"that",
"contains",
"more",
"p... | 16e370e348215a72a14c210b42d448d513aee015 | https://github.com/msgpack/msgpack-java/blob/16e370e348215a72a14c210b42d448d513aee015/msgpack-jackson/src/main/java/org/msgpack/jackson/dataformat/JsonArrayFormat.java#L42-L52 | train |
msgpack/msgpack-java | msgpack-core/src/main/java/org/msgpack/core/buffer/OutputStreamBufferOutput.java | OutputStreamBufferOutput.reset | public OutputStream reset(OutputStream out)
throws IOException
{
OutputStream old = this.out;
this.out = out;
return old;
} | java | public OutputStream reset(OutputStream out)
throws IOException
{
OutputStream old = this.out;
this.out = out;
return old;
} | [
"public",
"OutputStream",
"reset",
"(",
"OutputStream",
"out",
")",
"throws",
"IOException",
"{",
"OutputStream",
"old",
"=",
"this",
".",
"out",
";",
"this",
".",
"out",
"=",
"out",
";",
"return",
"old",
";",
"}"
] | Reset Stream. This method doesn't close the old stream.
@param out new stream
@return the old stream | [
"Reset",
"Stream",
".",
"This",
"method",
"doesn",
"t",
"close",
"the",
"old",
"stream",
"."
] | 16e370e348215a72a14c210b42d448d513aee015 | https://github.com/msgpack/msgpack-java/blob/16e370e348215a72a14c210b42d448d513aee015/msgpack-core/src/main/java/org/msgpack/core/buffer/OutputStreamBufferOutput.java#L49-L55 | train |
msgpack/msgpack-java | msgpack-core/src/main/java/org/msgpack/core/buffer/InputStreamBufferInput.java | InputStreamBufferInput.reset | public InputStream reset(InputStream in)
throws IOException
{
InputStream old = this.in;
this.in = in;
return old;
} | java | public InputStream reset(InputStream in)
throws IOException
{
InputStream old = this.in;
this.in = in;
return old;
} | [
"public",
"InputStream",
"reset",
"(",
"InputStream",
"in",
")",
"throws",
"IOException",
"{",
"InputStream",
"old",
"=",
"this",
".",
"in",
";",
"this",
".",
"in",
"=",
"in",
";",
"return",
"old",
";",
"}"
] | Reset Stream. This method doesn't close the old resource.
@param in new stream
@return the old resource | [
"Reset",
"Stream",
".",
"This",
"method",
"doesn",
"t",
"close",
"the",
"old",
"resource",
"."
] | 16e370e348215a72a14c210b42d448d513aee015 | https://github.com/msgpack/msgpack-java/blob/16e370e348215a72a14c210b42d448d513aee015/msgpack-core/src/main/java/org/msgpack/core/buffer/InputStreamBufferInput.java#L63-L69 | train |
msgpack/msgpack-java | msgpack-core/src/main/java/org/msgpack/core/buffer/ChannelBufferOutput.java | ChannelBufferOutput.reset | public WritableByteChannel reset(WritableByteChannel channel)
throws IOException
{
WritableByteChannel old = this.channel;
this.channel = channel;
return old;
} | java | public WritableByteChannel reset(WritableByteChannel channel)
throws IOException
{
WritableByteChannel old = this.channel;
this.channel = channel;
return old;
} | [
"public",
"WritableByteChannel",
"reset",
"(",
"WritableByteChannel",
"channel",
")",
"throws",
"IOException",
"{",
"WritableByteChannel",
"old",
"=",
"this",
".",
"channel",
";",
"this",
".",
"channel",
"=",
"channel",
";",
"return",
"old",
";",
"}"
] | Reset channel. This method doesn't close the old channel.
@param channel new channel
@return the old channel | [
"Reset",
"channel",
".",
"This",
"method",
"doesn",
"t",
"close",
"the",
"old",
"channel",
"."
] | 16e370e348215a72a14c210b42d448d513aee015 | https://github.com/msgpack/msgpack-java/blob/16e370e348215a72a14c210b42d448d513aee015/msgpack-core/src/main/java/org/msgpack/core/buffer/ChannelBufferOutput.java#L50-L56 | train |
msgpack/msgpack-java | msgpack-core/src/main/java/org/msgpack/core/buffer/ChannelBufferInput.java | ChannelBufferInput.reset | public ReadableByteChannel reset(ReadableByteChannel channel)
throws IOException
{
ReadableByteChannel old = this.channel;
this.channel = channel;
return old;
} | java | public ReadableByteChannel reset(ReadableByteChannel channel)
throws IOException
{
ReadableByteChannel old = this.channel;
this.channel = channel;
return old;
} | [
"public",
"ReadableByteChannel",
"reset",
"(",
"ReadableByteChannel",
"channel",
")",
"throws",
"IOException",
"{",
"ReadableByteChannel",
"old",
"=",
"this",
".",
"channel",
";",
"this",
".",
"channel",
"=",
"channel",
";",
"return",
"old",
";",
"}"
] | Reset channel. This method doesn't close the old resource.
@param channel new channel
@return the old resource | [
"Reset",
"channel",
".",
"This",
"method",
"doesn",
"t",
"close",
"the",
"old",
"resource",
"."
] | 16e370e348215a72a14c210b42d448d513aee015 | https://github.com/msgpack/msgpack-java/blob/16e370e348215a72a14c210b42d448d513aee015/msgpack-core/src/main/java/org/msgpack/core/buffer/ChannelBufferInput.java#L52-L58 | train |
msgpack/msgpack-java | msgpack-core/src/main/java/org/msgpack/core/MessageUnpacker.java | MessageUnpacker.getNextBuffer | private MessageBuffer getNextBuffer()
throws IOException
{
MessageBuffer next = in.next();
if (next == null) {
throw new MessageInsufficientBufferException();
}
assert (buffer != null);
totalReadBytes += buffer.size();
return next;
} | java | private MessageBuffer getNextBuffer()
throws IOException
{
MessageBuffer next = in.next();
if (next == null) {
throw new MessageInsufficientBufferException();
}
assert (buffer != null);
totalReadBytes += buffer.size();
return next;
} | [
"private",
"MessageBuffer",
"getNextBuffer",
"(",
")",
"throws",
"IOException",
"{",
"MessageBuffer",
"next",
"=",
"in",
".",
"next",
"(",
")",
";",
"if",
"(",
"next",
"==",
"null",
")",
"{",
"throw",
"new",
"MessageInsufficientBufferException",
"(",
")",
";... | Get the next buffer without changing the position
@return
@throws IOException | [
"Get",
"the",
"next",
"buffer",
"without",
"changing",
"the",
"position"
] | 16e370e348215a72a14c210b42d448d513aee015 | https://github.com/msgpack/msgpack-java/blob/16e370e348215a72a14c210b42d448d513aee015/msgpack-core/src/main/java/org/msgpack/core/MessageUnpacker.java#L272-L282 | train |
msgpack/msgpack-java | msgpack-core/src/main/java/org/msgpack/core/MessageUnpacker.java | MessageUnpacker.getNextFormat | public MessageFormat getNextFormat()
throws IOException
{
// makes sure that buffer has at least 1 byte
if (!ensureBuffer()) {
throw new MessageInsufficientBufferException();
}
byte b = buffer.getByte(position);
return MessageFormat.valueOf(b);
} | java | public MessageFormat getNextFormat()
throws IOException
{
// makes sure that buffer has at least 1 byte
if (!ensureBuffer()) {
throw new MessageInsufficientBufferException();
}
byte b = buffer.getByte(position);
return MessageFormat.valueOf(b);
} | [
"public",
"MessageFormat",
"getNextFormat",
"(",
")",
"throws",
"IOException",
"{",
"// makes sure that buffer has at least 1 byte",
"if",
"(",
"!",
"ensureBuffer",
"(",
")",
")",
"{",
"throw",
"new",
"MessageInsufficientBufferException",
"(",
")",
";",
"}",
"byte",
... | Returns format of the next value.
<p>
Note that this method doesn't consume data from the internal buffer unlike the other unpack methods.
Calling this method twice will return the same value.
<p>
To not throw {@link MessageInsufficientBufferException}, this method should be called only when
{@link #hasNext()} return... | [
"Returns",
"format",
"of",
"the",
"next",
"value",
"."
] | 16e370e348215a72a14c210b42d448d513aee015 | https://github.com/msgpack/msgpack-java/blob/16e370e348215a72a14c210b42d448d513aee015/msgpack-core/src/main/java/org/msgpack/core/MessageUnpacker.java#L389-L398 | train |
msgpack/msgpack-java | msgpack-core/src/main/java/org/msgpack/core/MessageUnpacker.java | MessageUnpacker.readByte | private byte readByte()
throws IOException
{
if (buffer.size() > position) {
byte b = buffer.getByte(position);
position++;
return b;
}
else {
nextBuffer();
if (buffer.size() > 0) {
byte b = buffer.getByt... | java | private byte readByte()
throws IOException
{
if (buffer.size() > position) {
byte b = buffer.getByte(position);
position++;
return b;
}
else {
nextBuffer();
if (buffer.size() > 0) {
byte b = buffer.getByt... | [
"private",
"byte",
"readByte",
"(",
")",
"throws",
"IOException",
"{",
"if",
"(",
"buffer",
".",
"size",
"(",
")",
">",
"position",
")",
"{",
"byte",
"b",
"=",
"buffer",
".",
"getByte",
"(",
"position",
")",
";",
"position",
"++",
";",
"return",
"b",... | Read a byte value at the cursor and proceed the cursor.
@return
@throws IOException | [
"Read",
"a",
"byte",
"value",
"at",
"the",
"cursor",
"and",
"proceed",
"the",
"cursor",
"."
] | 16e370e348215a72a14c210b42d448d513aee015 | https://github.com/msgpack/msgpack-java/blob/16e370e348215a72a14c210b42d448d513aee015/msgpack-core/src/main/java/org/msgpack/core/MessageUnpacker.java#L406-L423 | train |
msgpack/msgpack-java | msgpack-core/src/main/java/org/msgpack/core/MessageUnpacker.java | MessageUnpacker.skipValue | public void skipValue(int count)
throws IOException
{
while (count > 0) {
byte b = readByte();
MessageFormat f = MessageFormat.valueOf(b);
switch (f) {
case POSFIXINT:
case NEGFIXINT:
case BOOLEAN:
... | java | public void skipValue(int count)
throws IOException
{
while (count > 0) {
byte b = readByte();
MessageFormat f = MessageFormat.valueOf(b);
switch (f) {
case POSFIXINT:
case NEGFIXINT:
case BOOLEAN:
... | [
"public",
"void",
"skipValue",
"(",
"int",
"count",
")",
"throws",
"IOException",
"{",
"while",
"(",
"count",
">",
"0",
")",
"{",
"byte",
"b",
"=",
"readByte",
"(",
")",
";",
"MessageFormat",
"f",
"=",
"MessageFormat",
".",
"valueOf",
"(",
"b",
")",
... | Skip next values, then move the cursor at the end of the value
@param count number of values to skip
@throws IOException | [
"Skip",
"next",
"values",
"then",
"move",
"the",
"cursor",
"at",
"the",
"end",
"of",
"the",
"value"
] | 16e370e348215a72a14c210b42d448d513aee015 | https://github.com/msgpack/msgpack-java/blob/16e370e348215a72a14c210b42d448d513aee015/msgpack-core/src/main/java/org/msgpack/core/MessageUnpacker.java#L477-L576 | train |
msgpack/msgpack-java | msgpack-core/src/main/java/org/msgpack/core/MessageUnpacker.java | MessageUnpacker.unexpected | private static MessagePackException unexpected(String expected, byte b)
{
MessageFormat format = MessageFormat.valueOf(b);
if (format == MessageFormat.NEVER_USED) {
return new MessageNeverUsedFormatException(String.format("Expected %s, but encountered 0xC1 \"NEVER_USED\" byte", expected)... | java | private static MessagePackException unexpected(String expected, byte b)
{
MessageFormat format = MessageFormat.valueOf(b);
if (format == MessageFormat.NEVER_USED) {
return new MessageNeverUsedFormatException(String.format("Expected %s, but encountered 0xC1 \"NEVER_USED\" byte", expected)... | [
"private",
"static",
"MessagePackException",
"unexpected",
"(",
"String",
"expected",
",",
"byte",
"b",
")",
"{",
"MessageFormat",
"format",
"=",
"MessageFormat",
".",
"valueOf",
"(",
"b",
")",
";",
"if",
"(",
"format",
"==",
"MessageFormat",
".",
"NEVER_USED"... | Create an exception for the case when an unexpected byte value is read
@param expected
@param b
@return
@throws MessageFormatException | [
"Create",
"an",
"exception",
"for",
"the",
"case",
"when",
"an",
"unexpected",
"byte",
"value",
"is",
"read"
] | 16e370e348215a72a14c210b42d448d513aee015 | https://github.com/msgpack/msgpack-java/blob/16e370e348215a72a14c210b42d448d513aee015/msgpack-core/src/main/java/org/msgpack/core/MessageUnpacker.java#L586-L597 | train |
msgpack/msgpack-java | msgpack-core/src/main/java/org/msgpack/core/MessageUnpacker.java | MessageUnpacker.tryUnpackNil | public boolean tryUnpackNil()
throws IOException
{
// makes sure that buffer has at least 1 byte
if (!ensureBuffer()) {
throw new MessageInsufficientBufferException();
}
byte b = buffer.getByte(position);
if (b == Code.NIL) {
readByte();
... | java | public boolean tryUnpackNil()
throws IOException
{
// makes sure that buffer has at least 1 byte
if (!ensureBuffer()) {
throw new MessageInsufficientBufferException();
}
byte b = buffer.getByte(position);
if (b == Code.NIL) {
readByte();
... | [
"public",
"boolean",
"tryUnpackNil",
"(",
")",
"throws",
"IOException",
"{",
"// makes sure that buffer has at least 1 byte",
"if",
"(",
"!",
"ensureBuffer",
"(",
")",
")",
"{",
"throw",
"new",
"MessageInsufficientBufferException",
"(",
")",
";",
"}",
"byte",
"b",
... | Peeks a Nil byte and reads it if next byte is a nil value.
The difference from {@link unpackNil} is that unpackNil throws an exception if the next byte is not nil value
while this tryUnpackNil method returns false without changing position.
@return true if a nil value is read
@throws MessageInsufficientBufferExceptio... | [
"Peeks",
"a",
"Nil",
"byte",
"and",
"reads",
"it",
"if",
"next",
"byte",
"is",
"a",
"nil",
"value",
"."
] | 16e370e348215a72a14c210b42d448d513aee015 | https://github.com/msgpack/msgpack-java/blob/16e370e348215a72a14c210b42d448d513aee015/msgpack-core/src/main/java/org/msgpack/core/MessageUnpacker.java#L744-L757 | train |
msgpack/msgpack-java | msgpack-core/src/main/java/org/msgpack/core/MessageUnpacker.java | MessageUnpacker.unpackBoolean | public boolean unpackBoolean()
throws IOException
{
byte b = readByte();
if (b == Code.FALSE) {
return false;
}
else if (b == Code.TRUE) {
return true;
}
throw unexpected("boolean", b);
} | java | public boolean unpackBoolean()
throws IOException
{
byte b = readByte();
if (b == Code.FALSE) {
return false;
}
else if (b == Code.TRUE) {
return true;
}
throw unexpected("boolean", b);
} | [
"public",
"boolean",
"unpackBoolean",
"(",
")",
"throws",
"IOException",
"{",
"byte",
"b",
"=",
"readByte",
"(",
")",
";",
"if",
"(",
"b",
"==",
"Code",
".",
"FALSE",
")",
"{",
"return",
"false",
";",
"}",
"else",
"if",
"(",
"b",
"==",
"Code",
".",... | Reads true or false.
@return the read value
@throws MessageTypeException when value is not MessagePack Boolean type
@throws IOException when underlying input throws IOException | [
"Reads",
"true",
"or",
"false",
"."
] | 16e370e348215a72a14c210b42d448d513aee015 | https://github.com/msgpack/msgpack-java/blob/16e370e348215a72a14c210b42d448d513aee015/msgpack-core/src/main/java/org/msgpack/core/MessageUnpacker.java#L766-L777 | train |
msgpack/msgpack-java | msgpack-core/src/main/java/org/msgpack/core/MessageUnpacker.java | MessageUnpacker.unpackShort | public short unpackShort()
throws IOException
{
byte b = readByte();
if (Code.isFixInt(b)) {
return (short) b;
}
switch (b) {
case Code.UINT8: // unsigned int 8
byte u8 = readByte();
return (short) (u8 & 0xff);
... | java | public short unpackShort()
throws IOException
{
byte b = readByte();
if (Code.isFixInt(b)) {
return (short) b;
}
switch (b) {
case Code.UINT8: // unsigned int 8
byte u8 = readByte();
return (short) (u8 & 0xff);
... | [
"public",
"short",
"unpackShort",
"(",
")",
"throws",
"IOException",
"{",
"byte",
"b",
"=",
"readByte",
"(",
")",
";",
"if",
"(",
"Code",
".",
"isFixInt",
"(",
"b",
")",
")",
"{",
"return",
"(",
"short",
")",
"b",
";",
"}",
"switch",
"(",
"b",
")... | Reads a short.
This method throws {@link MessageIntegerOverflowException} if the value doesn't fit in the range of short. This may happen when {@link #getNextFormat()} returns UINT16, INT32, or larger integer formats.
@return the read value
@throws MessageIntegerOverflowException when value doesn't fit in the range o... | [
"Reads",
"a",
"short",
"."
] | 16e370e348215a72a14c210b42d448d513aee015 | https://github.com/msgpack/msgpack-java/blob/16e370e348215a72a14c210b42d448d513aee015/msgpack-core/src/main/java/org/msgpack/core/MessageUnpacker.java#L856-L905 | train |
msgpack/msgpack-java | msgpack-core/src/main/java/org/msgpack/core/MessageUnpacker.java | MessageUnpacker.unpackLong | public long unpackLong()
throws IOException
{
byte b = readByte();
if (Code.isFixInt(b)) {
return (long) b;
}
switch (b) {
case Code.UINT8: // unsigned int 8
byte u8 = readByte();
return (long) (u8 & 0xff);
... | java | public long unpackLong()
throws IOException
{
byte b = readByte();
if (Code.isFixInt(b)) {
return (long) b;
}
switch (b) {
case Code.UINT8: // unsigned int 8
byte u8 = readByte();
return (long) (u8 & 0xff);
... | [
"public",
"long",
"unpackLong",
"(",
")",
"throws",
"IOException",
"{",
"byte",
"b",
"=",
"readByte",
"(",
")",
";",
"if",
"(",
"Code",
".",
"isFixInt",
"(",
"b",
")",
")",
"{",
"return",
"(",
"long",
")",
"b",
";",
"}",
"switch",
"(",
"b",
")",
... | Reads a long.
This method throws {@link MessageIntegerOverflowException} if the value doesn't fit in the range of long. This may happen when {@link #getNextFormat()} returns UINT64.
@return the read value
@throws MessageIntegerOverflowException when value doesn't fit in the range of long
@throws MessageTypeException ... | [
"Reads",
"a",
"long",
"."
] | 16e370e348215a72a14c210b42d448d513aee015 | https://github.com/msgpack/msgpack-java/blob/16e370e348215a72a14c210b42d448d513aee015/msgpack-core/src/main/java/org/msgpack/core/MessageUnpacker.java#L972-L1014 | train |
msgpack/msgpack-java | msgpack-core/src/main/java/org/msgpack/core/MessageUnpacker.java | MessageUnpacker.unpackBigInteger | public BigInteger unpackBigInteger()
throws IOException
{
byte b = readByte();
if (Code.isFixInt(b)) {
return BigInteger.valueOf((long) b);
}
switch (b) {
case Code.UINT8: // unsigned int 8
byte u8 = readByte();
retu... | java | public BigInteger unpackBigInteger()
throws IOException
{
byte b = readByte();
if (Code.isFixInt(b)) {
return BigInteger.valueOf((long) b);
}
switch (b) {
case Code.UINT8: // unsigned int 8
byte u8 = readByte();
retu... | [
"public",
"BigInteger",
"unpackBigInteger",
"(",
")",
"throws",
"IOException",
"{",
"byte",
"b",
"=",
"readByte",
"(",
")",
";",
"if",
"(",
"Code",
".",
"isFixInt",
"(",
"b",
")",
")",
"{",
"return",
"BigInteger",
".",
"valueOf",
"(",
"(",
"long",
")",... | Reads a BigInteger.
@return the read value
@throws MessageTypeException when value is not MessagePack Integer type
@throws IOException when underlying input throws IOException | [
"Reads",
"a",
"BigInteger",
"."
] | 16e370e348215a72a14c210b42d448d513aee015 | https://github.com/msgpack/msgpack-java/blob/16e370e348215a72a14c210b42d448d513aee015/msgpack-core/src/main/java/org/msgpack/core/MessageUnpacker.java#L1023-L1068 | train |
msgpack/msgpack-java | msgpack-core/src/main/java/org/msgpack/core/MessageUnpacker.java | MessageUnpacker.unpackFloat | public float unpackFloat()
throws IOException
{
byte b = readByte();
switch (b) {
case Code.FLOAT32: // float
float fv = readFloat();
return fv;
case Code.FLOAT64: // double
double dv = readDouble();
... | java | public float unpackFloat()
throws IOException
{
byte b = readByte();
switch (b) {
case Code.FLOAT32: // float
float fv = readFloat();
return fv;
case Code.FLOAT64: // double
double dv = readDouble();
... | [
"public",
"float",
"unpackFloat",
"(",
")",
"throws",
"IOException",
"{",
"byte",
"b",
"=",
"readByte",
"(",
")",
";",
"switch",
"(",
"b",
")",
"{",
"case",
"Code",
".",
"FLOAT32",
":",
"// float",
"float",
"fv",
"=",
"readFloat",
"(",
")",
";",
"ret... | Reads a float.
This method rounds value to the range of float when precision of the read value is larger than the range of float. This may happen when {@link #getNextFormat()} returns FLOAT64.
@return the read value
@throws MessageTypeException when value is not MessagePack Float type
@throws IOException when underly... | [
"Reads",
"a",
"float",
"."
] | 16e370e348215a72a14c210b42d448d513aee015 | https://github.com/msgpack/msgpack-java/blob/16e370e348215a72a14c210b42d448d513aee015/msgpack-core/src/main/java/org/msgpack/core/MessageUnpacker.java#L1079-L1092 | train |
msgpack/msgpack-java | msgpack-core/src/main/java/org/msgpack/core/MessageUnpacker.java | MessageUnpacker.unpackArrayHeader | public int unpackArrayHeader()
throws IOException
{
byte b = readByte();
if (Code.isFixedArray(b)) { // fixarray
return b & 0x0f;
}
switch (b) {
case Code.ARRAY16: { // array 16
int len = readNextLength16();
return l... | java | public int unpackArrayHeader()
throws IOException
{
byte b = readByte();
if (Code.isFixedArray(b)) { // fixarray
return b & 0x0f;
}
switch (b) {
case Code.ARRAY16: { // array 16
int len = readNextLength16();
return l... | [
"public",
"int",
"unpackArrayHeader",
"(",
")",
"throws",
"IOException",
"{",
"byte",
"b",
"=",
"readByte",
"(",
")",
";",
"if",
"(",
"Code",
".",
"isFixedArray",
"(",
"b",
")",
")",
"{",
"// fixarray",
"return",
"b",
"&",
"0x0f",
";",
"}",
"switch",
... | Reads header of an array.
<p>
This method returns number of elements to be read. After this method call, you call unpacker methods for
each element. You don't have to call anything at the end of iteration.
@return the size of the array to be read
@throws MessageTypeException when value is not MessagePack Array type
@... | [
"Reads",
"header",
"of",
"an",
"array",
"."
] | 16e370e348215a72a14c210b42d448d513aee015 | https://github.com/msgpack/msgpack-java/blob/16e370e348215a72a14c210b42d448d513aee015/msgpack-core/src/main/java/org/msgpack/core/MessageUnpacker.java#L1272-L1290 | train |
msgpack/msgpack-java | msgpack-core/src/main/java/org/msgpack/core/MessageUnpacker.java | MessageUnpacker.unpackMapHeader | public int unpackMapHeader()
throws IOException
{
byte b = readByte();
if (Code.isFixedMap(b)) { // fixmap
return b & 0x0f;
}
switch (b) {
case Code.MAP16: { // map 16
int len = readNextLength16();
return len;
... | java | public int unpackMapHeader()
throws IOException
{
byte b = readByte();
if (Code.isFixedMap(b)) { // fixmap
return b & 0x0f;
}
switch (b) {
case Code.MAP16: { // map 16
int len = readNextLength16();
return len;
... | [
"public",
"int",
"unpackMapHeader",
"(",
")",
"throws",
"IOException",
"{",
"byte",
"b",
"=",
"readByte",
"(",
")",
";",
"if",
"(",
"Code",
".",
"isFixedMap",
"(",
"b",
")",
")",
"{",
"// fixmap",
"return",
"b",
"&",
"0x0f",
";",
"}",
"switch",
"(",
... | Reads header of a map.
<p>
This method returns number of pairs to be read. After this method call, for each pair, you call unpacker
methods for key first, and then value. You will call unpacker methods twice as many time as the returned
count. You don't have to call anything at the end of iteration.
@return the size ... | [
"Reads",
"header",
"of",
"a",
"map",
"."
] | 16e370e348215a72a14c210b42d448d513aee015 | https://github.com/msgpack/msgpack-java/blob/16e370e348215a72a14c210b42d448d513aee015/msgpack-core/src/main/java/org/msgpack/core/MessageUnpacker.java#L1305-L1323 | train |
msgpack/msgpack-java | msgpack-core/src/main/java/org/msgpack/core/MessageUnpacker.java | MessageUnpacker.unpackBinaryHeader | public int unpackBinaryHeader()
throws IOException
{
byte b = readByte();
if (Code.isFixedRaw(b)) { // FixRaw
return b & 0x1f;
}
int len = tryReadBinaryHeader(b);
if (len >= 0) {
return len;
}
if (allowReadingStringAsBinary... | java | public int unpackBinaryHeader()
throws IOException
{
byte b = readByte();
if (Code.isFixedRaw(b)) { // FixRaw
return b & 0x1f;
}
int len = tryReadBinaryHeader(b);
if (len >= 0) {
return len;
}
if (allowReadingStringAsBinary... | [
"public",
"int",
"unpackBinaryHeader",
"(",
")",
"throws",
"IOException",
"{",
"byte",
"b",
"=",
"readByte",
"(",
")",
";",
"if",
"(",
"Code",
".",
"isFixedRaw",
"(",
"b",
")",
")",
"{",
"// FixRaw",
"return",
"b",
"&",
"0x1f",
";",
"}",
"int",
"len"... | Reads header of a binary.
<p>
This method returns number of bytes to be read. After this method call, you call a readPayload method such as
{@link #readPayload(int)} with the returned count.
<p>
You can divide readPayload method into multiple calls. In this case, you must repeat readPayload methods
until total amount... | [
"Reads",
"header",
"of",
"a",
"binary",
"."
] | 16e370e348215a72a14c210b42d448d513aee015 | https://github.com/msgpack/msgpack-java/blob/16e370e348215a72a14c210b42d448d513aee015/msgpack-core/src/main/java/org/msgpack/core/MessageUnpacker.java#L1446-L1465 | train |
msgpack/msgpack-java | msgpack-core/src/main/java/org/msgpack/core/MessageUnpacker.java | MessageUnpacker.readPayloadAsReference | public MessageBuffer readPayloadAsReference(int length)
throws IOException
{
int bufferRemaining = buffer.size() - position;
if (bufferRemaining >= length) {
MessageBuffer slice = buffer.slice(position, length);
position += length;
return slice;
... | java | public MessageBuffer readPayloadAsReference(int length)
throws IOException
{
int bufferRemaining = buffer.size() - position;
if (bufferRemaining >= length) {
MessageBuffer slice = buffer.slice(position, length);
position += length;
return slice;
... | [
"public",
"MessageBuffer",
"readPayloadAsReference",
"(",
"int",
"length",
")",
"throws",
"IOException",
"{",
"int",
"bufferRemaining",
"=",
"buffer",
".",
"size",
"(",
")",
"-",
"position",
";",
"if",
"(",
"bufferRemaining",
">=",
"length",
")",
"{",
"Message... | Reads payload bytes of binary, extension, or raw string types as a reference to internal buffer.
<p>
This consumes specified amount of bytes and returns its reference or copy. This method tries to
return reference as much as possible because it is faster. However, it may copy data to a newly
allocated buffer if refere... | [
"Reads",
"payload",
"bytes",
"of",
"binary",
"extension",
"or",
"raw",
"string",
"types",
"as",
"a",
"reference",
"to",
"internal",
"buffer",
"."
] | 16e370e348215a72a14c210b42d448d513aee015 | https://github.com/msgpack/msgpack-java/blob/16e370e348215a72a14c210b42d448d513aee015/msgpack-core/src/main/java/org/msgpack/core/MessageUnpacker.java#L1627-L1639 | train |
msgpack/msgpack-java | msgpack-core/src/main/java/org/msgpack/core/buffer/ArrayBufferInput.java | ArrayBufferInput.reset | public MessageBuffer reset(MessageBuffer buf)
{
MessageBuffer old = this.buffer;
this.buffer = buf;
if (buf == null) {
isEmpty = true;
}
else {
isEmpty = false;
}
return old;
} | java | public MessageBuffer reset(MessageBuffer buf)
{
MessageBuffer old = this.buffer;
this.buffer = buf;
if (buf == null) {
isEmpty = true;
}
else {
isEmpty = false;
}
return old;
} | [
"public",
"MessageBuffer",
"reset",
"(",
"MessageBuffer",
"buf",
")",
"{",
"MessageBuffer",
"old",
"=",
"this",
".",
"buffer",
";",
"this",
".",
"buffer",
"=",
"buf",
";",
"if",
"(",
"buf",
"==",
"null",
")",
"{",
"isEmpty",
"=",
"true",
";",
"}",
"e... | Reset buffer. This method returns the old buffer.
@param buf new buffer. This can be null to make this input empty.
@return the old buffer. | [
"Reset",
"buffer",
".",
"This",
"method",
"returns",
"the",
"old",
"buffer",
"."
] | 16e370e348215a72a14c210b42d448d513aee015 | https://github.com/msgpack/msgpack-java/blob/16e370e348215a72a14c210b42d448d513aee015/msgpack-core/src/main/java/org/msgpack/core/buffer/ArrayBufferInput.java#L56-L67 | train |
kochedykov/jlibmodbus | src/com/intelligt/modbus/jlibmodbus/msg/ModbusRequestBuilder.java | ModbusRequestBuilder.buildDiagnostics | public ModbusRequest buildDiagnostics(DiagnosticsSubFunctionCode subFunctionCode, int serverAddress, int data) throws ModbusNumberException {
DiagnosticsRequest request = new DiagnosticsRequest();
request.setServerAddress(serverAddress);
request.setSubFunctionCode(subFunctionCode);
reque... | java | public ModbusRequest buildDiagnostics(DiagnosticsSubFunctionCode subFunctionCode, int serverAddress, int data) throws ModbusNumberException {
DiagnosticsRequest request = new DiagnosticsRequest();
request.setServerAddress(serverAddress);
request.setSubFunctionCode(subFunctionCode);
reque... | [
"public",
"ModbusRequest",
"buildDiagnostics",
"(",
"DiagnosticsSubFunctionCode",
"subFunctionCode",
",",
"int",
"serverAddress",
",",
"int",
"data",
")",
"throws",
"ModbusNumberException",
"{",
"DiagnosticsRequest",
"request",
"=",
"new",
"DiagnosticsRequest",
"(",
")",
... | The function uses a sub-function code field in the query to define the type of test to
be performed. The server echoes both the function code and sub-function code in a normal
response. Some of the diagnostics cause data to be returned from the remote device in the
data field of a normal response.
@param subFunctionCo... | [
"The",
"function",
"uses",
"a",
"sub",
"-",
"function",
"code",
"field",
"in",
"the",
"query",
"to",
"define",
"the",
"type",
"of",
"test",
"to",
"be",
"performed",
".",
"The",
"server",
"echoes",
"both",
"the",
"function",
"code",
"and",
"sub",
"-",
"... | 197cb39e2649e61a6fe3cb7dc91a701d847e14be | https://github.com/kochedykov/jlibmodbus/blob/197cb39e2649e61a6fe3cb7dc91a701d847e14be/src/com/intelligt/modbus/jlibmodbus/msg/ModbusRequestBuilder.java#L185-L191 | train |
kochedykov/jlibmodbus | src/com/intelligt/modbus/jlibmodbus/master/ModbusMaster.java | ModbusMaster.processRequest | synchronized public ModbusResponse processRequest(ModbusRequest request) throws ModbusProtocolException, ModbusIOException {
try {
sendRequest(request);
if (request.getServerAddress() != Modbus.BROADCAST_ID) {
do {
try {
ModbusR... | java | synchronized public ModbusResponse processRequest(ModbusRequest request) throws ModbusProtocolException, ModbusIOException {
try {
sendRequest(request);
if (request.getServerAddress() != Modbus.BROADCAST_ID) {
do {
try {
ModbusR... | [
"synchronized",
"public",
"ModbusResponse",
"processRequest",
"(",
"ModbusRequest",
"request",
")",
"throws",
"ModbusProtocolException",
",",
"ModbusIOException",
"{",
"try",
"{",
"sendRequest",
"(",
"request",
")",
";",
"if",
"(",
"request",
".",
"getServerAddress",
... | this function allows you to process your own ModbusRequest.
Each request class has a compliant response class for instance ReadHoldingRegistersRequest and ReadHoldingRegistersResponse.
If you process an instance of ReadHoldingRegistersRequest this function exactly either returns a ReadHoldingRegistersResponse instance ... | [
"this",
"function",
"allows",
"you",
"to",
"process",
"your",
"own",
"ModbusRequest",
".",
"Each",
"request",
"class",
"has",
"a",
"compliant",
"response",
"class",
"for",
"instance",
"ReadHoldingRegistersRequest",
"and",
"ReadHoldingRegistersResponse",
".",
"If",
"... | 197cb39e2649e61a6fe3cb7dc91a701d847e14be | https://github.com/kochedykov/jlibmodbus/blob/197cb39e2649e61a6fe3cb7dc91a701d847e14be/src/com/intelligt/modbus/jlibmodbus/master/ModbusMaster.java#L129-L165 | train |
kochedykov/jlibmodbus | src/com/intelligt/modbus/jlibmodbus/master/ModbusMaster.java | ModbusMaster.setResponseTimeout | public void setResponseTimeout(int timeout) {
try {
getConnection().setReadTimeout(timeout);
} catch (Exception e) {
Modbus.log().warning(e.getLocalizedMessage());
}
} | java | public void setResponseTimeout(int timeout) {
try {
getConnection().setReadTimeout(timeout);
} catch (Exception e) {
Modbus.log().warning(e.getLocalizedMessage());
}
} | [
"public",
"void",
"setResponseTimeout",
"(",
"int",
"timeout",
")",
"{",
"try",
"{",
"getConnection",
"(",
")",
".",
"setReadTimeout",
"(",
"timeout",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"Modbus",
".",
"log",
"(",
")",
".",
"warnin... | ModbusMaster will block for only this amount of time.
If the timeout expires, a ModbusTransportException is raised, though the ModbusMaster is still valid.
@param timeout the specified timeout, in milliseconds. | [
"ModbusMaster",
"will",
"block",
"for",
"only",
"this",
"amount",
"of",
"time",
".",
"If",
"the",
"timeout",
"expires",
"a",
"ModbusTransportException",
"is",
"raised",
"though",
"the",
"ModbusMaster",
"is",
"still",
"valid",
"."
] | 197cb39e2649e61a6fe3cb7dc91a701d847e14be | https://github.com/kochedykov/jlibmodbus/blob/197cb39e2649e61a6fe3cb7dc91a701d847e14be/src/com/intelligt/modbus/jlibmodbus/master/ModbusMaster.java#L173-L179 | train |
kochedykov/jlibmodbus | src/com/intelligt/modbus/jlibmodbus/master/ModbusMaster.java | ModbusMaster.readHoldingRegisters | final public int[] readHoldingRegisters(int serverAddress, int startAddress, int quantity) throws
ModbusProtocolException, ModbusNumberException, ModbusIOException {
ModbusRequest request = ModbusRequestBuilder.getInstance().buildReadHoldingRegisters(serverAddress, startAddress, quantity);
R... | java | final public int[] readHoldingRegisters(int serverAddress, int startAddress, int quantity) throws
ModbusProtocolException, ModbusNumberException, ModbusIOException {
ModbusRequest request = ModbusRequestBuilder.getInstance().buildReadHoldingRegisters(serverAddress, startAddress, quantity);
R... | [
"final",
"public",
"int",
"[",
"]",
"readHoldingRegisters",
"(",
"int",
"serverAddress",
",",
"int",
"startAddress",
",",
"int",
"quantity",
")",
"throws",
"ModbusProtocolException",
",",
"ModbusNumberException",
",",
"ModbusIOException",
"{",
"ModbusRequest",
"reques... | This function code is used to read the contents of a contiguous block of holding registers in a
remote device. The Request PDU specifies the starting register address and the number of
registers. In the PDU Registers are addressed starting at zero. Therefore registers numbered
1-16 are addressed as 0-15.
@param server... | [
"This",
"function",
"code",
"is",
"used",
"to",
"read",
"the",
"contents",
"of",
"a",
"contiguous",
"block",
"of",
"holding",
"registers",
"in",
"a",
"remote",
"device",
".",
"The",
"Request",
"PDU",
"specifies",
"the",
"starting",
"register",
"address",
"an... | 197cb39e2649e61a6fe3cb7dc91a701d847e14be | https://github.com/kochedykov/jlibmodbus/blob/197cb39e2649e61a6fe3cb7dc91a701d847e14be/src/com/intelligt/modbus/jlibmodbus/master/ModbusMaster.java#L195-L200 | train |
kochedykov/jlibmodbus | src/com/intelligt/modbus/jlibmodbus/master/ModbusMaster.java | ModbusMaster.readInputRegisters | final public int[] readInputRegisters(int serverAddress, int startAddress, int quantity) throws
ModbusProtocolException, ModbusNumberException, ModbusIOException {
ModbusRequest request = ModbusRequestBuilder.getInstance().buildReadInputRegisters(serverAddress, startAddress, quantity);
ReadH... | java | final public int[] readInputRegisters(int serverAddress, int startAddress, int quantity) throws
ModbusProtocolException, ModbusNumberException, ModbusIOException {
ModbusRequest request = ModbusRequestBuilder.getInstance().buildReadInputRegisters(serverAddress, startAddress, quantity);
ReadH... | [
"final",
"public",
"int",
"[",
"]",
"readInputRegisters",
"(",
"int",
"serverAddress",
",",
"int",
"startAddress",
",",
"int",
"quantity",
")",
"throws",
"ModbusProtocolException",
",",
"ModbusNumberException",
",",
"ModbusIOException",
"{",
"ModbusRequest",
"request"... | This function code is used to read from 1 to 125 contiguous input registers in a remote
device. The Request PDU specifies the starting register address and the number of registers.
In the PDU Registers are addressed starting at zero. Therefore input registers numbered 1-16
are addressed as 0-15.
@param serverAddress a... | [
"This",
"function",
"code",
"is",
"used",
"to",
"read",
"from",
"1",
"to",
"125",
"contiguous",
"input",
"registers",
"in",
"a",
"remote",
"device",
".",
"The",
"Request",
"PDU",
"specifies",
"the",
"starting",
"register",
"address",
"and",
"the",
"number",
... | 197cb39e2649e61a6fe3cb7dc91a701d847e14be | https://github.com/kochedykov/jlibmodbus/blob/197cb39e2649e61a6fe3cb7dc91a701d847e14be/src/com/intelligt/modbus/jlibmodbus/master/ModbusMaster.java#L216-L221 | train |
kochedykov/jlibmodbus | src/com/intelligt/modbus/jlibmodbus/master/ModbusMaster.java | ModbusMaster.readCoils | final synchronized public boolean[] readCoils(int serverAddress, int startAddress, int quantity) throws
ModbusProtocolException, ModbusNumberException, ModbusIOException {
ModbusRequest request = ModbusRequestBuilder.getInstance().buildReadCoils(serverAddress, startAddress, quantity);
ReadCo... | java | final synchronized public boolean[] readCoils(int serverAddress, int startAddress, int quantity) throws
ModbusProtocolException, ModbusNumberException, ModbusIOException {
ModbusRequest request = ModbusRequestBuilder.getInstance().buildReadCoils(serverAddress, startAddress, quantity);
ReadCo... | [
"final",
"synchronized",
"public",
"boolean",
"[",
"]",
"readCoils",
"(",
"int",
"serverAddress",
",",
"int",
"startAddress",
",",
"int",
"quantity",
")",
"throws",
"ModbusProtocolException",
",",
"ModbusNumberException",
",",
"ModbusIOException",
"{",
"ModbusRequest"... | This function code is used to read from 1 to 2000 contiguous status of coils in a remote
device. The Request PDU specifies the starting address, i.e. the address of the first coil
specified, and the number of coils. In the PDU Coils are addressed starting at zero. Therefore
coils numbered 1-16 are addressed as 0-15.
If... | [
"This",
"function",
"code",
"is",
"used",
"to",
"read",
"from",
"1",
"to",
"2000",
"contiguous",
"status",
"of",
"coils",
"in",
"a",
"remote",
"device",
".",
"The",
"Request",
"PDU",
"specifies",
"the",
"starting",
"address",
"i",
".",
"e",
".",
"the",
... | 197cb39e2649e61a6fe3cb7dc91a701d847e14be | https://github.com/kochedykov/jlibmodbus/blob/197cb39e2649e61a6fe3cb7dc91a701d847e14be/src/com/intelligt/modbus/jlibmodbus/master/ModbusMaster.java#L239-L244 | train |
kochedykov/jlibmodbus | src/com/intelligt/modbus/jlibmodbus/master/ModbusMaster.java | ModbusMaster.readDiscreteInputs | final public boolean[] readDiscreteInputs(int serverAddress, int startAddress, int quantity) throws
ModbusProtocolException, ModbusNumberException, ModbusIOException {
ModbusRequest request = ModbusRequestBuilder.getInstance().buildReadDiscreteInputs(serverAddress, startAddress, quantity);
R... | java | final public boolean[] readDiscreteInputs(int serverAddress, int startAddress, int quantity) throws
ModbusProtocolException, ModbusNumberException, ModbusIOException {
ModbusRequest request = ModbusRequestBuilder.getInstance().buildReadDiscreteInputs(serverAddress, startAddress, quantity);
R... | [
"final",
"public",
"boolean",
"[",
"]",
"readDiscreteInputs",
"(",
"int",
"serverAddress",
",",
"int",
"startAddress",
",",
"int",
"quantity",
")",
"throws",
"ModbusProtocolException",
",",
"ModbusNumberException",
",",
"ModbusIOException",
"{",
"ModbusRequest",
"requ... | This function code is used to read from 1 to 2000 contiguous status of discrete inputs in a
remote device. The Request PDU specifies the starting address, i.e. the address of the first
input specified, and the number of inputs. In the PDU Discrete Inputs are addressed starting
at zero. Therefore Discrete inputs numbere... | [
"This",
"function",
"code",
"is",
"used",
"to",
"read",
"from",
"1",
"to",
"2000",
"contiguous",
"status",
"of",
"discrete",
"inputs",
"in",
"a",
"remote",
"device",
".",
"The",
"Request",
"PDU",
"specifies",
"the",
"starting",
"address",
"i",
".",
"e",
... | 197cb39e2649e61a6fe3cb7dc91a701d847e14be | https://github.com/kochedykov/jlibmodbus/blob/197cb39e2649e61a6fe3cb7dc91a701d847e14be/src/com/intelligt/modbus/jlibmodbus/master/ModbusMaster.java#L262-L267 | train |
kochedykov/jlibmodbus | src/com/intelligt/modbus/jlibmodbus/master/ModbusMaster.java | ModbusMaster.writeSingleRegister | final public void writeSingleRegister(int serverAddress, int startAddress, int register) throws
ModbusProtocolException, ModbusNumberException, ModbusIOException {
processRequest(ModbusRequestBuilder.getInstance().buildWriteSingleRegister(serverAddress, startAddress, register));
} | java | final public void writeSingleRegister(int serverAddress, int startAddress, int register) throws
ModbusProtocolException, ModbusNumberException, ModbusIOException {
processRequest(ModbusRequestBuilder.getInstance().buildWriteSingleRegister(serverAddress, startAddress, register));
} | [
"final",
"public",
"void",
"writeSingleRegister",
"(",
"int",
"serverAddress",
",",
"int",
"startAddress",
",",
"int",
"register",
")",
"throws",
"ModbusProtocolException",
",",
"ModbusNumberException",
",",
"ModbusIOException",
"{",
"processRequest",
"(",
"ModbusReques... | This function code is used to write a single holding register in a remote device.
The Request PDU specifies the address of the register to be written. Registers are addressed
starting at zero. Therefore register numbered 1 is addressed as 0.
@param serverAddress a slave address
@param startAddress the address of the ... | [
"This",
"function",
"code",
"is",
"used",
"to",
"write",
"a",
"single",
"holding",
"register",
"in",
"a",
"remote",
"device",
".",
"The",
"Request",
"PDU",
"specifies",
"the",
"address",
"of",
"the",
"register",
"to",
"be",
"written",
".",
"Registers",
"ar... | 197cb39e2649e61a6fe3cb7dc91a701d847e14be | https://github.com/kochedykov/jlibmodbus/blob/197cb39e2649e61a6fe3cb7dc91a701d847e14be/src/com/intelligt/modbus/jlibmodbus/master/ModbusMaster.java#L300-L303 | train |
kochedykov/jlibmodbus | src/com/intelligt/modbus/jlibmodbus/master/ModbusMaster.java | ModbusMaster.readWriteMultipleRegisters | final public int[] readWriteMultipleRegisters(int serverAddress, int readAddress, int readQuantity, int writeAddress, int[] registers) throws
ModbusProtocolException, ModbusNumberException, ModbusIOException {
ModbusRequest request = ModbusRequestBuilder.getInstance().buildReadWriteMultipleRegisters... | java | final public int[] readWriteMultipleRegisters(int serverAddress, int readAddress, int readQuantity, int writeAddress, int[] registers) throws
ModbusProtocolException, ModbusNumberException, ModbusIOException {
ModbusRequest request = ModbusRequestBuilder.getInstance().buildReadWriteMultipleRegisters... | [
"final",
"public",
"int",
"[",
"]",
"readWriteMultipleRegisters",
"(",
"int",
"serverAddress",
",",
"int",
"readAddress",
",",
"int",
"readQuantity",
",",
"int",
"writeAddress",
",",
"int",
"[",
"]",
"registers",
")",
"throws",
"ModbusProtocolException",
",",
"M... | This function code performs a combination of one read operation and one write operation in a
single MODBUS transaction. The write operation is performed before the read.
Holding registers are addressed starting at zero. Therefore holding registers 1-16 are
addressed in the PDU as 0-15.
The request specifies the startin... | [
"This",
"function",
"code",
"performs",
"a",
"combination",
"of",
"one",
"read",
"operation",
"and",
"one",
"write",
"operation",
"in",
"a",
"single",
"MODBUS",
"transaction",
".",
"The",
"write",
"operation",
"is",
"performed",
"before",
"the",
"read",
".",
... | 197cb39e2649e61a6fe3cb7dc91a701d847e14be | https://github.com/kochedykov/jlibmodbus/blob/197cb39e2649e61a6fe3cb7dc91a701d847e14be/src/com/intelligt/modbus/jlibmodbus/master/ModbusMaster.java#L361-L366 | train |
kochedykov/jlibmodbus | src/com/intelligt/modbus/jlibmodbus/master/ModbusMaster.java | ModbusMaster.readFileRecord | final public ModbusFileRecord[] readFileRecord(int serverAddress, ModbusFileRecord[] records) throws
ModbusProtocolException, ModbusNumberException, ModbusIOException {
ModbusRequest request = ModbusRequestBuilder.getInstance().buildReadFileRecord(serverAddress, records);
ReadFileRecordRespo... | java | final public ModbusFileRecord[] readFileRecord(int serverAddress, ModbusFileRecord[] records) throws
ModbusProtocolException, ModbusNumberException, ModbusIOException {
ModbusRequest request = ModbusRequestBuilder.getInstance().buildReadFileRecord(serverAddress, records);
ReadFileRecordRespo... | [
"final",
"public",
"ModbusFileRecord",
"[",
"]",
"readFileRecord",
"(",
"int",
"serverAddress",
",",
"ModbusFileRecord",
"[",
"]",
"records",
")",
"throws",
"ModbusProtocolException",
",",
"ModbusNumberException",
",",
"ModbusIOException",
"{",
"ModbusRequest",
"request... | This function code is used to perform a file record read.
A file is an organization of records. Each file contains 10000 records, addressed 0000 to
9999 decimal or 0X0000 to 0X270F. For example, record 12 is addressed as 12.
The function can read multiple groups of references.
@param serverAddress a slave address
@par... | [
"This",
"function",
"code",
"is",
"used",
"to",
"perform",
"a",
"file",
"record",
"read",
".",
"A",
"file",
"is",
"an",
"organization",
"of",
"records",
".",
"Each",
"file",
"contains",
"10000",
"records",
"addressed",
"0000",
"to",
"9999",
"decimal",
"or"... | 197cb39e2649e61a6fe3cb7dc91a701d847e14be | https://github.com/kochedykov/jlibmodbus/blob/197cb39e2649e61a6fe3cb7dc91a701d847e14be/src/com/intelligt/modbus/jlibmodbus/master/ModbusMaster.java#L403-L408 | train |
kochedykov/jlibmodbus | src/com/intelligt/modbus/jlibmodbus/master/ModbusMaster.java | ModbusMaster.writeFileRecord | final public void writeFileRecord(int serverAddress, ModbusFileRecord record) throws
ModbusProtocolException, ModbusNumberException, ModbusIOException {
processRequest(ModbusRequestBuilder.getInstance().buildWriteFileRecord(serverAddress, record));
} | java | final public void writeFileRecord(int serverAddress, ModbusFileRecord record) throws
ModbusProtocolException, ModbusNumberException, ModbusIOException {
processRequest(ModbusRequestBuilder.getInstance().buildWriteFileRecord(serverAddress, record));
} | [
"final",
"public",
"void",
"writeFileRecord",
"(",
"int",
"serverAddress",
",",
"ModbusFileRecord",
"record",
")",
"throws",
"ModbusProtocolException",
",",
"ModbusNumberException",
",",
"ModbusIOException",
"{",
"processRequest",
"(",
"ModbusRequestBuilder",
".",
"getIns... | This function code is used to perform a file record write. All Request Data Lengths are
provided in terms of number of bytes and all Record Lengths are provided in terms of the
number of 16-bit words.
A file is an organization of records. Each file contains 10000 records, addressed 0000 to
9999 decimal or 0X0000 to 0X2... | [
"This",
"function",
"code",
"is",
"used",
"to",
"perform",
"a",
"file",
"record",
"write",
".",
"All",
"Request",
"Data",
"Lengths",
"are",
"provided",
"in",
"terms",
"of",
"number",
"of",
"bytes",
"and",
"all",
"Record",
"Lengths",
"are",
"provided",
"in"... | 197cb39e2649e61a6fe3cb7dc91a701d847e14be | https://github.com/kochedykov/jlibmodbus/blob/197cb39e2649e61a6fe3cb7dc91a701d847e14be/src/com/intelligt/modbus/jlibmodbus/master/ModbusMaster.java#L424-L427 | train |
kochedykov/jlibmodbus | src/com/intelligt/modbus/jlibmodbus/Modbus.java | Modbus.setLogLevel | static public void setLogLevel(LogLevel level) {
logLevel = level;
log.setLevel(level.value());
for (Handler handler : log.getHandlers()) {
handler.setLevel(level.value());
}
} | java | static public void setLogLevel(LogLevel level) {
logLevel = level;
log.setLevel(level.value());
for (Handler handler : log.getHandlers()) {
handler.setLevel(level.value());
}
} | [
"static",
"public",
"void",
"setLogLevel",
"(",
"LogLevel",
"level",
")",
"{",
"logLevel",
"=",
"level",
";",
"log",
".",
"setLevel",
"(",
"level",
".",
"value",
"(",
")",
")",
";",
"for",
"(",
"Handler",
"handler",
":",
"log",
".",
"getHandlers",
"(",... | changes the log level for all loggers used
@param level - LogLevel instance
@see Modbus.LogLevel | [
"changes",
"the",
"log",
"level",
"for",
"all",
"loggers",
"used"
] | 197cb39e2649e61a6fe3cb7dc91a701d847e14be | https://github.com/kochedykov/jlibmodbus/blob/197cb39e2649e61a6fe3cb7dc91a701d847e14be/src/com/intelligt/modbus/jlibmodbus/Modbus.java#L127-L133 | train |
kochedykov/jlibmodbus | src/com/intelligt/modbus/jlibmodbus/Modbus.java | Modbus.checkServerAddress | static public boolean checkServerAddress(int serverAddress) {
/*
* hook for server address is equals zero:
* some of modbus tcp slaves sets the UnitId value to zero, not ignoring value in this field.
*/
switch (serverAddress) {
case 0x00:
//Modbus.log(... | java | static public boolean checkServerAddress(int serverAddress) {
/*
* hook for server address is equals zero:
* some of modbus tcp slaves sets the UnitId value to zero, not ignoring value in this field.
*/
switch (serverAddress) {
case 0x00:
//Modbus.log(... | [
"static",
"public",
"boolean",
"checkServerAddress",
"(",
"int",
"serverAddress",
")",
"{",
"/*\n * hook for server address is equals zero:\n * some of modbus tcp slaves sets the UnitId value to zero, not ignoring value in this field.\n */",
"switch",
"(",
"serverAddress... | validates address of server
@param serverAddress - The modbus server address
@return "true" if serverAddress is correct, else "false". | [
"validates",
"address",
"of",
"server"
] | 197cb39e2649e61a6fe3cb7dc91a701d847e14be | https://github.com/kochedykov/jlibmodbus/blob/197cb39e2649e61a6fe3cb7dc91a701d847e14be/src/com/intelligt/modbus/jlibmodbus/Modbus.java#L174-L189 | train |
kochedykov/jlibmodbus | src/com/intelligt/modbus/jlibmodbus/net/stream/base/ModbusInputStream.java | ModbusInputStream.readShortBE | public int readShortBE() throws IOException {
int h = read();
int l = read();
if (-1 == h || -1 == l)
return -1;
return DataUtils.toShort(h, l);
} | java | public int readShortBE() throws IOException {
int h = read();
int l = read();
if (-1 == h || -1 == l)
return -1;
return DataUtils.toShort(h, l);
} | [
"public",
"int",
"readShortBE",
"(",
")",
"throws",
"IOException",
"{",
"int",
"h",
"=",
"read",
"(",
")",
";",
"int",
"l",
"=",
"read",
"(",
")",
";",
"if",
"(",
"-",
"1",
"==",
"h",
"||",
"-",
"1",
"==",
"l",
")",
"return",
"-",
"1",
";",
... | read two bytes in Big Endian Byte Order
@return 16-bit value placed in first two bytes of integer value, second two bytes is equal zero.
@throws IOException
@see ModbusInputStream#readShortLE() | [
"read",
"two",
"bytes",
"in",
"Big",
"Endian",
"Byte",
"Order"
] | 197cb39e2649e61a6fe3cb7dc91a701d847e14be | https://github.com/kochedykov/jlibmodbus/blob/197cb39e2649e61a6fe3cb7dc91a701d847e14be/src/com/intelligt/modbus/jlibmodbus/net/stream/base/ModbusInputStream.java#L67-L73 | train |
kochedykov/jlibmodbus | src/com/intelligt/modbus/jlibmodbus/net/stream/base/ModbusInputStream.java | ModbusInputStream.readShortLE | public int readShortLE() throws IOException {
int l = read();
int h = read();
if (-1 == h || -1 == l)
return -1;
return DataUtils.toShort(h, l);
} | java | public int readShortLE() throws IOException {
int l = read();
int h = read();
if (-1 == h || -1 == l)
return -1;
return DataUtils.toShort(h, l);
} | [
"public",
"int",
"readShortLE",
"(",
")",
"throws",
"IOException",
"{",
"int",
"l",
"=",
"read",
"(",
")",
";",
"int",
"h",
"=",
"read",
"(",
")",
";",
"if",
"(",
"-",
"1",
"==",
"h",
"||",
"-",
"1",
"==",
"l",
")",
"return",
"-",
"1",
";",
... | read two bytes in Little Endian Byte Order
@return 16-bit value placed in first two bytes of integer value, second two bytes is equal zero.
@throws IOException
@see ModbusInputStream#readShortBE() | [
"read",
"two",
"bytes",
"in",
"Little",
"Endian",
"Byte",
"Order"
] | 197cb39e2649e61a6fe3cb7dc91a701d847e14be | https://github.com/kochedykov/jlibmodbus/blob/197cb39e2649e61a6fe3cb7dc91a701d847e14be/src/com/intelligt/modbus/jlibmodbus/net/stream/base/ModbusInputStream.java#L82-L88 | train |
AzureAD/azure-activedirectory-library-for-java | src/main/java/com/microsoft/aad/adal4j/AuthenticationContext.java | AuthenticationContext.acquireToken | public Future<AuthenticationResult> acquireToken(final String resource,
final UserAssertion userAssertion, final ClientCredential credential,
final AuthenticationCallback callback) {
this.validateOnBehalfOfRequestInput(resource, userAssertion, credential, true);
final Clien... | java | public Future<AuthenticationResult> acquireToken(final String resource,
final UserAssertion userAssertion, final ClientCredential credential,
final AuthenticationCallback callback) {
this.validateOnBehalfOfRequestInput(resource, userAssertion, credential, true);
final Clien... | [
"public",
"Future",
"<",
"AuthenticationResult",
">",
"acquireToken",
"(",
"final",
"String",
"resource",
",",
"final",
"UserAssertion",
"userAssertion",
",",
"final",
"ClientCredential",
"credential",
",",
"final",
"AuthenticationCallback",
"callback",
")",
"{",
"thi... | Acquires an access token from the authority on behalf of a user. It
requires using a user token previously received.
@param resource
Identifier of the target resource that is the recipient of the
requested token.
@param userAssertion
userAssertion to use as Authorization grant
@param credential
The client credential t... | [
"Acquires",
"an",
"access",
"token",
"from",
"the",
"authority",
"on",
"behalf",
"of",
"a",
"user",
".",
"It",
"requires",
"using",
"a",
"user",
"token",
"previously",
"received",
"."
] | 7f0004fee6faee5818e75623113993a267ceb1c4 | https://github.com/AzureAD/azure-activedirectory-library-for-java/blob/7f0004fee6faee5818e75623113993a267ceb1c4/src/main/java/com/microsoft/aad/adal4j/AuthenticationContext.java#L266-L275 | train |
AzureAD/azure-activedirectory-library-for-java | src/main/java/com/microsoft/aad/adal4j/AuthenticationContext.java | AuthenticationContext.acquireToken | public Future<AuthenticationResult> acquireToken(final String resource,
final UserAssertion userAssertion,
final AsymmetricKeyCredential credential,
final Aut... | java | public Future<AuthenticationResult> acquireToken(final String resource,
final UserAssertion userAssertion,
final AsymmetricKeyCredential credential,
final Aut... | [
"public",
"Future",
"<",
"AuthenticationResult",
">",
"acquireToken",
"(",
"final",
"String",
"resource",
",",
"final",
"UserAssertion",
"userAssertion",
",",
"final",
"AsymmetricKeyCredential",
"credential",
",",
"final",
"AuthenticationCallback",
"callback",
")",
"{",... | Acquires an access token from the authority on behalf of a user. It
requires using a user token previously received. Uses certificate to
authenticate client.
@param resource
Identifier of the target resource that is the recipient of the
requested token.
@param userAssertion
userAssertion to use as Authorization grant
... | [
"Acquires",
"an",
"access",
"token",
"from",
"the",
"authority",
"on",
"behalf",
"of",
"a",
"user",
".",
"It",
"requires",
"using",
"a",
"user",
"token",
"previously",
"received",
".",
"Uses",
"certificate",
"to",
"authenticate",
"client",
"."
] | 7f0004fee6faee5818e75623113993a267ceb1c4 | https://github.com/AzureAD/azure-activedirectory-library-for-java/blob/7f0004fee6faee5818e75623113993a267ceb1c4/src/main/java/com/microsoft/aad/adal4j/AuthenticationContext.java#L297-L307 | train |
AzureAD/azure-activedirectory-library-for-java | src/main/java/com/microsoft/aad/adal4j/AuthenticationContext.java | AuthenticationContext.acquireDeviceCode | public Future<DeviceCode> acquireDeviceCode(final String clientId, final String resource,
final AuthenticationCallback<DeviceCode> callback) {
validateDeviceCodeRequestInput(clientId, resource);
return service.submit(
new AcquireDeviceC... | java | public Future<DeviceCode> acquireDeviceCode(final String clientId, final String resource,
final AuthenticationCallback<DeviceCode> callback) {
validateDeviceCodeRequestInput(clientId, resource);
return service.submit(
new AcquireDeviceC... | [
"public",
"Future",
"<",
"DeviceCode",
">",
"acquireDeviceCode",
"(",
"final",
"String",
"clientId",
",",
"final",
"String",
"resource",
",",
"final",
"AuthenticationCallback",
"<",
"DeviceCode",
">",
"callback",
")",
"{",
"validateDeviceCodeRequestInput",
"(",
"cli... | Acquires a device code from the authority
@param clientId Identifier of the client requesting the token
@param resource Identifier of the target resource that is the recipient of the
requested token.
@param callback optional callback object for non-blocking execution.
@return A {@link Future} object representing the {... | [
"Acquires",
"a",
"device",
"code",
"from",
"the",
"authority"
] | 7f0004fee6faee5818e75623113993a267ceb1c4 | https://github.com/AzureAD/azure-activedirectory-library-for-java/blob/7f0004fee6faee5818e75623113993a267ceb1c4/src/main/java/com/microsoft/aad/adal4j/AuthenticationContext.java#L620-L625 | train |
AzureAD/azure-activedirectory-library-for-java | src/main/java/com/microsoft/aad/adal4j/AuthenticationContext.java | AuthenticationContext.acquireTokenByDeviceCode | public Future<AuthenticationResult> acquireTokenByDeviceCode(
final DeviceCode deviceCode, final AuthenticationCallback callback)
throws AuthenticationException {
final ClientAuthentication clientAuth = new ClientAuthenticationPost(
ClientAuthenticationMethod.NONE, ... | java | public Future<AuthenticationResult> acquireTokenByDeviceCode(
final DeviceCode deviceCode, final AuthenticationCallback callback)
throws AuthenticationException {
final ClientAuthentication clientAuth = new ClientAuthenticationPost(
ClientAuthenticationMethod.NONE, ... | [
"public",
"Future",
"<",
"AuthenticationResult",
">",
"acquireTokenByDeviceCode",
"(",
"final",
"DeviceCode",
"deviceCode",
",",
"final",
"AuthenticationCallback",
"callback",
")",
"throws",
"AuthenticationException",
"{",
"final",
"ClientAuthentication",
"clientAuth",
"=",... | Acquires security token from the authority using an device code previously received.
@param deviceCode The device code result received from calling acquireDeviceCode.
@param callback optional callback object for non-blocking execution.
@return A {@link Future} object representing the {@link AuthenticationResult} of ... | [
"Acquires",
"security",
"token",
"from",
"the",
"authority",
"using",
"an",
"device",
"code",
"previously",
"received",
"."
] | 7f0004fee6faee5818e75623113993a267ceb1c4 | https://github.com/AzureAD/azure-activedirectory-library-for-java/blob/7f0004fee6faee5818e75623113993a267ceb1c4/src/main/java/com/microsoft/aad/adal4j/AuthenticationContext.java#L640-L652 | train |
AzureAD/azure-activedirectory-library-for-java | src/main/java/com/microsoft/aad/adal4j/AuthenticationContext.java | AuthenticationContext.acquireTokenByRefreshToken | public Future<AuthenticationResult> acquireTokenByRefreshToken(
final String refreshToken, final String clientId,
final String resource, final AuthenticationCallback callback) {
final ClientAuthentication clientAuth = new ClientAuthenticationPost(
ClientAuthenticati... | java | public Future<AuthenticationResult> acquireTokenByRefreshToken(
final String refreshToken, final String clientId,
final String resource, final AuthenticationCallback callback) {
final ClientAuthentication clientAuth = new ClientAuthenticationPost(
ClientAuthenticati... | [
"public",
"Future",
"<",
"AuthenticationResult",
">",
"acquireTokenByRefreshToken",
"(",
"final",
"String",
"refreshToken",
",",
"final",
"String",
"clientId",
",",
"final",
"String",
"resource",
",",
"final",
"AuthenticationCallback",
"callback",
")",
"{",
"final",
... | Acquires a security token from the authority using a Refresh Token
previously received. This method is suitable for the daemon OAuth2
flow when a client secret is not possible.
@param refreshToken
Refresh Token to use in the refresh flow.
@param clientId
Name or ID of the client requesting the token.
@param resource
I... | [
"Acquires",
"a",
"security",
"token",
"from",
"the",
"authority",
"using",
"a",
"Refresh",
"Token",
"previously",
"received",
".",
"This",
"method",
"is",
"suitable",
"for",
"the",
"daemon",
"OAuth2",
"flow",
"when",
"a",
"client",
"secret",
"is",
"not",
"po... | 7f0004fee6faee5818e75623113993a267ceb1c4 | https://github.com/AzureAD/azure-activedirectory-library-for-java/blob/7f0004fee6faee5818e75623113993a267ceb1c4/src/main/java/com/microsoft/aad/adal4j/AuthenticationContext.java#L888-L897 | train |
AzureAD/azure-activedirectory-library-for-java | src/main/java/com/microsoft/aad/adal4j/AdalDeviceCodeAuthorizationGrant.java | AdalDeviceCodeAuthorizationGrant.toParameters | @Override
public Map<String, List<String>> toParameters() {
final Map<String, List<String>> outParams = new LinkedHashMap<>();
outParams.put("resource", Collections.singletonList(resource));
outParams.put("grant_type", Collections.singletonList(GRANT_TYPE) );
outParams.put("code", Co... | java | @Override
public Map<String, List<String>> toParameters() {
final Map<String, List<String>> outParams = new LinkedHashMap<>();
outParams.put("resource", Collections.singletonList(resource));
outParams.put("grant_type", Collections.singletonList(GRANT_TYPE) );
outParams.put("code", Co... | [
"@",
"Override",
"public",
"Map",
"<",
"String",
",",
"List",
"<",
"String",
">",
">",
"toParameters",
"(",
")",
"{",
"final",
"Map",
"<",
"String",
",",
"List",
"<",
"String",
">",
">",
"outParams",
"=",
"new",
"LinkedHashMap",
"<>",
"(",
")",
";",
... | Converts the device code grant to a map of HTTP paramters.
@return The map with HTTP parameters. | [
"Converts",
"the",
"device",
"code",
"grant",
"to",
"a",
"map",
"of",
"HTTP",
"paramters",
"."
] | 7f0004fee6faee5818e75623113993a267ceb1c4 | https://github.com/AzureAD/azure-activedirectory-library-for-java/blob/7f0004fee6faee5818e75623113993a267ceb1c4/src/main/java/com/microsoft/aad/adal4j/AdalDeviceCodeAuthorizationGrant.java#L63-L71 | train |
AzureAD/azure-activedirectory-library-for-java | src/samples/web-app-samples-for-adal4j/src/main/java/com/microsoft/aad/adal4jsample/HttpClientHelper.java | HttpClientHelper.processBadRespStr | public static JSONObject processBadRespStr(int responseCode, String responseMsg) throws JSONException {
JSONObject response = new JSONObject();
response.put("responseCode", responseCode);
if (responseMsg.equalsIgnoreCase("")) { // good response is empty string
response.put("res... | java | public static JSONObject processBadRespStr(int responseCode, String responseMsg) throws JSONException {
JSONObject response = new JSONObject();
response.put("responseCode", responseCode);
if (responseMsg.equalsIgnoreCase("")) { // good response is empty string
response.put("res... | [
"public",
"static",
"JSONObject",
"processBadRespStr",
"(",
"int",
"responseCode",
",",
"String",
"responseMsg",
")",
"throws",
"JSONException",
"{",
"JSONObject",
"response",
"=",
"new",
"JSONObject",
"(",
")",
";",
"response",
".",
"put",
"(",
"\"responseCode\""... | for good response
@param responseCode
@param responseMsg
@return
@throws JSONException | [
"for",
"good",
"response"
] | 7f0004fee6faee5818e75623113993a267ceb1c4 | https://github.com/AzureAD/azure-activedirectory-library-for-java/blob/7f0004fee6faee5818e75623113993a267ceb1c4/src/samples/web-app-samples-for-adal4j/src/main/java/com/microsoft/aad/adal4jsample/HttpClientHelper.java#L153-L170 | train |
AzureAD/azure-activedirectory-library-for-java | src/main/java/com/microsoft/aad/adal4j/JwtHelper.java | JwtHelper.buildJwt | static ClientAssertion buildJwt(final AsymmetricKeyCredential credential,
final String jwtAudience) throws AuthenticationException {
if (credential == null) {
throw new IllegalArgumentException("credential is null");
}
final long time = System.currentTimeMillis();
... | java | static ClientAssertion buildJwt(final AsymmetricKeyCredential credential,
final String jwtAudience) throws AuthenticationException {
if (credential == null) {
throw new IllegalArgumentException("credential is null");
}
final long time = System.currentTimeMillis();
... | [
"static",
"ClientAssertion",
"buildJwt",
"(",
"final",
"AsymmetricKeyCredential",
"credential",
",",
"final",
"String",
"jwtAudience",
")",
"throws",
"AuthenticationException",
"{",
"if",
"(",
"credential",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentExcep... | Builds JWT object.
@param credential
@return
@throws AuthenticationException | [
"Builds",
"JWT",
"object",
"."
] | 7f0004fee6faee5818e75623113993a267ceb1c4 | https://github.com/AzureAD/azure-activedirectory-library-for-java/blob/7f0004fee6faee5818e75623113993a267ceb1c4/src/main/java/com/microsoft/aad/adal4j/JwtHelper.java#L52-L89 | train |
AzureAD/azure-activedirectory-library-for-java | src/samples/web-app-samples-for-adal4j/src/main/java/com/microsoft/aad/adal4jsample/JSONHelper.java | JSONHelper.fetchDirectoryObjectJSONArray | public static JSONArray fetchDirectoryObjectJSONArray(JSONObject jsonObject) throws Exception {
JSONArray jsonArray = new JSONArray();
jsonArray = jsonObject.optJSONObject("responseMsg").optJSONArray("value");
return jsonArray;
} | java | public static JSONArray fetchDirectoryObjectJSONArray(JSONObject jsonObject) throws Exception {
JSONArray jsonArray = new JSONArray();
jsonArray = jsonObject.optJSONObject("responseMsg").optJSONArray("value");
return jsonArray;
} | [
"public",
"static",
"JSONArray",
"fetchDirectoryObjectJSONArray",
"(",
"JSONObject",
"jsonObject",
")",
"throws",
"Exception",
"{",
"JSONArray",
"jsonArray",
"=",
"new",
"JSONArray",
"(",
")",
";",
"jsonArray",
"=",
"jsonObject",
".",
"optJSONObject",
"(",
"\"respon... | This method parses an JSON Array out of a collection of JSON Objects
within a string.
@param jSonData
The JSON String that holds the collection.
@return An JSON Array that would contains all the collection object.
@throws Exception | [
"This",
"method",
"parses",
"an",
"JSON",
"Array",
"out",
"of",
"a",
"collection",
"of",
"JSON",
"Objects",
"within",
"a",
"string",
"."
] | 7f0004fee6faee5818e75623113993a267ceb1c4 | https://github.com/AzureAD/azure-activedirectory-library-for-java/blob/7f0004fee6faee5818e75623113993a267ceb1c4/src/samples/web-app-samples-for-adal4j/src/main/java/com/microsoft/aad/adal4jsample/JSONHelper.java#L63-L67 | train |
AzureAD/azure-activedirectory-library-for-java | src/samples/web-app-samples-for-adal4j/src/main/java/com/microsoft/aad/adal4jsample/JSONHelper.java | JSONHelper.fetchDirectoryObjectJSONObject | public static JSONObject fetchDirectoryObjectJSONObject(JSONObject jsonObject) throws Exception {
JSONObject jObj = new JSONObject();
jObj = jsonObject.optJSONObject("responseMsg");
return jObj;
} | java | public static JSONObject fetchDirectoryObjectJSONObject(JSONObject jsonObject) throws Exception {
JSONObject jObj = new JSONObject();
jObj = jsonObject.optJSONObject("responseMsg");
return jObj;
} | [
"public",
"static",
"JSONObject",
"fetchDirectoryObjectJSONObject",
"(",
"JSONObject",
"jsonObject",
")",
"throws",
"Exception",
"{",
"JSONObject",
"jObj",
"=",
"new",
"JSONObject",
"(",
")",
";",
"jObj",
"=",
"jsonObject",
".",
"optJSONObject",
"(",
"\"responseMsg\... | This method parses an JSON Object out of a collection of JSON Objects
within a string
@param jsonObject
@return An JSON Object that would contains the DirectoryObject.
@throws Exception | [
"This",
"method",
"parses",
"an",
"JSON",
"Object",
"out",
"of",
"a",
"collection",
"of",
"JSON",
"Objects",
"within",
"a",
"string"
] | 7f0004fee6faee5818e75623113993a267ceb1c4 | https://github.com/AzureAD/azure-activedirectory-library-for-java/blob/7f0004fee6faee5818e75623113993a267ceb1c4/src/samples/web-app-samples-for-adal4j/src/main/java/com/microsoft/aad/adal4jsample/JSONHelper.java#L77-L81 | train |
AzureAD/azure-activedirectory-library-for-java | src/samples/web-app-samples-for-adal4j/src/main/java/com/microsoft/aad/adal4jsample/JSONHelper.java | JSONHelper.fetchNextSkiptoken | public static String fetchNextSkiptoken(JSONObject jsonObject) throws Exception {
String skipToken = "";
// Parse the skip token out of the string.
skipToken = jsonObject.optJSONObject("responseMsg").optString("odata.nextLink");
if (!skipToken.equalsIgnoreCase("")) {
/... | java | public static String fetchNextSkiptoken(JSONObject jsonObject) throws Exception {
String skipToken = "";
// Parse the skip token out of the string.
skipToken = jsonObject.optJSONObject("responseMsg").optString("odata.nextLink");
if (!skipToken.equalsIgnoreCase("")) {
/... | [
"public",
"static",
"String",
"fetchNextSkiptoken",
"(",
"JSONObject",
"jsonObject",
")",
"throws",
"Exception",
"{",
"String",
"skipToken",
"=",
"\"\"",
";",
"// Parse the skip token out of the string.\r",
"skipToken",
"=",
"jsonObject",
".",
"optJSONObject",
"(",
"\"r... | This method parses the skip token from a json formatted string.
@param jsonData
The JSON Formatted String.
@return The skipToken.
@throws Exception | [
"This",
"method",
"parses",
"the",
"skip",
"token",
"from",
"a",
"json",
"formatted",
"string",
"."
] | 7f0004fee6faee5818e75623113993a267ceb1c4 | https://github.com/AzureAD/azure-activedirectory-library-for-java/blob/7f0004fee6faee5818e75623113993a267ceb1c4/src/samples/web-app-samples-for-adal4j/src/main/java/com/microsoft/aad/adal4jsample/JSONHelper.java#L91-L102 | train |
AzureAD/azure-activedirectory-library-for-java | src/samples/web-app-samples-for-adal4j/src/main/java/com/microsoft/aad/adal4jsample/JSONHelper.java | JSONHelper.createJSONString | public static String createJSONString(HttpServletRequest request, String controller) throws Exception {
JSONObject obj = new JSONObject();
try {
Field[] allFields = Class.forName(
"com.microsoft.windowsazure.activedirectory.sdk.graph.models." + controller).getDeclared... | java | public static String createJSONString(HttpServletRequest request, String controller) throws Exception {
JSONObject obj = new JSONObject();
try {
Field[] allFields = Class.forName(
"com.microsoft.windowsazure.activedirectory.sdk.graph.models." + controller).getDeclared... | [
"public",
"static",
"String",
"createJSONString",
"(",
"HttpServletRequest",
"request",
",",
"String",
"controller",
")",
"throws",
"Exception",
"{",
"JSONObject",
"obj",
"=",
"new",
"JSONObject",
"(",
")",
";",
"try",
"{",
"Field",
"[",
"]",
"allFields",
"=",... | This method would create a string consisting of a JSON document with all
the necessary elements set from the HttpServletRequest request.
@param request
The HttpServletRequest
@return the string containing the JSON document.
@throws Exception
If there is any error processing the request. | [
"This",
"method",
"would",
"create",
"a",
"string",
"consisting",
"of",
"a",
"JSON",
"document",
"with",
"all",
"the",
"necessary",
"elements",
"set",
"from",
"the",
"HttpServletRequest",
"request",
"."
] | 7f0004fee6faee5818e75623113993a267ceb1c4 | https://github.com/AzureAD/azure-activedirectory-library-for-java/blob/7f0004fee6faee5818e75623113993a267ceb1c4/src/samples/web-app-samples-for-adal4j/src/main/java/com/microsoft/aad/adal4jsample/JSONHelper.java#L136-L175 | train |
AzureAD/azure-activedirectory-library-for-java | src/samples/web-app-samples-for-adal4j/src/main/java/com/microsoft/aad/adal4jsample/JSONHelper.java | JSONHelper.convertJSONObjectToDirectoryObject | public static <T> void convertJSONObjectToDirectoryObject(JSONObject jsonObject, T destObject) throws Exception {
// Get the list of all the field names.
Field[] fieldList = destObject.getClass().getDeclaredFields();
// For all the declared field.
for (int i = 0; i < fieldList.le... | java | public static <T> void convertJSONObjectToDirectoryObject(JSONObject jsonObject, T destObject) throws Exception {
// Get the list of all the field names.
Field[] fieldList = destObject.getClass().getDeclaredFields();
// For all the declared field.
for (int i = 0; i < fieldList.le... | [
"public",
"static",
"<",
"T",
">",
"void",
"convertJSONObjectToDirectoryObject",
"(",
"JSONObject",
"jsonObject",
",",
"T",
"destObject",
")",
"throws",
"Exception",
"{",
"// Get the list of all the field names.\r",
"Field",
"[",
"]",
"fieldList",
"=",
"destObject",
"... | This is a generic method that copies the simple attribute values from an
argument jsonObject to an argument generic object.
@param jsonObject
The jsonObject from where the attributes are to be copied.
@param destObject
The object where the attributes should be copied into.
@throws Exception
Throws a Exception when the... | [
"This",
"is",
"a",
"generic",
"method",
"that",
"copies",
"the",
"simple",
"attribute",
"values",
"from",
"an",
"argument",
"jsonObject",
"to",
"an",
"argument",
"generic",
"object",
"."
] | 7f0004fee6faee5818e75623113993a267ceb1c4 | https://github.com/AzureAD/azure-activedirectory-library-for-java/blob/7f0004fee6faee5818e75623113993a267ceb1c4/src/samples/web-app-samples-for-adal4j/src/main/java/com/microsoft/aad/adal4jsample/JSONHelper.java#L207-L226 | train |
AzureAD/azure-activedirectory-library-for-java | src/main/java/com/microsoft/aad/adal4j/AsymmetricKeyCredential.java | AsymmetricKeyCredential.getPublicCertificateHash | public String getPublicCertificateHash()
throws CertificateEncodingException, NoSuchAlgorithmException {
return Base64.encodeBase64String(AsymmetricKeyCredential
.getHash(this.publicCertificate.getEncoded()));
} | java | public String getPublicCertificateHash()
throws CertificateEncodingException, NoSuchAlgorithmException {
return Base64.encodeBase64String(AsymmetricKeyCredential
.getHash(this.publicCertificate.getEncoded()));
} | [
"public",
"String",
"getPublicCertificateHash",
"(",
")",
"throws",
"CertificateEncodingException",
",",
"NoSuchAlgorithmException",
"{",
"return",
"Base64",
".",
"encodeBase64String",
"(",
"AsymmetricKeyCredential",
".",
"getHash",
"(",
"this",
".",
"publicCertificate",
... | Base64 encoded hash of the the public certificate.
@return base64 encoded string
@throws CertificateEncodingException if an encoding error occurs
@throws NoSuchAlgorithmException if requested algorithm is not available in the environment | [
"Base64",
"encoded",
"hash",
"of",
"the",
"the",
"public",
"certificate",
"."
] | 7f0004fee6faee5818e75623113993a267ceb1c4 | https://github.com/AzureAD/azure-activedirectory-library-for-java/blob/7f0004fee6faee5818e75623113993a267ceb1c4/src/main/java/com/microsoft/aad/adal4j/AsymmetricKeyCredential.java#L122-L126 | train |
AzureAD/azure-activedirectory-library-for-java | src/main/java/com/microsoft/aad/adal4j/DeviceCodeTokenErrorResponse.java | DeviceCodeTokenErrorResponse.isDeviceCodeError | public boolean isDeviceCodeError() {
ErrorObject errorObject = getErrorObject();
if (errorObject == null) {
return false;
}
String code = errorObject.getCode();
if (code == null) {
return false;
}
switch (code) {
case "authoriza... | java | public boolean isDeviceCodeError() {
ErrorObject errorObject = getErrorObject();
if (errorObject == null) {
return false;
}
String code = errorObject.getCode();
if (code == null) {
return false;
}
switch (code) {
case "authoriza... | [
"public",
"boolean",
"isDeviceCodeError",
"(",
")",
"{",
"ErrorObject",
"errorObject",
"=",
"getErrorObject",
"(",
")",
";",
"if",
"(",
"errorObject",
"==",
"null",
")",
"{",
"return",
"false",
";",
"}",
"String",
"code",
"=",
"errorObject",
".",
"getCode",
... | Checks if is a device code error.
@return true if is one of the well known device code error code, otherwise false. | [
"Checks",
"if",
"is",
"a",
"device",
"code",
"error",
"."
] | 7f0004fee6faee5818e75623113993a267ceb1c4 | https://github.com/AzureAD/azure-activedirectory-library-for-java/blob/7f0004fee6faee5818e75623113993a267ceb1c4/src/main/java/com/microsoft/aad/adal4j/DeviceCodeTokenErrorResponse.java#L51-L69 | train |
AzureAD/azure-activedirectory-library-for-java | src/samples/web-app-samples-for-adal4j/src/main/java/com/microsoft/aad/adal4jsample/BasicFilter.java | BasicFilter.validateState | private StateData validateState(HttpSession session, String state) throws Exception {
if (StringUtils.isNotEmpty(state)) {
StateData stateDataInSession = removeStateFromSession(session, state);
if (stateDataInSession != null) {
return stateDataInSession;
... | java | private StateData validateState(HttpSession session, String state) throws Exception {
if (StringUtils.isNotEmpty(state)) {
StateData stateDataInSession = removeStateFromSession(session, state);
if (stateDataInSession != null) {
return stateDataInSession;
... | [
"private",
"StateData",
"validateState",
"(",
"HttpSession",
"session",
",",
"String",
"state",
")",
"throws",
"Exception",
"{",
"if",
"(",
"StringUtils",
".",
"isNotEmpty",
"(",
"state",
")",
")",
"{",
"StateData",
"stateDataInSession",
"=",
"removeStateFromSessi... | make sure that state is stored in the session,
delete it from session - should be used only once
@param session
@param state
@throws Exception | [
"make",
"sure",
"that",
"state",
"is",
"stored",
"in",
"the",
"session",
"delete",
"it",
"from",
"session",
"-",
"should",
"be",
"used",
"only",
"once"
] | 7f0004fee6faee5818e75623113993a267ceb1c4 | https://github.com/AzureAD/azure-activedirectory-library-for-java/blob/7f0004fee6faee5818e75623113993a267ceb1c4/src/samples/web-app-samples-for-adal4j/src/main/java/com/microsoft/aad/adal4jsample/BasicFilter.java#L182-L190 | train |
spring-projects/spring-ldap | core/src/main/java/org/springframework/ldap/core/LdapRdn.java | LdapRdn.getLdapEncoded | public String getLdapEncoded() {
if (components.size() == 0) {
throw new IndexOutOfBoundsException("No components in Rdn.");
}
StringBuffer sb = new StringBuffer(DEFAULT_BUFFER_SIZE);
for (Iterator iter = components.values().iterator(); iter.hasNext();) {
LdapRdnComponent component = (LdapRdnCompone... | java | public String getLdapEncoded() {
if (components.size() == 0) {
throw new IndexOutOfBoundsException("No components in Rdn.");
}
StringBuffer sb = new StringBuffer(DEFAULT_BUFFER_SIZE);
for (Iterator iter = components.values().iterator(); iter.hasNext();) {
LdapRdnComponent component = (LdapRdnCompone... | [
"public",
"String",
"getLdapEncoded",
"(",
")",
"{",
"if",
"(",
"components",
".",
"size",
"(",
")",
"==",
"0",
")",
"{",
"throw",
"new",
"IndexOutOfBoundsException",
"(",
"\"No components in Rdn.\"",
")",
";",
"}",
"StringBuffer",
"sb",
"=",
"new",
"StringB... | Get a properly rfc2253-encoded String representation of this LdapRdn.
@return an escaped String corresponding to this LdapRdn.
@throws IndexOutOfBoundsException if there are no components in this Rdn. | [
"Get",
"a",
"properly",
"rfc2253",
"-",
"encoded",
"String",
"representation",
"of",
"this",
"LdapRdn",
"."
] | 15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0 | https://github.com/spring-projects/spring-ldap/blob/15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0/core/src/main/java/org/springframework/ldap/core/LdapRdn.java#L136-L150 | train |
spring-projects/spring-ldap | core/src/main/java/org/springframework/ldap/core/LdapRdn.java | LdapRdn.encodeUrl | public String encodeUrl() {
StringBuffer sb = new StringBuffer(DEFAULT_BUFFER_SIZE);
for (Iterator iter = components.values().iterator(); iter.hasNext();) {
LdapRdnComponent component = (LdapRdnComponent) iter.next();
sb.append(component.encodeUrl());
if (iter.hasNext()) {
sb.append("+");
}
... | java | public String encodeUrl() {
StringBuffer sb = new StringBuffer(DEFAULT_BUFFER_SIZE);
for (Iterator iter = components.values().iterator(); iter.hasNext();) {
LdapRdnComponent component = (LdapRdnComponent) iter.next();
sb.append(component.encodeUrl());
if (iter.hasNext()) {
sb.append("+");
}
... | [
"public",
"String",
"encodeUrl",
"(",
")",
"{",
"StringBuffer",
"sb",
"=",
"new",
"StringBuffer",
"(",
"DEFAULT_BUFFER_SIZE",
")",
";",
"for",
"(",
"Iterator",
"iter",
"=",
"components",
".",
"values",
"(",
")",
".",
"iterator",
"(",
")",
";",
"iter",
".... | Get a String representation of this LdapRdn for use in urls.
@return a String representation of this LdapRdn for use in urls. | [
"Get",
"a",
"String",
"representation",
"of",
"this",
"LdapRdn",
"for",
"use",
"in",
"urls",
"."
] | 15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0 | https://github.com/spring-projects/spring-ldap/blob/15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0/core/src/main/java/org/springframework/ldap/core/LdapRdn.java#L157-L168 | train |
spring-projects/spring-ldap | core/src/main/java/org/springframework/ldap/core/LdapRdn.java | LdapRdn.compareTo | public int compareTo(Object obj) {
LdapRdn that = (LdapRdn) obj;
if(this.components.size() != that.components.size()) {
return this.components.size() - that.components.size();
}
Set<Map.Entry<String,LdapRdnComponent>> theseEntries = this.components.entrySet();
for... | java | public int compareTo(Object obj) {
LdapRdn that = (LdapRdn) obj;
if(this.components.size() != that.components.size()) {
return this.components.size() - that.components.size();
}
Set<Map.Entry<String,LdapRdnComponent>> theseEntries = this.components.entrySet();
for... | [
"public",
"int",
"compareTo",
"(",
"Object",
"obj",
")",
"{",
"LdapRdn",
"that",
"=",
"(",
"LdapRdn",
")",
"obj",
";",
"if",
"(",
"this",
".",
"components",
".",
"size",
"(",
")",
"!=",
"that",
".",
"components",
".",
"size",
"(",
")",
")",
"{",
... | Compare this LdapRdn to another object.
@param obj the object to compare to.
@throws ClassCastException if the supplied object is not an LdapRdn
instance. | [
"Compare",
"this",
"LdapRdn",
"to",
"another",
"object",
"."
] | 15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0 | https://github.com/spring-projects/spring-ldap/blob/15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0/core/src/main/java/org/springframework/ldap/core/LdapRdn.java#L177-L198 | train |
spring-projects/spring-ldap | core/src/main/java/org/springframework/ldap/core/LdapRdn.java | LdapRdn.immutableLdapRdn | public LdapRdn immutableLdapRdn() {
Map<String, LdapRdnComponent> mapWithImmutableRdns = new LinkedHashMap<String, LdapRdnComponent>(components.size());
for (Iterator iterator = components.values().iterator(); iterator.hasNext();) {
LdapRdnComponent rdnComponent = (LdapRdnComponent) iterator.next();
... | java | public LdapRdn immutableLdapRdn() {
Map<String, LdapRdnComponent> mapWithImmutableRdns = new LinkedHashMap<String, LdapRdnComponent>(components.size());
for (Iterator iterator = components.values().iterator(); iterator.hasNext();) {
LdapRdnComponent rdnComponent = (LdapRdnComponent) iterator.next();
... | [
"public",
"LdapRdn",
"immutableLdapRdn",
"(",
")",
"{",
"Map",
"<",
"String",
",",
"LdapRdnComponent",
">",
"mapWithImmutableRdns",
"=",
"new",
"LinkedHashMap",
"<",
"String",
",",
"LdapRdnComponent",
">",
"(",
"components",
".",
"size",
"(",
")",
")",
";",
... | Create an immutable copy of this instance. It will not be possible to add
or remove components or modify the keys and values of these components.
@return an immutable copy of this instance.
@since 1.3 | [
"Create",
"an",
"immutable",
"copy",
"of",
"this",
"instance",
".",
"It",
"will",
"not",
"be",
"possible",
"to",
"add",
"or",
"remove",
"components",
"or",
"modify",
"the",
"keys",
"and",
"values",
"of",
"these",
"components",
"."
] | 15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0 | https://github.com/spring-projects/spring-ldap/blob/15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0/core/src/main/java/org/springframework/ldap/core/LdapRdn.java#L297-L307 | train |
spring-projects/spring-ldap | core/src/main/java/org/springframework/ldap/transaction/compensating/manager/TransactionAwareDirContextInvocationHandler.java | TransactionAwareDirContextInvocationHandler.doCloseConnection | void doCloseConnection(DirContext context, ContextSource contextSource)
throws javax.naming.NamingException {
DirContextHolder transactionContextHolder = (DirContextHolder) TransactionSynchronizationManager
.getResource(contextSource);
if (transactionContextHolder == null
... | java | void doCloseConnection(DirContext context, ContextSource contextSource)
throws javax.naming.NamingException {
DirContextHolder transactionContextHolder = (DirContextHolder) TransactionSynchronizationManager
.getResource(contextSource);
if (transactionContextHolder == null
... | [
"void",
"doCloseConnection",
"(",
"DirContext",
"context",
",",
"ContextSource",
"contextSource",
")",
"throws",
"javax",
".",
"naming",
".",
"NamingException",
"{",
"DirContextHolder",
"transactionContextHolder",
"=",
"(",
"DirContextHolder",
")",
"TransactionSynchroniza... | Close the supplied context, but only if it is not associated with the
current transaction.
@param context
the DirContext to close.
@param contextSource
the ContextSource bound to the transaction.
@throws NamingException | [
"Close",
"the",
"supplied",
"context",
"but",
"only",
"if",
"it",
"is",
"not",
"associated",
"with",
"the",
"current",
"transaction",
"."
] | 15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0 | https://github.com/spring-projects/spring-ldap/blob/15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0/core/src/main/java/org/springframework/ldap/transaction/compensating/manager/TransactionAwareDirContextInvocationHandler.java#L107-L120 | train |
spring-projects/spring-ldap | core/src/main/java/org/springframework/ldap/core/LdapRdnComponent.java | LdapRdnComponent.encodeLdap | protected String encodeLdap() {
StringBuffer buff = new StringBuffer(key.length() + value.length() * 2);
buff.append(key);
buff.append('=');
buff.append(LdapEncoder.nameEncode(value));
return buff.toString();
} | java | protected String encodeLdap() {
StringBuffer buff = new StringBuffer(key.length() + value.length() * 2);
buff.append(key);
buff.append('=');
buff.append(LdapEncoder.nameEncode(value));
return buff.toString();
} | [
"protected",
"String",
"encodeLdap",
"(",
")",
"{",
"StringBuffer",
"buff",
"=",
"new",
"StringBuffer",
"(",
"key",
".",
"length",
"(",
")",
"+",
"value",
".",
"length",
"(",
")",
"*",
"2",
")",
";",
"buff",
".",
"append",
"(",
"key",
")",
";",
"bu... | Encode key and value to ldap.
@return Properly ldap escaped rdn. | [
"Encode",
"key",
"and",
"value",
"to",
"ldap",
"."
] | 15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0 | https://github.com/spring-projects/spring-ldap/blob/15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0/core/src/main/java/org/springframework/ldap/core/LdapRdnComponent.java#L145-L153 | train |
spring-projects/spring-ldap | core/src/main/java/org/springframework/ldap/core/LdapRdnComponent.java | LdapRdnComponent.encodeUrl | public String encodeUrl() {
// Use the URI class to properly URL encode the value.
try {
URI valueUri = new URI(null, null, value, null);
return key + "=" + valueUri.toString();
}
catch (URISyntaxException e) {
// This should really never happen...
return key + "=" + "value";
}
} | java | public String encodeUrl() {
// Use the URI class to properly URL encode the value.
try {
URI valueUri = new URI(null, null, value, null);
return key + "=" + valueUri.toString();
}
catch (URISyntaxException e) {
// This should really never happen...
return key + "=" + "value";
}
} | [
"public",
"String",
"encodeUrl",
"(",
")",
"{",
"// Use the URI class to properly URL encode the value.",
"try",
"{",
"URI",
"valueUri",
"=",
"new",
"URI",
"(",
"null",
",",
"null",
",",
"value",
",",
"null",
")",
";",
"return",
"key",
"+",
"\"=\"",
"+",
"va... | Get a String representation of this instance for use in URLs.
@return a properly URL encoded representation of this instancs. | [
"Get",
"a",
"String",
"representation",
"of",
"this",
"instance",
"for",
"use",
"in",
"URLs",
"."
] | 15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0 | https://github.com/spring-projects/spring-ldap/blob/15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0/core/src/main/java/org/springframework/ldap/core/LdapRdnComponent.java#L176-L186 | train |
spring-projects/spring-ldap | core/src/main/java/org/springframework/ldap/core/LdapRdnComponent.java | LdapRdnComponent.compareTo | public int compareTo(Object obj) {
LdapRdnComponent that = (LdapRdnComponent) obj;
// It's safe to compare directly against key and value,
// because they are validated not to be null on instance creation.
int keyCompare = this.key.toLowerCase().compareTo(that.key.toLowerCase());
if(k... | java | public int compareTo(Object obj) {
LdapRdnComponent that = (LdapRdnComponent) obj;
// It's safe to compare directly against key and value,
// because they are validated not to be null on instance creation.
int keyCompare = this.key.toLowerCase().compareTo(that.key.toLowerCase());
if(k... | [
"public",
"int",
"compareTo",
"(",
"Object",
"obj",
")",
"{",
"LdapRdnComponent",
"that",
"=",
"(",
"LdapRdnComponent",
")",
"obj",
";",
"// It's safe to compare directly against key and value,",
"// because they are validated not to be null on instance creation.",
"int",
"keyC... | Compare this instance to the supplied object.
@param obj the object to compare to.
@throws ClassCastException if the object is not possible to cast to an
LdapRdnComponent. | [
"Compare",
"this",
"instance",
"to",
"the",
"supplied",
"object",
"."
] | 15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0 | https://github.com/spring-projects/spring-ldap/blob/15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0/core/src/main/java/org/springframework/ldap/core/LdapRdnComponent.java#L225-L236 | train |
spring-projects/spring-ldap | core/src/main/java/org/springframework/ldap/support/LdapUtils.java | LdapUtils.collectAttributeValues | public static void collectAttributeValues(Attributes attributes, String name, Collection<Object> collection) {
collectAttributeValues(attributes, name, collection, Object.class);
} | java | public static void collectAttributeValues(Attributes attributes, String name, Collection<Object> collection) {
collectAttributeValues(attributes, name, collection, Object.class);
} | [
"public",
"static",
"void",
"collectAttributeValues",
"(",
"Attributes",
"attributes",
",",
"String",
"name",
",",
"Collection",
"<",
"Object",
">",
"collection",
")",
"{",
"collectAttributeValues",
"(",
"attributes",
",",
"name",
",",
"collection",
",",
"Object",... | Collect all the values of a the specified attribute from the supplied
Attributes.
@param attributes The Attributes; not <code>null</code>.
@param name The name of the Attribute to get values for.
@param collection the collection to collect the values in.
@throws NoSuchAttributeException if no attribute with the specif... | [
"Collect",
"all",
"the",
"values",
"of",
"a",
"the",
"specified",
"attribute",
"from",
"the",
"supplied",
"Attributes",
"."
] | 15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0 | https://github.com/spring-projects/spring-ldap/blob/15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0/core/src/main/java/org/springframework/ldap/support/LdapUtils.java#L258-L260 | train |
spring-projects/spring-ldap | core/src/main/java/org/springframework/ldap/support/LdapUtils.java | LdapUtils.collectAttributeValues | public static <T> void collectAttributeValues(
Attributes attributes, String name, Collection<T> collection, Class<T> clazz) {
Assert.notNull(attributes, "Attributes must not be null");
Assert.hasText(name, "Name must not be empty");
Assert.notNull(collection, "Collection must not b... | java | public static <T> void collectAttributeValues(
Attributes attributes, String name, Collection<T> collection, Class<T> clazz) {
Assert.notNull(attributes, "Attributes must not be null");
Assert.hasText(name, "Name must not be empty");
Assert.notNull(collection, "Collection must not b... | [
"public",
"static",
"<",
"T",
">",
"void",
"collectAttributeValues",
"(",
"Attributes",
"attributes",
",",
"String",
"name",
",",
"Collection",
"<",
"T",
">",
"collection",
",",
"Class",
"<",
"T",
">",
"clazz",
")",
"{",
"Assert",
".",
"notNull",
"(",
"a... | Collect all the values of a the specified attribute from the supplied
Attributes as the specified class.
@param attributes The Attributes; not <code>null</code>.
@param name The name of the Attribute to get values for.
@param collection the collection to collect the values in.
@param clazz the class of the collected a... | [
"Collect",
"all",
"the",
"values",
"of",
"a",
"the",
"specified",
"attribute",
"from",
"the",
"supplied",
"Attributes",
"as",
"the",
"specified",
"class",
"."
] | 15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0 | https://github.com/spring-projects/spring-ldap/blob/15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0/core/src/main/java/org/springframework/ldap/support/LdapUtils.java#L275-L289 | train |
spring-projects/spring-ldap | core/src/main/java/org/springframework/ldap/support/LdapUtils.java | LdapUtils.iterateAttributeValues | public static void iterateAttributeValues(Attribute attribute, AttributeValueCallbackHandler callbackHandler) {
Assert.notNull(attribute, "Attribute must not be null");
Assert.notNull(callbackHandler, "callbackHandler must not be null");
if (attribute instanceof Iterable) {
int i = 0;
for (Object obj : (It... | java | public static void iterateAttributeValues(Attribute attribute, AttributeValueCallbackHandler callbackHandler) {
Assert.notNull(attribute, "Attribute must not be null");
Assert.notNull(callbackHandler, "callbackHandler must not be null");
if (attribute instanceof Iterable) {
int i = 0;
for (Object obj : (It... | [
"public",
"static",
"void",
"iterateAttributeValues",
"(",
"Attribute",
"attribute",
",",
"AttributeValueCallbackHandler",
"callbackHandler",
")",
"{",
"Assert",
".",
"notNull",
"(",
"attribute",
",",
"\"Attribute must not be null\"",
")",
";",
"Assert",
".",
"notNull",... | Iterate through all the values of the specified Attribute calling back to
the specified callbackHandler.
@param attribute the Attribute to work with; not <code>null</code>.
@param callbackHandler the callbackHandler; not <code>null</code>.
@since 1.3 | [
"Iterate",
"through",
"all",
"the",
"values",
"of",
"the",
"specified",
"Attribute",
"calling",
"back",
"to",
"the",
"specified",
"callbackHandler",
"."
] | 15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0 | https://github.com/spring-projects/spring-ldap/blob/15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0/core/src/main/java/org/springframework/ldap/support/LdapUtils.java#L298-L318 | train |
spring-projects/spring-ldap | core/src/main/java/org/springframework/ldap/support/LdapUtils.java | LdapUtils.newLdapName | public static LdapName newLdapName(String distinguishedName) {
Assert.notNull(distinguishedName, "distinguishedName must not be null");
try {
return new LdapName(distinguishedName);
} catch (InvalidNameException e) {
throw convertLdapException(e);
}
} | java | public static LdapName newLdapName(String distinguishedName) {
Assert.notNull(distinguishedName, "distinguishedName must not be null");
try {
return new LdapName(distinguishedName);
} catch (InvalidNameException e) {
throw convertLdapException(e);
}
} | [
"public",
"static",
"LdapName",
"newLdapName",
"(",
"String",
"distinguishedName",
")",
"{",
"Assert",
".",
"notNull",
"(",
"distinguishedName",
",",
"\"distinguishedName must not be null\"",
")",
";",
"try",
"{",
"return",
"new",
"LdapName",
"(",
"distinguishedName",... | Construct a new LdapName instance from the supplied distinguished name string.
@param distinguishedName the string to parse for constructing an LdapName instance.
@return a new LdapName instance.
@throws org.springframework.ldap.InvalidNameException to wrap any InvalidNameExceptions thrown by LdapName.
@since 2.0 | [
"Construct",
"a",
"new",
"LdapName",
"instance",
"from",
"the",
"supplied",
"distinguished",
"name",
"string",
"."
] | 15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0 | https://github.com/spring-projects/spring-ldap/blob/15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0/core/src/main/java/org/springframework/ldap/support/LdapUtils.java#L410-L418 | train |
spring-projects/spring-ldap | core/src/main/java/org/springframework/ldap/support/LdapUtils.java | LdapUtils.getRdn | public static Rdn getRdn(Name name, String key) {
Assert.notNull(name, "name must not be null");
Assert.hasText(key, "key must not be blank");
LdapName ldapName = returnOrConstructLdapNameFromName(name);
List<Rdn> rdns = ldapName.getRdns();
for (Rdn rdn : rdns) {
Na... | java | public static Rdn getRdn(Name name, String key) {
Assert.notNull(name, "name must not be null");
Assert.hasText(key, "key must not be blank");
LdapName ldapName = returnOrConstructLdapNameFromName(name);
List<Rdn> rdns = ldapName.getRdns();
for (Rdn rdn : rdns) {
Na... | [
"public",
"static",
"Rdn",
"getRdn",
"(",
"Name",
"name",
",",
"String",
"key",
")",
"{",
"Assert",
".",
"notNull",
"(",
"name",
",",
"\"name must not be null\"",
")",
";",
"Assert",
".",
"hasText",
"(",
"key",
",",
"\"key must not be blank\"",
")",
";",
"... | Find the Rdn with the requested key in the supplied Name.
@param name the Name in which to search for the key.
@param key the attribute key to search for.
@return the rdn corresponding to the <b>first</b> occurrence of the requested key.
@throws NoSuchElementException if no corresponding entry is found.
@since 2.0 | [
"Find",
"the",
"Rdn",
"with",
"the",
"requested",
"key",
"in",
"the",
"supplied",
"Name",
"."
] | 15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0 | https://github.com/spring-projects/spring-ldap/blob/15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0/core/src/main/java/org/springframework/ldap/support/LdapUtils.java#L506-L524 | train |
spring-projects/spring-ldap | core/src/main/java/org/springframework/ldap/support/LdapUtils.java | LdapUtils.getValue | public static Object getValue(Name name, String key) {
NamingEnumeration<? extends Attribute> allAttributes = getRdn(name, key).toAttributes().getAll();
while (allAttributes.hasMoreElements()) {
Attribute oneAttribute = allAttributes.nextElement();
if(key.equalsIgnoreCase(oneAttr... | java | public static Object getValue(Name name, String key) {
NamingEnumeration<? extends Attribute> allAttributes = getRdn(name, key).toAttributes().getAll();
while (allAttributes.hasMoreElements()) {
Attribute oneAttribute = allAttributes.nextElement();
if(key.equalsIgnoreCase(oneAttr... | [
"public",
"static",
"Object",
"getValue",
"(",
"Name",
"name",
",",
"String",
"key",
")",
"{",
"NamingEnumeration",
"<",
"?",
"extends",
"Attribute",
">",
"allAttributes",
"=",
"getRdn",
"(",
"name",
",",
"key",
")",
".",
"toAttributes",
"(",
")",
".",
"... | Get the value of the Rdn with the requested key in the supplied Name.
@param name the Name in which to search for the key.
@param key the attribute key to search for.
@return the value of the rdn corresponding to the <b>first</b> occurrence of the requested key.
@throws NoSuchElementException if no corresponding entry... | [
"Get",
"the",
"value",
"of",
"the",
"Rdn",
"with",
"the",
"requested",
"key",
"in",
"the",
"supplied",
"Name",
"."
] | 15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0 | https://github.com/spring-projects/spring-ldap/blob/15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0/core/src/main/java/org/springframework/ldap/support/LdapUtils.java#L535-L550 | train |
spring-projects/spring-ldap | core/src/main/java/org/springframework/ldap/support/LdapUtils.java | LdapUtils.getValue | public static Object getValue(Name name, int index) {
Assert.notNull(name, "name must not be null");
LdapName ldapName = returnOrConstructLdapNameFromName(name);
Rdn rdn = ldapName.getRdn(index);
if(rdn.size() > 1) {
LOGGER.warn("Rdn at position " + index + " of dn '" + name... | java | public static Object getValue(Name name, int index) {
Assert.notNull(name, "name must not be null");
LdapName ldapName = returnOrConstructLdapNameFromName(name);
Rdn rdn = ldapName.getRdn(index);
if(rdn.size() > 1) {
LOGGER.warn("Rdn at position " + index + " of dn '" + name... | [
"public",
"static",
"Object",
"getValue",
"(",
"Name",
"name",
",",
"int",
"index",
")",
"{",
"Assert",
".",
"notNull",
"(",
"name",
",",
"\"name must not be null\"",
")",
";",
"LdapName",
"ldapName",
"=",
"returnOrConstructLdapNameFromName",
"(",
"name",
")",
... | Get the value of the Rdn at the requested index in the supplied Name.
@param name the Name to work on.
@param index The 0-based index of the rdn value to retrieve. Must be in the range [0,size()).
@return the value of the rdn at the requested index.
@throws IndexOutOfBoundsException if index is outside the specified r... | [
"Get",
"the",
"value",
"of",
"the",
"Rdn",
"at",
"the",
"requested",
"index",
"in",
"the",
"supplied",
"Name",
"."
] | 15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0 | https://github.com/spring-projects/spring-ldap/blob/15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0/core/src/main/java/org/springframework/ldap/support/LdapUtils.java#L561-L572 | train |
spring-projects/spring-ldap | core/src/main/java/org/springframework/ldap/support/LdapUtils.java | LdapUtils.getStringValue | public static String getStringValue(Name name, String key) {
return (String) getValue(name, key);
} | java | public static String getStringValue(Name name, String key) {
return (String) getValue(name, key);
} | [
"public",
"static",
"String",
"getStringValue",
"(",
"Name",
"name",
",",
"String",
"key",
")",
"{",
"return",
"(",
"String",
")",
"getValue",
"(",
"name",
",",
"key",
")",
";",
"}"
] | Get the value of the Rdn with the requested key in the supplied Name as a String.
@param name the Name in which to search for the key.
@param key the attribute key to search for.
@return the String value of the rdn corresponding to the <b>first</b> occurrence of the requested key.
@throws NoSuchElementException if no ... | [
"Get",
"the",
"value",
"of",
"the",
"Rdn",
"with",
"the",
"requested",
"key",
"in",
"the",
"supplied",
"Name",
"as",
"a",
"String",
"."
] | 15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0 | https://github.com/spring-projects/spring-ldap/blob/15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0/core/src/main/java/org/springframework/ldap/support/LdapUtils.java#L598-L600 | train |
spring-projects/spring-ldap | core/src/main/java/org/springframework/ldap/support/LdapUtils.java | LdapUtils.numberToBytes | static byte[] numberToBytes(String number, int length, boolean bigEndian) {
BigInteger bi = new BigInteger(number);
byte[] bytes = bi.toByteArray();
int remaining = length - bytes.length;
if (remaining < 0) {
bytes = Arrays.copyOfRange(bytes, -remaining, bytes.length);
} else {
byte[] fill = new byte[re... | java | static byte[] numberToBytes(String number, int length, boolean bigEndian) {
BigInteger bi = new BigInteger(number);
byte[] bytes = bi.toByteArray();
int remaining = length - bytes.length;
if (remaining < 0) {
bytes = Arrays.copyOfRange(bytes, -remaining, bytes.length);
} else {
byte[] fill = new byte[re... | [
"static",
"byte",
"[",
"]",
"numberToBytes",
"(",
"String",
"number",
",",
"int",
"length",
",",
"boolean",
"bigEndian",
")",
"{",
"BigInteger",
"bi",
"=",
"new",
"BigInteger",
"(",
"number",
")",
";",
"byte",
"[",
"]",
"bytes",
"=",
"bi",
".",
"toByte... | Converts the given number to a binary representation of the specified
length and "endian-ness".
@param number String with number to convert
@param length How long the resulting binary array should be
@param bigEndian <code>true</code> if big endian (5=0005), or
<code>false</code> if little endian (5=5000)
@return byte... | [
"Converts",
"the",
"given",
"number",
"to",
"a",
"binary",
"representation",
"of",
"the",
"specified",
"length",
"and",
"endian",
"-",
"ness",
"."
] | 15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0 | https://github.com/spring-projects/spring-ldap/blob/15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0/core/src/main/java/org/springframework/ldap/support/LdapUtils.java#L725-L739 | train |
spring-projects/spring-ldap | core/src/main/java/org/springframework/ldap/support/LdapUtils.java | LdapUtils.toHexString | static String toHexString(final byte b) {
String hexString = Integer.toHexString(b & 0xFF);
if (hexString.length() % 2 != 0) {
// Pad with 0
hexString = "0" + hexString;
}
return hexString;
} | java | static String toHexString(final byte b) {
String hexString = Integer.toHexString(b & 0xFF);
if (hexString.length() % 2 != 0) {
// Pad with 0
hexString = "0" + hexString;
}
return hexString;
} | [
"static",
"String",
"toHexString",
"(",
"final",
"byte",
"b",
")",
"{",
"String",
"hexString",
"=",
"Integer",
".",
"toHexString",
"(",
"b",
"&",
"0xFF",
")",
";",
"if",
"(",
"hexString",
".",
"length",
"(",
")",
"%",
"2",
"!=",
"0",
")",
"{",
"// ... | Converts a byte into its hexadecimal representation, padding with a
leading zero to get an even number of characters.
@param b value to convert
@return hex string, possibly padded with a zero | [
"Converts",
"a",
"byte",
"into",
"its",
"hexadecimal",
"representation",
"padding",
"with",
"a",
"leading",
"zero",
"to",
"get",
"an",
"even",
"number",
"of",
"characters",
"."
] | 15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0 | https://github.com/spring-projects/spring-ldap/blob/15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0/core/src/main/java/org/springframework/ldap/support/LdapUtils.java#L761-L768 | train |
spring-projects/spring-ldap | core/src/main/java/org/springframework/ldap/support/LdapUtils.java | LdapUtils.toHexString | static String toHexString(final byte[] b) {
StringBuffer sb = new StringBuffer("{");
for (int i = 0; i < b.length; i++) {
sb.append(toHexString(b[i]));
if (i < b.length - 1) {
sb.append(",");
}
}
sb.append("}");
return sb.toString();
} | java | static String toHexString(final byte[] b) {
StringBuffer sb = new StringBuffer("{");
for (int i = 0; i < b.length; i++) {
sb.append(toHexString(b[i]));
if (i < b.length - 1) {
sb.append(",");
}
}
sb.append("}");
return sb.toString();
} | [
"static",
"String",
"toHexString",
"(",
"final",
"byte",
"[",
"]",
"b",
")",
"{",
"StringBuffer",
"sb",
"=",
"new",
"StringBuffer",
"(",
"\"{\"",
")",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"b",
".",
"length",
";",
"i",
"++",
")",
... | Converts a byte array into its hexadecimal representation, padding each
with a leading zero to get an even number of characters.
@param b values to convert
@return hex string, possibly with elements padded with a zero | [
"Converts",
"a",
"byte",
"array",
"into",
"its",
"hexadecimal",
"representation",
"padding",
"each",
"with",
"a",
"leading",
"zero",
"to",
"get",
"an",
"even",
"number",
"of",
"characters",
"."
] | 15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0 | https://github.com/spring-projects/spring-ldap/blob/15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0/core/src/main/java/org/springframework/ldap/support/LdapUtils.java#L777-L787 | train |
spring-projects/spring-ldap | core/src/main/java/org/springframework/ldap/pool2/DelegatingContext.java | DelegatingContext.getInnermostDelegateContext | public Context getInnermostDelegateContext() {
final Context delegateContext = this.getDelegateContext();
if (delegateContext instanceof DelegatingContext) {
return ((DelegatingContext)delegateContext).getInnermostDelegateContext();
}
return delegateContext;
} | java | public Context getInnermostDelegateContext() {
final Context delegateContext = this.getDelegateContext();
if (delegateContext instanceof DelegatingContext) {
return ((DelegatingContext)delegateContext).getInnermostDelegateContext();
}
return delegateContext;
} | [
"public",
"Context",
"getInnermostDelegateContext",
"(",
")",
"{",
"final",
"Context",
"delegateContext",
"=",
"this",
".",
"getDelegateContext",
"(",
")",
";",
"if",
"(",
"delegateContext",
"instanceof",
"DelegatingContext",
")",
"{",
"return",
"(",
"(",
"Delegat... | Recursivley inspect delegates until a non-delegating context is found.
@return The innermost (real) Context that is being delegated to. | [
"Recursivley",
"inspect",
"delegates",
"until",
"a",
"non",
"-",
"delegating",
"context",
"is",
"found",
"."
] | 15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0 | https://github.com/spring-projects/spring-ldap/blob/15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0/core/src/main/java/org/springframework/ldap/pool2/DelegatingContext.java#L73-L81 | train |
spring-projects/spring-ldap | ldif/ldif-core/src/main/java/org/springframework/ldap/schema/BasicSchemaSpecification.java | BasicSchemaSpecification.isSatisfiedBy | public boolean isSatisfiedBy(LdapAttributes record) throws NamingException {
if (record != null) {
//DN is required.
LdapName dn = record.getName();
if (dn != null) {
//objectClass definition is required.
if (record.get("objectClass") != null) {
//Naming attribute is req... | java | public boolean isSatisfiedBy(LdapAttributes record) throws NamingException {
if (record != null) {
//DN is required.
LdapName dn = record.getName();
if (dn != null) {
//objectClass definition is required.
if (record.get("objectClass") != null) {
//Naming attribute is req... | [
"public",
"boolean",
"isSatisfiedBy",
"(",
"LdapAttributes",
"record",
")",
"throws",
"NamingException",
"{",
"if",
"(",
"record",
"!=",
"null",
")",
"{",
"//DN is required.\r",
"LdapName",
"dn",
"=",
"record",
".",
"getName",
"(",
")",
";",
"if",
"(",
"dn",... | Determines if the policy is satisfied by the supplied LdapAttributes object.
@throws NamingException | [
"Determines",
"if",
"the",
"policy",
"is",
"satisfied",
"by",
"the",
"supplied",
"LdapAttributes",
"object",
"."
] | 15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0 | https://github.com/spring-projects/spring-ldap/blob/15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0/ldif/ldif-core/src/main/java/org/springframework/ldap/schema/BasicSchemaSpecification.java#L31-L59 | train |
spring-projects/spring-ldap | core/src/main/java/org/springframework/ldap/core/support/SingleContextSource.java | SingleContextSource.destroy | public void destroy() {
try {
ctx.close();
}
catch (javax.naming.NamingException e) {
LOG.warn("Error when closing", e);
}
} | java | public void destroy() {
try {
ctx.close();
}
catch (javax.naming.NamingException e) {
LOG.warn("Error when closing", e);
}
} | [
"public",
"void",
"destroy",
"(",
")",
"{",
"try",
"{",
"ctx",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"javax",
".",
"naming",
".",
"NamingException",
"e",
")",
"{",
"LOG",
".",
"warn",
"(",
"\"Error when closing\"",
",",
"e",
")",
";",
"}"... | Destroy method that allows the target DirContext to be cleaned up when
the SingleContextSource is not going to be used any more. | [
"Destroy",
"method",
"that",
"allows",
"the",
"target",
"DirContext",
"to",
"be",
"cleaned",
"up",
"when",
"the",
"SingleContextSource",
"is",
"not",
"going",
"to",
"be",
"used",
"any",
"more",
"."
] | 15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0 | https://github.com/spring-projects/spring-ldap/blob/15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0/core/src/main/java/org/springframework/ldap/core/support/SingleContextSource.java#L90-L97 | train |
spring-projects/spring-ldap | core/src/main/java/org/springframework/ldap/core/DistinguishedName.java | DistinguishedName.parse | protected final void parse(String path) {
DnParser parser = DefaultDnParserFactory.createDnParser(unmangleCompositeName(path));
DistinguishedName dn;
try {
dn = parser.dn();
}
catch (ParseException e) {
throw new BadLdapGrammarException("Failed to parse DN", e);
}
catch (TokenMgrError e) {
throw ... | java | protected final void parse(String path) {
DnParser parser = DefaultDnParserFactory.createDnParser(unmangleCompositeName(path));
DistinguishedName dn;
try {
dn = parser.dn();
}
catch (ParseException e) {
throw new BadLdapGrammarException("Failed to parse DN", e);
}
catch (TokenMgrError e) {
throw ... | [
"protected",
"final",
"void",
"parse",
"(",
"String",
"path",
")",
"{",
"DnParser",
"parser",
"=",
"DefaultDnParserFactory",
".",
"createDnParser",
"(",
"unmangleCompositeName",
"(",
"path",
")",
")",
";",
"DistinguishedName",
"dn",
";",
"try",
"{",
"dn",
"=",... | Parse the supplied String and make this instance represent the
corresponding distinguished name.
@param path the LDAP path to parse. | [
"Parse",
"the",
"supplied",
"String",
"and",
"make",
"this",
"instance",
"represent",
"the",
"corresponding",
"distinguished",
"name",
"."
] | 15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0 | https://github.com/spring-projects/spring-ldap/blob/15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0/core/src/main/java/org/springframework/ldap/core/DistinguishedName.java#L222-L235 | train |
spring-projects/spring-ldap | core/src/main/java/org/springframework/ldap/core/DistinguishedName.java | DistinguishedName.toUrl | public String toUrl() {
StringBuffer buffer = new StringBuffer(DEFAULT_BUFFER_SIZE);
for (int i = names.size() - 1; i >= 0; i--) {
LdapRdn n = (LdapRdn) names.get(i);
buffer.append(n.encodeUrl());
if (i > 0) {
buffer.append(",");
}
}
return buffer.toString();
} | java | public String toUrl() {
StringBuffer buffer = new StringBuffer(DEFAULT_BUFFER_SIZE);
for (int i = names.size() - 1; i >= 0; i--) {
LdapRdn n = (LdapRdn) names.get(i);
buffer.append(n.encodeUrl());
if (i > 0) {
buffer.append(",");
}
}
return buffer.toString();
} | [
"public",
"String",
"toUrl",
"(",
")",
"{",
"StringBuffer",
"buffer",
"=",
"new",
"StringBuffer",
"(",
"DEFAULT_BUFFER_SIZE",
")",
";",
"for",
"(",
"int",
"i",
"=",
"names",
".",
"size",
"(",
")",
"-",
"1",
";",
"i",
">=",
"0",
";",
"i",
"--",
")",... | Builds a complete LDAP path, ldap and url encoded. Separates only with
",".
@return the LDAP path, for use in an url. | [
"Builds",
"a",
"complete",
"LDAP",
"path",
"ldap",
"and",
"url",
"encoded",
".",
"Separates",
"only",
"with",
"."
] | 15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0 | https://github.com/spring-projects/spring-ldap/blob/15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0/core/src/main/java/org/springframework/ldap/core/DistinguishedName.java#L391-L402 | train |
spring-projects/spring-ldap | core/src/main/java/org/springframework/ldap/core/DistinguishedName.java | DistinguishedName.compareTo | public int compareTo(Object obj) {
DistinguishedName that = (DistinguishedName) obj;
ListComparator comparator = new ListComparator();
return comparator.compare(this.names, that.names);
} | java | public int compareTo(Object obj) {
DistinguishedName that = (DistinguishedName) obj;
ListComparator comparator = new ListComparator();
return comparator.compare(this.names, that.names);
} | [
"public",
"int",
"compareTo",
"(",
"Object",
"obj",
")",
"{",
"DistinguishedName",
"that",
"=",
"(",
"DistinguishedName",
")",
"obj",
";",
"ListComparator",
"comparator",
"=",
"new",
"ListComparator",
"(",
")",
";",
"return",
"comparator",
".",
"compare",
"(",... | Compare this instance to another object. Note that the comparison is done
in order of significance, so the most significant Rdn is compared first,
then the second and so on.
@see javax.naming.Name#compareTo(java.lang.Object) | [
"Compare",
"this",
"instance",
"to",
"another",
"object",
".",
"Note",
"that",
"the",
"comparison",
"is",
"done",
"in",
"order",
"of",
"significance",
"so",
"the",
"most",
"significant",
"Rdn",
"is",
"compared",
"first",
"then",
"the",
"second",
"and",
"so",... | 15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0 | https://github.com/spring-projects/spring-ldap/blob/15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0/core/src/main/java/org/springframework/ldap/core/DistinguishedName.java#L577-L581 | train |
spring-projects/spring-ldap | core/src/main/java/org/springframework/ldap/core/DistinguishedName.java | DistinguishedName.immutableDistinguishedName | public DistinguishedName immutableDistinguishedName() {
List listWithImmutableRdns = new ArrayList(names.size());
for (Iterator iterator = names.iterator(); iterator.hasNext();) {
LdapRdn rdn = (LdapRdn) iterator.next();
listWithImmutableRdns.add(rdn.immutableLdapRdn());
}
return new DistinguishedName(Co... | java | public DistinguishedName immutableDistinguishedName() {
List listWithImmutableRdns = new ArrayList(names.size());
for (Iterator iterator = names.iterator(); iterator.hasNext();) {
LdapRdn rdn = (LdapRdn) iterator.next();
listWithImmutableRdns.add(rdn.immutableLdapRdn());
}
return new DistinguishedName(Co... | [
"public",
"DistinguishedName",
"immutableDistinguishedName",
"(",
")",
"{",
"List",
"listWithImmutableRdns",
"=",
"new",
"ArrayList",
"(",
"names",
".",
"size",
"(",
")",
")",
";",
"for",
"(",
"Iterator",
"iterator",
"=",
"names",
".",
"iterator",
"(",
")",
... | Return an immutable copy of this instance. It will not be possible to add
or remove any Rdns to or from the returned instance, and the respective
Rdns will also be immutable in turn.
@return a copy of this instance backed by an immutable list.
@since 1.2 | [
"Return",
"an",
"immutable",
"copy",
"of",
"this",
"instance",
".",
"It",
"will",
"not",
"be",
"possible",
"to",
"add",
"or",
"remove",
"any",
"Rdns",
"to",
"or",
"from",
"the",
"returned",
"instance",
"and",
"the",
"respective",
"Rdns",
"will",
"also",
... | 15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0 | https://github.com/spring-projects/spring-ldap/blob/15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0/core/src/main/java/org/springframework/ldap/core/DistinguishedName.java#L840-L848 | train |
spring-projects/spring-ldap | core/src/main/java/org/springframework/ldap/odm/core/impl/AttributeMetaData.java | AttributeMetaData.processAttributeAnnotation | private boolean processAttributeAnnotation(Field field) {
// Default to no syntax specified
syntax = "";
// Default to a String based attribute
isBinary = false;
// Default name of attribute to the name of the field
name = new CaseIgnoreString(fi... | java | private boolean processAttributeAnnotation(Field field) {
// Default to no syntax specified
syntax = "";
// Default to a String based attribute
isBinary = false;
// Default name of attribute to the name of the field
name = new CaseIgnoreString(fi... | [
"private",
"boolean",
"processAttributeAnnotation",
"(",
"Field",
"field",
")",
"{",
"// Default to no syntax specified\r",
"syntax",
"=",
"\"\"",
";",
"// Default to a String based attribute\r",
"isBinary",
"=",
"false",
";",
"// Default name of attribute to the name of the fiel... | syntax, isBinary, isObjectClass and name. | [
"syntax",
"isBinary",
"isObjectClass",
"and",
"name",
"."
] | 15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0 | https://github.com/spring-projects/spring-ldap/blob/15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0/core/src/main/java/org/springframework/ldap/odm/core/impl/AttributeMetaData.java#L86-L123 | train |
spring-projects/spring-ldap | odm/src/main/java/org/springframework/ldap/odm/tools/SchemaToJava.java | SchemaToJava.readSyntaxMap | private static Map<String, String> readSyntaxMap(File syntaxMapFile)
throws IOException {
Map<String, String> result = new HashMap<String, String>();
BufferedReader reader = null;
try {
reader = new BufferedReader(new FileReader(syntaxMapFile));
String ... | java | private static Map<String, String> readSyntaxMap(File syntaxMapFile)
throws IOException {
Map<String, String> result = new HashMap<String, String>();
BufferedReader reader = null;
try {
reader = new BufferedReader(new FileReader(syntaxMapFile));
String ... | [
"private",
"static",
"Map",
"<",
"String",
",",
"String",
">",
"readSyntaxMap",
"(",
"File",
"syntaxMapFile",
")",
"throws",
"IOException",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"result",
"=",
"new",
"HashMap",
"<",
"String",
",",
"String",
">",
... | Read mappings of LDAP syntaxes to Java classes. | [
"Read",
"mappings",
"of",
"LDAP",
"syntaxes",
"to",
"Java",
"classes",
"."
] | 15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0 | https://github.com/spring-projects/spring-ldap/blob/15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0/odm/src/main/java/org/springframework/ldap/odm/tools/SchemaToJava.java#L195-L230 | train |
spring-projects/spring-ldap | odm/src/main/java/org/springframework/ldap/odm/tools/SchemaToJava.java | SchemaToJava.readSchema | private static ObjectSchema readSchema(String url, String user, String pass,
SyntaxToJavaClass syntaxToJavaClass, Set<String> binarySet, Set<String> objectClasses)
throws NamingException, ClassNotFoundException {
// Set up environment
Hashtable<String, String> env = new Ha... | java | private static ObjectSchema readSchema(String url, String user, String pass,
SyntaxToJavaClass syntaxToJavaClass, Set<String> binarySet, Set<String> objectClasses)
throws NamingException, ClassNotFoundException {
// Set up environment
Hashtable<String, String> env = new Ha... | [
"private",
"static",
"ObjectSchema",
"readSchema",
"(",
"String",
"url",
",",
"String",
"user",
",",
"String",
"pass",
",",
"SyntaxToJavaClass",
"syntaxToJavaClass",
",",
"Set",
"<",
"String",
">",
"binarySet",
",",
"Set",
"<",
"String",
">",
"objectClasses",
... | Bind to the directory, read and process the schema | [
"Bind",
"to",
"the",
"directory",
"read",
"and",
"process",
"the",
"schema"
] | 15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0 | https://github.com/spring-projects/spring-ldap/blob/15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0/odm/src/main/java/org/springframework/ldap/odm/tools/SchemaToJava.java#L233-L258 | train |
spring-projects/spring-ldap | odm/src/main/java/org/springframework/ldap/odm/tools/SchemaToJava.java | SchemaToJava.createCode | private static void createCode(String packageName,
String className, ObjectSchema schema, Set<SyntaxToJavaClass.ClassInfo> imports, File outputFile)
throws IOException, TemplateException {
Configuration freeMarkerConfiguration = new Configuration();
freeMarkerConfiguratio... | java | private static void createCode(String packageName,
String className, ObjectSchema schema, Set<SyntaxToJavaClass.ClassInfo> imports, File outputFile)
throws IOException, TemplateException {
Configuration freeMarkerConfiguration = new Configuration();
freeMarkerConfiguratio... | [
"private",
"static",
"void",
"createCode",
"(",
"String",
"packageName",
",",
"String",
"className",
",",
"ObjectSchema",
"schema",
",",
"Set",
"<",
"SyntaxToJavaClass",
".",
"ClassInfo",
">",
"imports",
",",
"File",
"outputFile",
")",
"throws",
"IOException",
"... | Create the Java | [
"Create",
"the",
"Java"
] | 15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0 | https://github.com/spring-projects/spring-ldap/blob/15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0/odm/src/main/java/org/springframework/ldap/odm/tools/SchemaToJava.java#L261-L293 | train |
spring-projects/spring-ldap | odm/src/main/java/org/springframework/ldap/odm/tools/SchemaToJava.java | SchemaToJava.makeOutputFile | private static File makeOutputFile(String outputDir, String packageName, String className)
throws IOException {
// Convert the package name to a path
Pattern pattern=Pattern.compile("\\.");
Matcher matcher=pattern.matcher(packageName);
String sepToUse=File.separator;
... | java | private static File makeOutputFile(String outputDir, String packageName, String className)
throws IOException {
// Convert the package name to a path
Pattern pattern=Pattern.compile("\\.");
Matcher matcher=pattern.matcher(packageName);
String sepToUse=File.separator;
... | [
"private",
"static",
"File",
"makeOutputFile",
"(",
"String",
"outputDir",
",",
"String",
"packageName",
",",
"String",
"className",
")",
"throws",
"IOException",
"{",
"// Convert the package name to a path",
"Pattern",
"pattern",
"=",
"Pattern",
".",
"compile",
"(",
... | Create the output file for the generated code along with all intervening directories | [
"Create",
"the",
"output",
"file",
"for",
"the",
"generated",
"code",
"along",
"with",
"all",
"intervening",
"directories"
] | 15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0 | https://github.com/spring-projects/spring-ldap/blob/15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0/odm/src/main/java/org/springframework/ldap/odm/tools/SchemaToJava.java#L296-L324 | train |
spring-projects/spring-ldap | odm/src/main/java/org/springframework/ldap/odm/tools/SchemaReader.java | SchemaReader.getObjectSchema | public ObjectSchema getObjectSchema(Set<String> objectClasses)
throws NamingException, ClassNotFoundException {
ObjectSchema result = new ObjectSchema();
createObjectClass(objectClasses, schemaContext, result);
return result;
} | java | public ObjectSchema getObjectSchema(Set<String> objectClasses)
throws NamingException, ClassNotFoundException {
ObjectSchema result = new ObjectSchema();
createObjectClass(objectClasses, schemaContext, result);
return result;
} | [
"public",
"ObjectSchema",
"getObjectSchema",
"(",
"Set",
"<",
"String",
">",
"objectClasses",
")",
"throws",
"NamingException",
",",
"ClassNotFoundException",
"{",
"ObjectSchema",
"result",
"=",
"new",
"ObjectSchema",
"(",
")",
";",
"createObjectClass",
"(",
"object... | Get the object schema for the given object classes | [
"Get",
"the",
"object",
"schema",
"for",
"the",
"given",
"object",
"classes"
] | 15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0 | https://github.com/spring-projects/spring-ldap/blob/15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0/odm/src/main/java/org/springframework/ldap/odm/tools/SchemaReader.java#L44-L50 | train |
spring-projects/spring-ldap | odm/src/main/java/org/springframework/ldap/odm/tools/SchemaReader.java | SchemaReader.createObjectClass | private void createObjectClass(Set<String> objectClasses, DirContext schemaContext, ObjectSchema schema)
throws NamingException, ClassNotFoundException {
// Super classes
Set<String> supList = new HashSet<String>();
// For each of the given object classes
for (String... | java | private void createObjectClass(Set<String> objectClasses, DirContext schemaContext, ObjectSchema schema)
throws NamingException, ClassNotFoundException {
// Super classes
Set<String> supList = new HashSet<String>();
// For each of the given object classes
for (String... | [
"private",
"void",
"createObjectClass",
"(",
"Set",
"<",
"String",
">",
"objectClasses",
",",
"DirContext",
"schemaContext",
",",
"ObjectSchema",
"schema",
")",
"throws",
"NamingException",
",",
"ClassNotFoundException",
"{",
"// Super classes\r",
"Set",
"<",
"String"... | Recursively extract schema from the directory and process it | [
"Recursively",
"extract",
"schema",
"from",
"the",
"directory",
"and",
"process",
"it"
] | 15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0 | https://github.com/spring-projects/spring-ldap/blob/15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0/odm/src/main/java/org/springframework/ldap/odm/tools/SchemaReader.java#L131-L185 | train |
spring-projects/spring-ldap | core/src/main/java/org/springframework/ldap/core/support/AbstractContextSource.java | AbstractContextSource.closeContext | private void closeContext(DirContext ctx) {
if (ctx != null) {
try {
ctx.close();
}
catch (Exception e) {
LOG.debug("Exception closing context", e);
}
}
} | java | private void closeContext(DirContext ctx) {
if (ctx != null) {
try {
ctx.close();
}
catch (Exception e) {
LOG.debug("Exception closing context", e);
}
}
} | [
"private",
"void",
"closeContext",
"(",
"DirContext",
"ctx",
")",
"{",
"if",
"(",
"ctx",
"!=",
"null",
")",
"{",
"try",
"{",
"ctx",
".",
"close",
"(",
")",
";",
"}",
"catch",
"(",
"Exception",
"e",
")",
"{",
"LOG",
".",
"debug",
"(",
"\"Exception c... | Close the context and swallow any exceptions.
@param ctx the DirContext to close. | [
"Close",
"the",
"context",
"and",
"swallow",
"any",
"exceptions",
"."
] | 15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0 | https://github.com/spring-projects/spring-ldap/blob/15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0/core/src/main/java/org/springframework/ldap/core/support/AbstractContextSource.java#L206-L215 | train |
spring-projects/spring-ldap | core/src/main/java/org/springframework/ldap/core/support/AbstractContextSource.java | AbstractContextSource.createContext | protected DirContext createContext(Hashtable<String, Object> environment) {
DirContext ctx = null;
try {
ctx = getDirContextInstance(environment);
if (LOG.isInfoEnabled()) {
Hashtable<?, ?> ctxEnv = ctx.getEnvironment();
String ldapUrl = (String) ctxEnv.get(Context.PROVIDER_URL);
LOG.debug("Got ... | java | protected DirContext createContext(Hashtable<String, Object> environment) {
DirContext ctx = null;
try {
ctx = getDirContextInstance(environment);
if (LOG.isInfoEnabled()) {
Hashtable<?, ?> ctxEnv = ctx.getEnvironment();
String ldapUrl = (String) ctxEnv.get(Context.PROVIDER_URL);
LOG.debug("Got ... | [
"protected",
"DirContext",
"createContext",
"(",
"Hashtable",
"<",
"String",
",",
"Object",
">",
"environment",
")",
"{",
"DirContext",
"ctx",
"=",
"null",
";",
"try",
"{",
"ctx",
"=",
"getDirContextInstance",
"(",
"environment",
")",
";",
"if",
"(",
"LOG",
... | Create a DirContext using the supplied environment.
@param environment the LDAP environment to use when creating the
<code>DirContext</code>.
@return a new DirContext implementation initialized with the supplied
environment. | [
"Create",
"a",
"DirContext",
"using",
"the",
"supplied",
"environment",
"."
] | 15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0 | https://github.com/spring-projects/spring-ldap/blob/15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0/core/src/main/java/org/springframework/ldap/core/support/AbstractContextSource.java#L339-L357 | train |
spring-projects/spring-ldap | core/src/main/java/org/springframework/ldap/core/support/AbstractContextSource.java | AbstractContextSource.afterPropertiesSet | public void afterPropertiesSet() {
if (ObjectUtils.isEmpty(urls)) {
throw new IllegalArgumentException("At least one server url must be set");
}
if (authenticationSource == null) {
LOG.debug("AuthenticationSource not set - " + "using default implementation");
if (!StringUtils.hasText(userDn)) {
LOG.... | java | public void afterPropertiesSet() {
if (ObjectUtils.isEmpty(urls)) {
throw new IllegalArgumentException("At least one server url must be set");
}
if (authenticationSource == null) {
LOG.debug("AuthenticationSource not set - " + "using default implementation");
if (!StringUtils.hasText(userDn)) {
LOG.... | [
"public",
"void",
"afterPropertiesSet",
"(",
")",
"{",
"if",
"(",
"ObjectUtils",
".",
"isEmpty",
"(",
"urls",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"At least one server url must be set\"",
")",
";",
"}",
"if",
"(",
"authenticationSource... | Checks that all necessary data is set and that there is no compatibility
issues, after which the instance is initialized. Note that you need to
call this method explicitly after setting all desired properties if using
the class outside of a Spring Context. | [
"Checks",
"that",
"all",
"necessary",
"data",
"is",
"set",
"and",
"that",
"there",
"is",
"no",
"compatibility",
"issues",
"after",
"which",
"the",
"instance",
"is",
"initialized",
".",
"Note",
"that",
"you",
"need",
"to",
"call",
"this",
"method",
"explicitl... | 15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0 | https://github.com/spring-projects/spring-ldap/blob/15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0/core/src/main/java/org/springframework/ldap/core/support/AbstractContextSource.java#L407-L427 | train |
spring-projects/spring-ldap | core/src/main/java/org/springframework/ldap/core/support/AbstractContextSource.java | AbstractContextSource.setBaseEnvironmentProperties | public void setBaseEnvironmentProperties(Map<String, Object> baseEnvironmentProperties) {
this.baseEnv = new Hashtable<String, Object>(baseEnvironmentProperties);
} | java | public void setBaseEnvironmentProperties(Map<String, Object> baseEnvironmentProperties) {
this.baseEnv = new Hashtable<String, Object>(baseEnvironmentProperties);
} | [
"public",
"void",
"setBaseEnvironmentProperties",
"(",
"Map",
"<",
"String",
",",
"Object",
">",
"baseEnvironmentProperties",
")",
"{",
"this",
".",
"baseEnv",
"=",
"new",
"Hashtable",
"<",
"String",
",",
"Object",
">",
"(",
"baseEnvironmentProperties",
")",
";"... | If any custom environment properties are needed, these can be set using
this method.
@param baseEnvironmentProperties the base environment properties that should always be used when
creating new Context instances. | [
"If",
"any",
"custom",
"environment",
"properties",
"are",
"needed",
"these",
"can",
"be",
"set",
"using",
"this",
"method",
"."
] | 15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0 | https://github.com/spring-projects/spring-ldap/blob/15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0/core/src/main/java/org/springframework/ldap/core/support/AbstractContextSource.java#L567-L569 | train |
spring-projects/spring-ldap | core/src/main/java/org/springframework/ldap/support/LdapNameBuilder.java | LdapNameBuilder.add | public LdapNameBuilder add(Name name) {
Assert.notNull(name, "name must not be null");
try {
ldapName.addAll(ldapName.size(), name);
return this;
} catch (InvalidNameException e) {
throw new org.springframework.ldap.InvalidNameException(e);
}
} | java | public LdapNameBuilder add(Name name) {
Assert.notNull(name, "name must not be null");
try {
ldapName.addAll(ldapName.size(), name);
return this;
} catch (InvalidNameException e) {
throw new org.springframework.ldap.InvalidNameException(e);
}
} | [
"public",
"LdapNameBuilder",
"add",
"(",
"Name",
"name",
")",
"{",
"Assert",
".",
"notNull",
"(",
"name",
",",
"\"name must not be null\"",
")",
";",
"try",
"{",
"ldapName",
".",
"addAll",
"(",
"ldapName",
".",
"size",
"(",
")",
",",
"name",
")",
";",
... | Append the specified name to the currently built LdapName.
@param name the name to add.
@return this builder. | [
"Append",
"the",
"specified",
"name",
"to",
"the",
"currently",
"built",
"LdapName",
"."
] | 15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0 | https://github.com/spring-projects/spring-ldap/blob/15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0/core/src/main/java/org/springframework/ldap/support/LdapNameBuilder.java#L101-L110 | train |
spring-projects/spring-ldap | core/src/main/java/org/springframework/ldap/support/LdapNameBuilder.java | LdapNameBuilder.add | public LdapNameBuilder add(String name) {
Assert.notNull(name, "name must not be null");
return add(LdapUtils.newLdapName(name));
} | java | public LdapNameBuilder add(String name) {
Assert.notNull(name, "name must not be null");
return add(LdapUtils.newLdapName(name));
} | [
"public",
"LdapNameBuilder",
"add",
"(",
"String",
"name",
")",
"{",
"Assert",
".",
"notNull",
"(",
"name",
",",
"\"name must not be null\"",
")",
";",
"return",
"add",
"(",
"LdapUtils",
".",
"newLdapName",
"(",
"name",
")",
")",
";",
"}"
] | Append the LdapName represented by the specified string to the currently built LdapName.
@param name the name to add.
@return this builder. | [
"Append",
"the",
"LdapName",
"represented",
"by",
"the",
"specified",
"string",
"to",
"the",
"currently",
"built",
"LdapName",
"."
] | 15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0 | https://github.com/spring-projects/spring-ldap/blob/15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0/core/src/main/java/org/springframework/ldap/support/LdapNameBuilder.java#L118-L122 | train |
spring-projects/spring-ldap | core/src/main/java/org/springframework/ldap/core/LdapTemplate.java | LdapTemplate.deleteRecursively | protected void deleteRecursively(DirContext ctx, Name name) {
NamingEnumeration enumeration = null;
try {
enumeration = ctx.listBindings(name);
while (enumeration.hasMore()) {
Binding binding = (Binding) enumeration.next();
LdapName childName = LdapUtils.newLdapName(binding.getName());
childName.... | java | protected void deleteRecursively(DirContext ctx, Name name) {
NamingEnumeration enumeration = null;
try {
enumeration = ctx.listBindings(name);
while (enumeration.hasMore()) {
Binding binding = (Binding) enumeration.next();
LdapName childName = LdapUtils.newLdapName(binding.getName());
childName.... | [
"protected",
"void",
"deleteRecursively",
"(",
"DirContext",
"ctx",
",",
"Name",
"name",
")",
"{",
"NamingEnumeration",
"enumeration",
"=",
"null",
";",
"try",
"{",
"enumeration",
"=",
"ctx",
".",
"listBindings",
"(",
"name",
")",
";",
"while",
"(",
"enumera... | Delete all subcontexts including the current one recursively.
@param ctx The context to use for deleting.
@param name The starting point to delete recursively.
@throws NamingException if any error occurs | [
"Delete",
"all",
"subcontexts",
"including",
"the",
"current",
"one",
"recursively",
"."
] | 15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0 | https://github.com/spring-projects/spring-ldap/blob/15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0/core/src/main/java/org/springframework/ldap/core/LdapTemplate.java#L1096-L1123 | train |
spring-projects/spring-ldap | core/src/main/java/org/springframework/ldap/core/LdapTemplate.java | LdapTemplate.assureReturnObjFlagSet | private void assureReturnObjFlagSet(SearchControls controls) {
Assert.notNull(controls, "controls must not be null");
if (!controls.getReturningObjFlag()) {
LOG.debug("The returnObjFlag of supplied SearchControls is not set"
+ " but a ContextMapper is used - setting flag to true");
control... | java | private void assureReturnObjFlagSet(SearchControls controls) {
Assert.notNull(controls, "controls must not be null");
if (!controls.getReturningObjFlag()) {
LOG.debug("The returnObjFlag of supplied SearchControls is not set"
+ " but a ContextMapper is used - setting flag to true");
control... | [
"private",
"void",
"assureReturnObjFlagSet",
"(",
"SearchControls",
"controls",
")",
"{",
"Assert",
".",
"notNull",
"(",
"controls",
",",
"\"controls must not be null\"",
")",
";",
"if",
"(",
"!",
"controls",
".",
"getReturningObjFlag",
"(",
")",
")",
"{",
"LOG"... | Make sure the returnObjFlag is set in the supplied SearchControls. Set it
and log if it's not set.
@param controls the SearchControls to check. | [
"Make",
"sure",
"the",
"returnObjFlag",
"is",
"set",
"in",
"the",
"supplied",
"SearchControls",
".",
"Set",
"it",
"and",
"log",
"if",
"it",
"s",
"not",
"set",
"."
] | 15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0 | https://github.com/spring-projects/spring-ldap/blob/15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0/core/src/main/java/org/springframework/ldap/core/LdapTemplate.java#L1241-L1248 | train |
spring-projects/spring-ldap | core/src/main/java/org/springframework/ldap/pool/DelegatingDirContext.java | DelegatingDirContext.getInnermostDelegateDirContext | public DirContext getInnermostDelegateDirContext() {
final DirContext delegateDirContext = this.getDelegateDirContext();
if (delegateDirContext instanceof DelegatingDirContext) {
return ((DelegatingDirContext)delegateDirContext).getInnermostDelegateDirContext();
}
return de... | java | public DirContext getInnermostDelegateDirContext() {
final DirContext delegateDirContext = this.getDelegateDirContext();
if (delegateDirContext instanceof DelegatingDirContext) {
return ((DelegatingDirContext)delegateDirContext).getInnermostDelegateDirContext();
}
return de... | [
"public",
"DirContext",
"getInnermostDelegateDirContext",
"(",
")",
"{",
"final",
"DirContext",
"delegateDirContext",
"=",
"this",
".",
"getDelegateDirContext",
"(",
")",
";",
"if",
"(",
"delegateDirContext",
"instanceof",
"DelegatingDirContext",
")",
"{",
"return",
"... | Recursivley inspect delegates until a non-delegating dir context is found.
@return The innermost (real) DirContext that is being delegated to. | [
"Recursivley",
"inspect",
"delegates",
"until",
"a",
"non",
"-",
"delegating",
"dir",
"context",
"is",
"found",
"."
] | 15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0 | https://github.com/spring-projects/spring-ldap/blob/15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0/core/src/main/java/org/springframework/ldap/pool/DelegatingDirContext.java#L78-L86 | train |
spring-projects/spring-ldap | core/src/main/java/org/springframework/ldap/transaction/compensating/LdapTransactionUtils.java | LdapTransactionUtils.getFirstArgumentAsName | public static Name getFirstArgumentAsName(Object[] args) {
Assert.notEmpty(args);
Object firstArg = args[0];
return getArgumentAsName(firstArg);
} | java | public static Name getFirstArgumentAsName(Object[] args) {
Assert.notEmpty(args);
Object firstArg = args[0];
return getArgumentAsName(firstArg);
} | [
"public",
"static",
"Name",
"getFirstArgumentAsName",
"(",
"Object",
"[",
"]",
"args",
")",
"{",
"Assert",
".",
"notEmpty",
"(",
"args",
")",
";",
"Object",
"firstArg",
"=",
"args",
"[",
"0",
"]",
";",
"return",
"getArgumentAsName",
"(",
"firstArg",
")",
... | Get the first parameter in the argument list as a Name.
@param args
arguments supplied to a ldap operation.
@return a Name representation of the first argument, or the Name itself
if it is a name. | [
"Get",
"the",
"first",
"parameter",
"in",
"the",
"argument",
"list",
"as",
"a",
"Name",
"."
] | 15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0 | https://github.com/spring-projects/spring-ldap/blob/15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0/core/src/main/java/org/springframework/ldap/transaction/compensating/LdapTransactionUtils.java#L57-L62 | train |
spring-projects/spring-ldap | core/src/main/java/org/springframework/ldap/transaction/compensating/LdapTransactionUtils.java | LdapTransactionUtils.getArgumentAsName | public static Name getArgumentAsName(Object arg) {
if (arg instanceof String) {
return LdapUtils.newLdapName((String) arg);
} else if (arg instanceof Name) {
return (Name) arg;
} else {
throw new IllegalArgumentException(
"First argu... | java | public static Name getArgumentAsName(Object arg) {
if (arg instanceof String) {
return LdapUtils.newLdapName((String) arg);
} else if (arg instanceof Name) {
return (Name) arg;
} else {
throw new IllegalArgumentException(
"First argu... | [
"public",
"static",
"Name",
"getArgumentAsName",
"(",
"Object",
"arg",
")",
"{",
"if",
"(",
"arg",
"instanceof",
"String",
")",
"{",
"return",
"LdapUtils",
".",
"newLdapName",
"(",
"(",
"String",
")",
"arg",
")",
";",
"}",
"else",
"if",
"(",
"arg",
"in... | Get the argument as a Name.
@param arg
an argument supplied to an Ldap operation.
@return a Name representation of the argument, or the Name itself if it
is a Name. | [
"Get",
"the",
"argument",
"as",
"a",
"Name",
"."
] | 15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0 | https://github.com/spring-projects/spring-ldap/blob/15142d4ae18a9dc6b363a1ebf085e2bda9d9a4c0/core/src/main/java/org/springframework/ldap/transaction/compensating/LdapTransactionUtils.java#L72-L81 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.