id int32 0 165k | repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 |
|---|---|---|---|---|---|---|---|---|---|---|---|
51,700 | structurizr/java | structurizr-client/src/com/structurizr/io/json/EncryptedJsonWriter.java | EncryptedJsonWriter.write | public void write(EncryptedWorkspace workspace, Writer writer) throws WorkspaceWriterException {
if (workspace == null) {
throw new IllegalArgumentException("EncryptedWorkspace cannot be null.");
}
if (writer == null) {
throw new IllegalArgumentException("Writer cannot be... | java | public void write(EncryptedWorkspace workspace, Writer writer) throws WorkspaceWriterException {
if (workspace == null) {
throw new IllegalArgumentException("EncryptedWorkspace cannot be null.");
}
if (writer == null) {
throw new IllegalArgumentException("Writer cannot be... | [
"public",
"void",
"write",
"(",
"EncryptedWorkspace",
"workspace",
",",
"Writer",
"writer",
")",
"throws",
"WorkspaceWriterException",
"{",
"if",
"(",
"workspace",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"EncryptedWorkspace cannot be... | Writes an encrypted workspace definition as a JSON string to the specified Writer object.
@param workspace the Workspace object to write
@param writer the Writer object to write the workspace to
@throws WorkspaceWriterException if something goes wrong | [
"Writes",
"an",
"encrypted",
"workspace",
"definition",
"as",
"a",
"JSON",
"string",
"to",
"the",
"specified",
"Writer",
"object",
"."
] | 4b204f077877a24bcac363f5ecf0e129a0f9f4c5 | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-client/src/com/structurizr/io/json/EncryptedJsonWriter.java#L27-L50 |
51,701 | structurizr/java | structurizr-core/src/com/structurizr/view/DynamicView.java | DynamicView.checkElement | private void checkElement(Element elementToBeAdded) {
if (!(elementToBeAdded instanceof Person) && !(elementToBeAdded instanceof SoftwareSystem) && !(elementToBeAdded instanceof Container) && !(elementToBeAdded instanceof Component)) {
throw new IllegalArgumentException("Only people, software system... | java | private void checkElement(Element elementToBeAdded) {
if (!(elementToBeAdded instanceof Person) && !(elementToBeAdded instanceof SoftwareSystem) && !(elementToBeAdded instanceof Container) && !(elementToBeAdded instanceof Component)) {
throw new IllegalArgumentException("Only people, software system... | [
"private",
"void",
"checkElement",
"(",
"Element",
"elementToBeAdded",
")",
"{",
"if",
"(",
"!",
"(",
"elementToBeAdded",
"instanceof",
"Person",
")",
"&&",
"!",
"(",
"elementToBeAdded",
"instanceof",
"SoftwareSystem",
")",
"&&",
"!",
"(",
"elementToBeAdded",
"i... | This checks that only appropriate elements can be added to the view. | [
"This",
"checks",
"that",
"only",
"appropriate",
"elements",
"can",
"be",
"added",
"to",
"the",
"view",
"."
] | 4b204f077877a24bcac363f5ecf0e129a0f9f4c5 | https://github.com/structurizr/java/blob/4b204f077877a24bcac363f5ecf0e129a0f9f4c5/structurizr-core/src/com/structurizr/view/DynamicView.java#L123-L168 |
51,702 | jgilfelt/android-sqlite-asset-helper | library/src/main/java/com/readystatesoftware/sqliteasset/VersionComparator.java | VersionComparator.compare | @Override
public int compare(String file0, String file1) {
Matcher m0 = pattern.matcher(file0);
Matcher m1 = pattern.matcher(file1);
if (!m0.matches()) {
Log.w(TAG, "could not parse upgrade script file: " + file0);
throw new SQLiteAssetException("Invalid upgrade scri... | java | @Override
public int compare(String file0, String file1) {
Matcher m0 = pattern.matcher(file0);
Matcher m1 = pattern.matcher(file1);
if (!m0.matches()) {
Log.w(TAG, "could not parse upgrade script file: " + file0);
throw new SQLiteAssetException("Invalid upgrade scri... | [
"@",
"Override",
"public",
"int",
"compare",
"(",
"String",
"file0",
",",
"String",
"file1",
")",
"{",
"Matcher",
"m0",
"=",
"pattern",
".",
"matcher",
"(",
"file0",
")",
";",
"Matcher",
"m1",
"=",
"pattern",
".",
"matcher",
"(",
"file1",
")",
";",
"... | Compares the two specified upgrade script strings to determine their
relative ordering considering their two version numbers. Assumes all
database names used are the same, as this function only compares the
two version numbers.
@param file0
an upgrade script file name
@param file1
a second upgrade script file name to ... | [
"Compares",
"the",
"two",
"specified",
"upgrade",
"script",
"strings",
"to",
"determine",
"their",
"relative",
"ordering",
"considering",
"their",
"two",
"version",
"numbers",
".",
"Assumes",
"all",
"database",
"names",
"used",
"are",
"the",
"same",
"as",
"this"... | 74a9b0d68aeb1bb0b9778c5598e37da573919ce1 | https://github.com/jgilfelt/android-sqlite-asset-helper/blob/74a9b0d68aeb1bb0b9778c5598e37da573919ce1/library/src/main/java/com/readystatesoftware/sqliteasset/VersionComparator.java#L49-L80 |
51,703 | traex/RippleEffect | library/src/main/java/com/andexert/library/RippleView.java | RippleView.init | private void init(final Context context, final AttributeSet attrs) {
if (isInEditMode())
return;
final TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.RippleView);
rippleColor = typedArray.getColor(R.styleable.RippleView_rv_color, getResources().getColor(R.... | java | private void init(final Context context, final AttributeSet attrs) {
if (isInEditMode())
return;
final TypedArray typedArray = context.obtainStyledAttributes(attrs, R.styleable.RippleView);
rippleColor = typedArray.getColor(R.styleable.RippleView_rv_color, getResources().getColor(R.... | [
"private",
"void",
"init",
"(",
"final",
"Context",
"context",
",",
"final",
"AttributeSet",
"attrs",
")",
"{",
"if",
"(",
"isInEditMode",
"(",
")",
")",
"return",
";",
"final",
"TypedArray",
"typedArray",
"=",
"context",
".",
"obtainStyledAttributes",
"(",
... | Method that initializes all fields and sets listeners
@param context Context used to create this view
@param attrs Attribute used to initialize fields | [
"Method",
"that",
"initializes",
"all",
"fields",
"and",
"sets",
"listeners"
] | df5f9e4456eae8a8e98e2827a3c6f9e7185596e1 | https://github.com/traex/RippleEffect/blob/df5f9e4456eae8a8e98e2827a3c6f9e7185596e1/library/src/main/java/com/andexert/library/RippleView.java#L111-L156 |
51,704 | traex/RippleEffect | library/src/main/java/com/andexert/library/RippleView.java | RippleView.createAnimation | private void createAnimation(final float x, final float y) {
if (this.isEnabled() && !animationRunning) {
if (hasToZoom)
this.startAnimation(scaleAnimation);
radiusMax = Math.max(WIDTH, HEIGHT);
if (rippleType != 2)
radiusMax /= 2;
... | java | private void createAnimation(final float x, final float y) {
if (this.isEnabled() && !animationRunning) {
if (hasToZoom)
this.startAnimation(scaleAnimation);
radiusMax = Math.max(WIDTH, HEIGHT);
if (rippleType != 2)
radiusMax /= 2;
... | [
"private",
"void",
"createAnimation",
"(",
"final",
"float",
"x",
",",
"final",
"float",
"y",
")",
"{",
"if",
"(",
"this",
".",
"isEnabled",
"(",
")",
"&&",
"!",
"animationRunning",
")",
"{",
"if",
"(",
"hasToZoom",
")",
"this",
".",
"startAnimation",
... | Create Ripple animation centered at x, y
@param x Horizontal position of the ripple center
@param y Vertical position of the ripple center | [
"Create",
"Ripple",
"animation",
"centered",
"at",
"x",
"y"
] | df5f9e4456eae8a8e98e2827a3c6f9e7185596e1 | https://github.com/traex/RippleEffect/blob/df5f9e4456eae8a8e98e2827a3c6f9e7185596e1/library/src/main/java/com/andexert/library/RippleView.java#L249-L276 |
51,705 | traex/RippleEffect | library/src/main/java/com/andexert/library/RippleView.java | RippleView.sendClickEvent | private void sendClickEvent(final Boolean isLongClick) {
if (getParent() instanceof AdapterView) {
final AdapterView adapterView = (AdapterView) getParent();
final int position = adapterView.getPositionForView(this);
final long id = adapterView.getItemIdAtPosition(position);
... | java | private void sendClickEvent(final Boolean isLongClick) {
if (getParent() instanceof AdapterView) {
final AdapterView adapterView = (AdapterView) getParent();
final int position = adapterView.getPositionForView(this);
final long id = adapterView.getItemIdAtPosition(position);
... | [
"private",
"void",
"sendClickEvent",
"(",
"final",
"Boolean",
"isLongClick",
")",
"{",
"if",
"(",
"getParent",
"(",
")",
"instanceof",
"AdapterView",
")",
"{",
"final",
"AdapterView",
"adapterView",
"=",
"(",
"AdapterView",
")",
"getParent",
"(",
")",
";",
"... | Send a click event if parent view is a Listview instance
@param isLongClick Is the event a long click ? | [
"Send",
"a",
"click",
"event",
"if",
"parent",
"view",
"is",
"a",
"Listview",
"instance"
] | df5f9e4456eae8a8e98e2827a3c6f9e7185596e1 | https://github.com/traex/RippleEffect/blob/df5f9e4456eae8a8e98e2827a3c6f9e7185596e1/library/src/main/java/com/andexert/library/RippleView.java#L298-L311 |
51,706 | mapbox/mapbox-java | services-geojson/src/main/java/com/mapbox/geojson/GeometryAdapterFactory.java | GeometryAdapterFactory.create | public static TypeAdapterFactory create() {
if (geometryTypeFactory == null) {
geometryTypeFactory = RuntimeTypeAdapterFactory.of(Geometry.class, "type", true)
.registerSubtype(GeometryCollection.class, "GeometryCollection")
.registerSubtype(Point.class, "Point")
.registerSubtype(Mult... | java | public static TypeAdapterFactory create() {
if (geometryTypeFactory == null) {
geometryTypeFactory = RuntimeTypeAdapterFactory.of(Geometry.class, "type", true)
.registerSubtype(GeometryCollection.class, "GeometryCollection")
.registerSubtype(Point.class, "Point")
.registerSubtype(Mult... | [
"public",
"static",
"TypeAdapterFactory",
"create",
"(",
")",
"{",
"if",
"(",
"geometryTypeFactory",
"==",
"null",
")",
"{",
"geometryTypeFactory",
"=",
"RuntimeTypeAdapterFactory",
".",
"of",
"(",
"Geometry",
".",
"class",
",",
"\"type\"",
",",
"true",
")",
"... | Create a new instance of Geometry type adapter factory, this is passed into the Gson
Builder.
@return a new GSON TypeAdapterFactory
@since 4.4.0 | [
"Create",
"a",
"new",
"instance",
"of",
"Geometry",
"type",
"adapter",
"factory",
"this",
"is",
"passed",
"into",
"the",
"Gson",
"Builder",
"."
] | c0be138f462f91441388584c668f3760ba0e18e2 | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-geojson/src/main/java/com/mapbox/geojson/GeometryAdapterFactory.java#L26-L39 |
51,707 | mapbox/mapbox-java | services-geojson/src/main/java/com/mapbox/geojson/MultiLineString.java | MultiLineString.lineStrings | public List<LineString> lineStrings() {
List<List<Point>> coordinates = coordinates();
List<LineString> lineStrings = new ArrayList<>(coordinates.size());
for (List<Point> points : coordinates) {
lineStrings.add(LineString.fromLngLats(points));
}
return lineStrings;
} | java | public List<LineString> lineStrings() {
List<List<Point>> coordinates = coordinates();
List<LineString> lineStrings = new ArrayList<>(coordinates.size());
for (List<Point> points : coordinates) {
lineStrings.add(LineString.fromLngLats(points));
}
return lineStrings;
} | [
"public",
"List",
"<",
"LineString",
">",
"lineStrings",
"(",
")",
"{",
"List",
"<",
"List",
"<",
"Point",
">>",
"coordinates",
"=",
"coordinates",
"(",
")",
";",
"List",
"<",
"LineString",
">",
"lineStrings",
"=",
"new",
"ArrayList",
"<>",
"(",
"coordin... | Returns a list of LineStrings which are currently making up this MultiLineString.
@return a list of {@link LineString}s
@since 3.0.0 | [
"Returns",
"a",
"list",
"of",
"LineStrings",
"which",
"are",
"currently",
"making",
"up",
"this",
"MultiLineString",
"."
] | c0be138f462f91441388584c668f3760ba0e18e2 | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-geojson/src/main/java/com/mapbox/geojson/MultiLineString.java#L255-L262 |
51,708 | mapbox/mapbox-java | services-core/src/main/java/com/mapbox/core/utils/TextUtils.java | TextUtils.formatCoordinate | public static String formatCoordinate(double coordinate) {
DecimalFormat decimalFormat = new DecimalFormat("0.######",
new DecimalFormatSymbols(Locale.US));
return String.format(Locale.US, "%s",
decimalFormat.format(coordinate));
} | java | public static String formatCoordinate(double coordinate) {
DecimalFormat decimalFormat = new DecimalFormat("0.######",
new DecimalFormatSymbols(Locale.US));
return String.format(Locale.US, "%s",
decimalFormat.format(coordinate));
} | [
"public",
"static",
"String",
"formatCoordinate",
"(",
"double",
"coordinate",
")",
"{",
"DecimalFormat",
"decimalFormat",
"=",
"new",
"DecimalFormat",
"(",
"\"0.######\"",
",",
"new",
"DecimalFormatSymbols",
"(",
"Locale",
".",
"US",
")",
")",
";",
"return",
"S... | Useful to remove any trailing zeros and prevent a coordinate being over 7 significant figures.
@param coordinate a double value representing a coordinate.
@return a formatted string.
@since 2.1.0 | [
"Useful",
"to",
"remove",
"any",
"trailing",
"zeros",
"and",
"prevent",
"a",
"coordinate",
"being",
"over",
"7",
"significant",
"figures",
"."
] | c0be138f462f91441388584c668f3760ba0e18e2 | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-core/src/main/java/com/mapbox/core/utils/TextUtils.java#L67-L72 |
51,709 | mapbox/mapbox-java | services-core/src/main/java/com/mapbox/core/utils/TextUtils.java | TextUtils.formatCoordinate | public static String formatCoordinate(double coordinate, int precision) {
String pattern = "0." + new String(new char[precision]).replace("\0", "0");
DecimalFormat df = (DecimalFormat) DecimalFormat.getInstance(Locale.US);
df.applyPattern(pattern);
df.setRoundingMode(RoundingMode.FLOOR);
return df.f... | java | public static String formatCoordinate(double coordinate, int precision) {
String pattern = "0." + new String(new char[precision]).replace("\0", "0");
DecimalFormat df = (DecimalFormat) DecimalFormat.getInstance(Locale.US);
df.applyPattern(pattern);
df.setRoundingMode(RoundingMode.FLOOR);
return df.f... | [
"public",
"static",
"String",
"formatCoordinate",
"(",
"double",
"coordinate",
",",
"int",
"precision",
")",
"{",
"String",
"pattern",
"=",
"\"0.\"",
"+",
"new",
"String",
"(",
"new",
"char",
"[",
"precision",
"]",
")",
".",
"replace",
"(",
"\"\\0\"",
",",... | Allows the specific adjusting of a coordinates precision.
@param coordinate a double value representing a coordinate.
@param precision an integer value you'd like the precision to be at.
@return a formatted string.
@since 2.1.0 | [
"Allows",
"the",
"specific",
"adjusting",
"of",
"a",
"coordinates",
"precision",
"."
] | c0be138f462f91441388584c668f3760ba0e18e2 | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-core/src/main/java/com/mapbox/core/utils/TextUtils.java#L82-L88 |
51,710 | mapbox/mapbox-java | services-core/src/main/java/com/mapbox/core/utils/TextUtils.java | TextUtils.formatRadiuses | public static String formatRadiuses(double[] radiuses) {
if (radiuses == null || radiuses.length == 0) {
return null;
}
String[] radiusesFormatted = new String[radiuses.length];
for (int i = 0; i < radiuses.length; i++) {
if (radiuses[i] == Double.POSITIVE_INFINITY) {
radiusesFormat... | java | public static String formatRadiuses(double[] radiuses) {
if (radiuses == null || radiuses.length == 0) {
return null;
}
String[] radiusesFormatted = new String[radiuses.length];
for (int i = 0; i < radiuses.length; i++) {
if (radiuses[i] == Double.POSITIVE_INFINITY) {
radiusesFormat... | [
"public",
"static",
"String",
"formatRadiuses",
"(",
"double",
"[",
"]",
"radiuses",
")",
"{",
"if",
"(",
"radiuses",
"==",
"null",
"||",
"radiuses",
".",
"length",
"==",
"0",
")",
"{",
"return",
"null",
";",
"}",
"String",
"[",
"]",
"radiusesFormatted",... | Used in various APIs to format the user provided radiuses to a String matching the APIs format.
@param radiuses a double array which represents the radius values
@return a String ready for being passed into the Retrofit call
@since 3.0.0 | [
"Used",
"in",
"various",
"APIs",
"to",
"format",
"the",
"user",
"provided",
"radiuses",
"to",
"a",
"String",
"matching",
"the",
"APIs",
"format",
"."
] | c0be138f462f91441388584c668f3760ba0e18e2 | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-core/src/main/java/com/mapbox/core/utils/TextUtils.java#L97-L112 |
51,711 | mapbox/mapbox-java | services-core/src/main/java/com/mapbox/core/utils/TextUtils.java | TextUtils.formatBearing | public static String formatBearing(List<Double[]> bearings) {
if (bearings.isEmpty()) {
return null;
}
String[] bearingFormatted = new String[bearings.size()];
for (int i = 0; i < bearings.size(); i++) {
if (bearings.get(i).length == 0) {
bearingFormatted[i] = "";
} else {
... | java | public static String formatBearing(List<Double[]> bearings) {
if (bearings.isEmpty()) {
return null;
}
String[] bearingFormatted = new String[bearings.size()];
for (int i = 0; i < bearings.size(); i++) {
if (bearings.get(i).length == 0) {
bearingFormatted[i] = "";
} else {
... | [
"public",
"static",
"String",
"formatBearing",
"(",
"List",
"<",
"Double",
"[",
"]",
">",
"bearings",
")",
"{",
"if",
"(",
"bearings",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"String",
"[",
"]",
"bearingFormatted",
"=",
"new",
... | Formats the bearing variables from the raw values to a string which can than be used for the
request URL.
@param bearings a List of doubles representing bearing values
@return a string with the bearing values
@since 3.0.0 | [
"Formats",
"the",
"bearing",
"variables",
"from",
"the",
"raw",
"values",
"to",
"a",
"string",
"which",
"can",
"than",
"be",
"used",
"for",
"the",
"request",
"URL",
"."
] | c0be138f462f91441388584c668f3760ba0e18e2 | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-core/src/main/java/com/mapbox/core/utils/TextUtils.java#L122-L138 |
51,712 | mapbox/mapbox-java | services-core/src/main/java/com/mapbox/core/utils/TextUtils.java | TextUtils.formatDistributions | public static String formatDistributions(List<Integer[]> distributions) {
if (distributions.isEmpty()) {
return null;
}
String[] distributionsFormatted = new String[distributions.size()];
for (int i = 0; i < distributions.size(); i++) {
if (distributions.get(i).length == 0) {
distri... | java | public static String formatDistributions(List<Integer[]> distributions) {
if (distributions.isEmpty()) {
return null;
}
String[] distributionsFormatted = new String[distributions.size()];
for (int i = 0; i < distributions.size(); i++) {
if (distributions.get(i).length == 0) {
distri... | [
"public",
"static",
"String",
"formatDistributions",
"(",
"List",
"<",
"Integer",
"[",
"]",
">",
"distributions",
")",
"{",
"if",
"(",
"distributions",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"String",
"[",
"]",
"distributionsFormat... | converts the list of integer arrays to a string ready for API consumption.
@param distributions the list of integer arrays representing the distribution
@return a string with the distribution values
@since 3.0.0 | [
"converts",
"the",
"list",
"of",
"integer",
"arrays",
"to",
"a",
"string",
"ready",
"for",
"API",
"consumption",
"."
] | c0be138f462f91441388584c668f3760ba0e18e2 | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-core/src/main/java/com/mapbox/core/utils/TextUtils.java#L147-L163 |
51,713 | mapbox/mapbox-java | services-core/src/main/java/com/mapbox/core/utils/TextUtils.java | TextUtils.formatApproaches | public static String formatApproaches(String[] approaches) {
for (int i = 0; i < approaches.length; i++) {
if (approaches[i] == null) {
approaches[i] = "";
} else if (!approaches[i].equals("unrestricted")
&& !approaches[i].equals("curb") && !approaches[i].isEmpty()) {
return null... | java | public static String formatApproaches(String[] approaches) {
for (int i = 0; i < approaches.length; i++) {
if (approaches[i] == null) {
approaches[i] = "";
} else if (!approaches[i].equals("unrestricted")
&& !approaches[i].equals("curb") && !approaches[i].isEmpty()) {
return null... | [
"public",
"static",
"String",
"formatApproaches",
"(",
"String",
"[",
"]",
"approaches",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"approaches",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"approaches",
"[",
"i",
"]",
"==",... | Converts String array with approaches values
to a string ready for API consumption.
An approach could be unrestricted, curb or null.
@param approaches a string representing approaches to each coordinate.
@return a formatted string.
@since 3.2.0 | [
"Converts",
"String",
"array",
"with",
"approaches",
"values",
"to",
"a",
"string",
"ready",
"for",
"API",
"consumption",
".",
"An",
"approach",
"could",
"be",
"unrestricted",
"curb",
"or",
"null",
"."
] | c0be138f462f91441388584c668f3760ba0e18e2 | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-core/src/main/java/com/mapbox/core/utils/TextUtils.java#L174-L184 |
51,714 | mapbox/mapbox-java | services-core/src/main/java/com/mapbox/core/utils/TextUtils.java | TextUtils.formatWaypointNames | public static String formatWaypointNames(String[] waypointNames) {
for (int i = 0; i < waypointNames.length; i++) {
if (waypointNames[i] == null) {
waypointNames[i] = "";
}
}
return TextUtils.join(";", waypointNames);
} | java | public static String formatWaypointNames(String[] waypointNames) {
for (int i = 0; i < waypointNames.length; i++) {
if (waypointNames[i] == null) {
waypointNames[i] = "";
}
}
return TextUtils.join(";", waypointNames);
} | [
"public",
"static",
"String",
"formatWaypointNames",
"(",
"String",
"[",
"]",
"waypointNames",
")",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"waypointNames",
".",
"length",
";",
"i",
"++",
")",
"{",
"if",
"(",
"waypointNames",
"[",
"i",
... | Converts String array with waypoint_names values
to a string ready for API consumption.
@param waypointNames a string representing approaches to each coordinate.
@return a formatted string.
@since 3.3.0 | [
"Converts",
"String",
"array",
"with",
"waypoint_names",
"values",
"to",
"a",
"string",
"ready",
"for",
"API",
"consumption",
"."
] | c0be138f462f91441388584c668f3760ba0e18e2 | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-core/src/main/java/com/mapbox/core/utils/TextUtils.java#L194-L201 |
51,715 | mapbox/mapbox-java | services-geojson/src/main/java/com/mapbox/geojson/Point.java | Point.fromLngLat | public static Point fromLngLat(
@FloatRange(from = MIN_LONGITUDE, to = MAX_LONGITUDE) double longitude,
@FloatRange(from = MIN_LATITUDE, to = MAX_LATITUDE) double latitude) {
List<Double> coordinates =
CoordinateShifterManager.getCoordinateShifter().shiftLonLat(longitude, latitude);
return new Po... | java | public static Point fromLngLat(
@FloatRange(from = MIN_LONGITUDE, to = MAX_LONGITUDE) double longitude,
@FloatRange(from = MIN_LATITUDE, to = MAX_LATITUDE) double latitude) {
List<Double> coordinates =
CoordinateShifterManager.getCoordinateShifter().shiftLonLat(longitude, latitude);
return new Po... | [
"public",
"static",
"Point",
"fromLngLat",
"(",
"@",
"FloatRange",
"(",
"from",
"=",
"MIN_LONGITUDE",
",",
"to",
"=",
"MAX_LONGITUDE",
")",
"double",
"longitude",
",",
"@",
"FloatRange",
"(",
"from",
"=",
"MIN_LATITUDE",
",",
"to",
"=",
"MAX_LATITUDE",
")",
... | Create a new instance of this class defining a longitude and latitude value in that respective
order. Longitude values are limited to a -180 to 180 range and latitude's limited to -90 to 90
as the spec defines. While no limit is placed on decimal precision, for performance reasons
when serializing and deserializing it ... | [
"Create",
"a",
"new",
"instance",
"of",
"this",
"class",
"defining",
"a",
"longitude",
"and",
"latitude",
"value",
"in",
"that",
"respective",
"order",
".",
"Longitude",
"values",
"are",
"limited",
"to",
"a",
"-",
"180",
"to",
"180",
"range",
"and",
"latit... | c0be138f462f91441388584c668f3760ba0e18e2 | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-geojson/src/main/java/com/mapbox/geojson/Point.java#L101-L108 |
51,716 | mapbox/mapbox-java | services-geojson/src/main/java/com/mapbox/geojson/Polygon.java | Polygon.isLinearRing | private static boolean isLinearRing(LineString lineString) {
if (lineString.coordinates().size() < 4) {
throw new GeoJsonException("LinearRings need to be made up of 4 or more coordinates.");
}
if (!(lineString.coordinates().get(0).equals(
lineString.coordinates().get(lineString.coordinates().si... | java | private static boolean isLinearRing(LineString lineString) {
if (lineString.coordinates().size() < 4) {
throw new GeoJsonException("LinearRings need to be made up of 4 or more coordinates.");
}
if (!(lineString.coordinates().get(0).equals(
lineString.coordinates().get(lineString.coordinates().si... | [
"private",
"static",
"boolean",
"isLinearRing",
"(",
"LineString",
"lineString",
")",
"{",
"if",
"(",
"lineString",
".",
"coordinates",
"(",
")",
".",
"size",
"(",
")",
"<",
"4",
")",
"{",
"throw",
"new",
"GeoJsonException",
"(",
"\"LinearRings need to be made... | Checks to ensure that the LineStrings defining the polygon correctly and adhering to the linear
ring rules.
@param lineString {@link LineString} the polygon geometry
@return true if number of coordinates are 4 or more, and first and last coordinates
are identical, else false
@throws GeoJsonException if number of coord... | [
"Checks",
"to",
"ensure",
"that",
"the",
"LineStrings",
"defining",
"the",
"polygon",
"correctly",
"and",
"adhering",
"to",
"the",
"linear",
"ring",
"rules",
"."
] | c0be138f462f91441388584c668f3760ba0e18e2 | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-geojson/src/main/java/com/mapbox/geojson/Polygon.java#L385-L394 |
51,717 | mapbox/mapbox-java | services-core/src/main/java/com/mapbox/core/MapboxService.java | MapboxService.getService | protected S getService() {
// No need to recreate it
if (service != null) {
return service;
}
Retrofit.Builder retrofitBuilder = new Retrofit.Builder()
.baseUrl(baseUrl())
.addConverterFactory(GsonConverterFactory.create(getGsonBuilder().create()));
if (getCallFactory() != null) ... | java | protected S getService() {
// No need to recreate it
if (service != null) {
return service;
}
Retrofit.Builder retrofitBuilder = new Retrofit.Builder()
.baseUrl(baseUrl())
.addConverterFactory(GsonConverterFactory.create(getGsonBuilder().create()));
if (getCallFactory() != null) ... | [
"protected",
"S",
"getService",
"(",
")",
"{",
"// No need to recreate it",
"if",
"(",
"service",
"!=",
"null",
")",
"{",
"return",
"service",
";",
"}",
"Retrofit",
".",
"Builder",
"retrofitBuilder",
"=",
"new",
"Retrofit",
".",
"Builder",
"(",
")",
".",
"... | Creates the Retrofit object and the service if they are not already created. Subclasses can
override getGsonBuilder to add anything to the GsonBuilder.
@return new service if not already created, otherwise the existing service
@since 3.0.0 | [
"Creates",
"the",
"Retrofit",
"object",
"and",
"the",
"service",
"if",
"they",
"are",
"not",
"already",
"created",
".",
"Subclasses",
"can",
"override",
"getGsonBuilder",
"to",
"add",
"anything",
"to",
"the",
"GsonBuilder",
"."
] | c0be138f462f91441388584c668f3760ba0e18e2 | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-core/src/main/java/com/mapbox/core/MapboxService.java#L125-L144 |
51,718 | mapbox/mapbox-java | services-core/src/main/java/com/mapbox/core/MapboxService.java | MapboxService.getOkHttpClient | protected synchronized OkHttpClient getOkHttpClient() {
if (okHttpClient == null) {
if (isEnableDebug()) {
HttpLoggingInterceptor logging = new HttpLoggingInterceptor();
logging.setLevel(HttpLoggingInterceptor.Level.BASIC);
OkHttpClient.Builder httpClient = new OkHttpClient.Builder();
... | java | protected synchronized OkHttpClient getOkHttpClient() {
if (okHttpClient == null) {
if (isEnableDebug()) {
HttpLoggingInterceptor logging = new HttpLoggingInterceptor();
logging.setLevel(HttpLoggingInterceptor.Level.BASIC);
OkHttpClient.Builder httpClient = new OkHttpClient.Builder();
... | [
"protected",
"synchronized",
"OkHttpClient",
"getOkHttpClient",
"(",
")",
"{",
"if",
"(",
"okHttpClient",
"==",
"null",
")",
"{",
"if",
"(",
"isEnableDebug",
"(",
")",
")",
"{",
"HttpLoggingInterceptor",
"logging",
"=",
"new",
"HttpLoggingInterceptor",
"(",
")",... | Used Internally.
@return OkHttpClient
@since 1.0.0 | [
"Used",
"Internally",
"."
] | c0be138f462f91441388584c668f3760ba0e18e2 | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-core/src/main/java/com/mapbox/core/MapboxService.java#L212-L225 |
51,719 | mapbox/mapbox-java | services-directions/src/main/java/com/mapbox/api/directions/v5/MapboxDirections.java | MapboxDirections.formatWaypointTargets | private static String formatWaypointTargets(Point[] waypointTargets) {
String[] coordinatesFormatted = new String[waypointTargets.length];
int index = 0;
for (Point target : waypointTargets) {
if (target == null) {
coordinatesFormatted[index++] = "";
} else {
coordinatesFormatted... | java | private static String formatWaypointTargets(Point[] waypointTargets) {
String[] coordinatesFormatted = new String[waypointTargets.length];
int index = 0;
for (Point target : waypointTargets) {
if (target == null) {
coordinatesFormatted[index++] = "";
} else {
coordinatesFormatted... | [
"private",
"static",
"String",
"formatWaypointTargets",
"(",
"Point",
"[",
"]",
"waypointTargets",
")",
"{",
"String",
"[",
"]",
"coordinatesFormatted",
"=",
"new",
"String",
"[",
"waypointTargets",
".",
"length",
"]",
";",
"int",
"index",
"=",
"0",
";",
"fo... | Converts array of Points with waypoint_targets values
to a string ready for API consumption.
@param waypointTargets a string representing approaches to each coordinate.
@return a formatted string.
@since 4.3.0 | [
"Converts",
"array",
"of",
"Points",
"with",
"waypoint_targets",
"values",
"to",
"a",
"string",
"ready",
"for",
"API",
"consumption",
"."
] | c0be138f462f91441388584c668f3760ba0e18e2 | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-directions/src/main/java/com/mapbox/api/directions/v5/MapboxDirections.java#L230-L243 |
51,720 | mapbox/mapbox-java | services-geojson/src/main/java/com/mapbox/geojson/MultiPolygon.java | MultiPolygon.polygons | public List<Polygon> polygons() {
List<List<List<Point>>> coordinates = coordinates();
List<Polygon> polygons = new ArrayList<>(coordinates.size());
for (List<List<Point>> points : coordinates) {
polygons.add(Polygon.fromLngLats(points));
}
return polygons;
} | java | public List<Polygon> polygons() {
List<List<List<Point>>> coordinates = coordinates();
List<Polygon> polygons = new ArrayList<>(coordinates.size());
for (List<List<Point>> points : coordinates) {
polygons.add(Polygon.fromLngLats(points));
}
return polygons;
} | [
"public",
"List",
"<",
"Polygon",
">",
"polygons",
"(",
")",
"{",
"List",
"<",
"List",
"<",
"List",
"<",
"Point",
">>>",
"coordinates",
"=",
"coordinates",
"(",
")",
";",
"List",
"<",
"Polygon",
">",
"polygons",
"=",
"new",
"ArrayList",
"<>",
"(",
"c... | Returns a list of polygons which make up this MultiPolygon instance.
@return a list of {@link Polygon}s which make up this MultiPolygon instance
@since 3.0.0 | [
"Returns",
"a",
"list",
"of",
"polygons",
"which",
"make",
"up",
"this",
"MultiPolygon",
"instance",
"."
] | c0be138f462f91441388584c668f3760ba0e18e2 | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-geojson/src/main/java/com/mapbox/geojson/MultiPolygon.java#L232-L239 |
51,721 | mapbox/mapbox-java | services-directions/src/main/java/com/mapbox/api/directions/v5/models/DirectionsJsonObject.java | DirectionsJsonObject.toJson | public String toJson() {
GsonBuilder gson = new GsonBuilder();
gson.registerTypeAdapterFactory(DirectionsAdapterFactory.create());
gson.registerTypeAdapter(Point.class, new PointAsCoordinatesTypeAdapter());
return gson.create().toJson(this);
} | java | public String toJson() {
GsonBuilder gson = new GsonBuilder();
gson.registerTypeAdapterFactory(DirectionsAdapterFactory.create());
gson.registerTypeAdapter(Point.class, new PointAsCoordinatesTypeAdapter());
return gson.create().toJson(this);
} | [
"public",
"String",
"toJson",
"(",
")",
"{",
"GsonBuilder",
"gson",
"=",
"new",
"GsonBuilder",
"(",
")",
";",
"gson",
".",
"registerTypeAdapterFactory",
"(",
"DirectionsAdapterFactory",
".",
"create",
"(",
")",
")",
";",
"gson",
".",
"registerTypeAdapter",
"("... | This takes the currently defined values found inside this instance and converts it to a json
string.
@return a JSON string which represents this DirectionsJsonObject
@since 3.4.0 | [
"This",
"takes",
"the",
"currently",
"defined",
"values",
"found",
"inside",
"this",
"instance",
"and",
"converts",
"it",
"to",
"a",
"json",
"string",
"."
] | c0be138f462f91441388584c668f3760ba0e18e2 | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-directions/src/main/java/com/mapbox/api/directions/v5/models/DirectionsJsonObject.java#L24-L29 |
51,722 | mapbox/mapbox-java | services-staticmap/src/main/java/com/mapbox/api/staticmap/v1/MapboxStaticMap.java | MapboxStaticMap.url | public HttpUrl url() {
HttpUrl.Builder urlBuilder = HttpUrl.parse(baseUrl()).newBuilder()
.addPathSegment("styles")
.addPathSegment("v1")
.addPathSegment(user())
.addPathSegment(styleId())
.addPathSegment("static")
.addQueryParameter("access_token", accessToken());
List<Stri... | java | public HttpUrl url() {
HttpUrl.Builder urlBuilder = HttpUrl.parse(baseUrl()).newBuilder()
.addPathSegment("styles")
.addPathSegment("v1")
.addPathSegment(user())
.addPathSegment(styleId())
.addPathSegment("static")
.addQueryParameter("access_token", accessToken());
List<Stri... | [
"public",
"HttpUrl",
"url",
"(",
")",
"{",
"HttpUrl",
".",
"Builder",
"urlBuilder",
"=",
"HttpUrl",
".",
"parse",
"(",
"baseUrl",
"(",
")",
")",
".",
"newBuilder",
"(",
")",
".",
"addPathSegment",
"(",
"\"styles\"",
")",
".",
"addPathSegment",
"(",
"\"v1... | Returns the formatted URL string meant to be passed to your Http client for retrieval of the
actual Mapbox Static Image.
@return a {@link HttpUrl} which can be used for making the request for the image
@since 3.0.0 | [
"Returns",
"the",
"formatted",
"URL",
"string",
"meant",
"to",
"be",
"passed",
"to",
"your",
"Http",
"client",
"for",
"retrieval",
"of",
"the",
"actual",
"Mapbox",
"Static",
"Image",
"."
] | c0be138f462f91441388584c668f3760ba0e18e2 | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-staticmap/src/main/java/com/mapbox/api/staticmap/v1/MapboxStaticMap.java#L95-L146 |
51,723 | mapbox/mapbox-java | samples/src/main/java/com/mapbox/samples/BasicDirections.java | BasicDirections.simpleMapboxDirectionsRequest | private static void simpleMapboxDirectionsRequest() throws IOException {
MapboxDirections.Builder builder = MapboxDirections.builder();
// 1. Pass in all the required information to get a simple directions route.
builder.accessToken(BuildConfig.MAPBOX_ACCESS_TOKEN);
builder.origin(Point.fromLngLat(-95... | java | private static void simpleMapboxDirectionsRequest() throws IOException {
MapboxDirections.Builder builder = MapboxDirections.builder();
// 1. Pass in all the required information to get a simple directions route.
builder.accessToken(BuildConfig.MAPBOX_ACCESS_TOKEN);
builder.origin(Point.fromLngLat(-95... | [
"private",
"static",
"void",
"simpleMapboxDirectionsRequest",
"(",
")",
"throws",
"IOException",
"{",
"MapboxDirections",
".",
"Builder",
"builder",
"=",
"MapboxDirections",
".",
"builder",
"(",
")",
";",
"// 1. Pass in all the required information to get a simple directions ... | Demonstrates how to make the most basic GET directions request.
@throws IOException signals that an I/O exception of some sort has occurred | [
"Demonstrates",
"how",
"to",
"make",
"the",
"most",
"basic",
"GET",
"directions",
"request",
"."
] | c0be138f462f91441388584c668f3760ba0e18e2 | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/samples/src/main/java/com/mapbox/samples/BasicDirections.java#L31-L47 |
51,724 | mapbox/mapbox-java | samples/src/main/java/com/mapbox/samples/BasicDirections.java | BasicDirections.asyncMapboxDirectionsRequest | private static void asyncMapboxDirectionsRequest() {
// 1. Pass in all the required information to get a route.
MapboxDirections request = MapboxDirections.builder()
.accessToken(BuildConfig.MAPBOX_ACCESS_TOKEN)
.origin(Point.fromLngLat(-95.6332, 29.7890))
.destination(Point.fromLngLat(-95.35... | java | private static void asyncMapboxDirectionsRequest() {
// 1. Pass in all the required information to get a route.
MapboxDirections request = MapboxDirections.builder()
.accessToken(BuildConfig.MAPBOX_ACCESS_TOKEN)
.origin(Point.fromLngLat(-95.6332, 29.7890))
.destination(Point.fromLngLat(-95.35... | [
"private",
"static",
"void",
"asyncMapboxDirectionsRequest",
"(",
")",
"{",
"// 1. Pass in all the required information to get a route.",
"MapboxDirections",
"request",
"=",
"MapboxDirections",
".",
"builder",
"(",
")",
".",
"accessToken",
"(",
"BuildConfig",
".",
"MAPBOX_A... | Demonstrates how to make an asynchronous directions request. | [
"Demonstrates",
"how",
"to",
"make",
"an",
"asynchronous",
"directions",
"request",
"."
] | c0be138f462f91441388584c668f3760ba0e18e2 | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/samples/src/main/java/com/mapbox/samples/BasicDirections.java#L73-L100 |
51,725 | mapbox/mapbox-java | services-geojson/src/main/java/com/mapbox/geojson/Feature.java | Feature.getStringProperty | public String getStringProperty(String key) {
JsonElement propertyKey = properties().get(key);
return propertyKey == null ? null : propertyKey.getAsString();
} | java | public String getStringProperty(String key) {
JsonElement propertyKey = properties().get(key);
return propertyKey == null ? null : propertyKey.getAsString();
} | [
"public",
"String",
"getStringProperty",
"(",
"String",
"key",
")",
"{",
"JsonElement",
"propertyKey",
"=",
"properties",
"(",
")",
".",
"get",
"(",
"key",
")",
";",
"return",
"propertyKey",
"==",
"null",
"?",
"null",
":",
"propertyKey",
".",
"getAsString",
... | Convenience method to get a String member.
@param key name of the member
@return the value of the member, null if it doesn't exist
@since 1.0.0 | [
"Convenience",
"method",
"to",
"get",
"a",
"String",
"member",
"."
] | c0be138f462f91441388584c668f3760ba0e18e2 | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-geojson/src/main/java/com/mapbox/geojson/Feature.java#L362-L365 |
51,726 | mapbox/mapbox-java | services-geojson/src/main/java/com/mapbox/geojson/Feature.java | Feature.getNumberProperty | public Number getNumberProperty(String key) {
JsonElement propertyKey = properties().get(key);
return propertyKey == null ? null : propertyKey.getAsNumber();
} | java | public Number getNumberProperty(String key) {
JsonElement propertyKey = properties().get(key);
return propertyKey == null ? null : propertyKey.getAsNumber();
} | [
"public",
"Number",
"getNumberProperty",
"(",
"String",
"key",
")",
"{",
"JsonElement",
"propertyKey",
"=",
"properties",
"(",
")",
".",
"get",
"(",
"key",
")",
";",
"return",
"propertyKey",
"==",
"null",
"?",
"null",
":",
"propertyKey",
".",
"getAsNumber",
... | Convenience method to get a Number member.
@param key name of the member
@return the value of the member, null if it doesn't exist
@since 1.0.0 | [
"Convenience",
"method",
"to",
"get",
"a",
"Number",
"member",
"."
] | c0be138f462f91441388584c668f3760ba0e18e2 | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-geojson/src/main/java/com/mapbox/geojson/Feature.java#L374-L377 |
51,727 | mapbox/mapbox-java | services-geojson/src/main/java/com/mapbox/geojson/Feature.java | Feature.getBooleanProperty | public Boolean getBooleanProperty(String key) {
JsonElement propertyKey = properties().get(key);
return propertyKey == null ? null : propertyKey.getAsBoolean();
} | java | public Boolean getBooleanProperty(String key) {
JsonElement propertyKey = properties().get(key);
return propertyKey == null ? null : propertyKey.getAsBoolean();
} | [
"public",
"Boolean",
"getBooleanProperty",
"(",
"String",
"key",
")",
"{",
"JsonElement",
"propertyKey",
"=",
"properties",
"(",
")",
".",
"get",
"(",
"key",
")",
";",
"return",
"propertyKey",
"==",
"null",
"?",
"null",
":",
"propertyKey",
".",
"getAsBoolean... | Convenience method to get a Boolean member.
@param key name of the member
@return the value of the member, null if it doesn't exist
@since 1.0.0 | [
"Convenience",
"method",
"to",
"get",
"a",
"Boolean",
"member",
"."
] | c0be138f462f91441388584c668f3760ba0e18e2 | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-geojson/src/main/java/com/mapbox/geojson/Feature.java#L386-L389 |
51,728 | mapbox/mapbox-java | services-geojson/src/main/java/com/mapbox/geojson/Feature.java | Feature.getCharacterProperty | public Character getCharacterProperty(String key) {
JsonElement propertyKey = properties().get(key);
return propertyKey == null ? null : propertyKey.getAsCharacter();
} | java | public Character getCharacterProperty(String key) {
JsonElement propertyKey = properties().get(key);
return propertyKey == null ? null : propertyKey.getAsCharacter();
} | [
"public",
"Character",
"getCharacterProperty",
"(",
"String",
"key",
")",
"{",
"JsonElement",
"propertyKey",
"=",
"properties",
"(",
")",
".",
"get",
"(",
"key",
")",
";",
"return",
"propertyKey",
"==",
"null",
"?",
"null",
":",
"propertyKey",
".",
"getAsCha... | Convenience method to get a Character member.
@param key name of the member
@return the value of the member, null if it doesn't exist
@since 1.0.0 | [
"Convenience",
"method",
"to",
"get",
"a",
"Character",
"member",
"."
] | c0be138f462f91441388584c668f3760ba0e18e2 | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-geojson/src/main/java/com/mapbox/geojson/Feature.java#L398-L401 |
51,729 | mapbox/mapbox-java | services-geojson/src/main/java/com/mapbox/geojson/gson/PointSerializer.java | PointSerializer.serialize | @Override
public JsonElement serialize(Point src, Type typeOfSrc, JsonSerializationContext context) {
JsonArray rawCoordinates = new JsonArray();
// Unshift coordinates
List<Double> unshiftedCoordinates =
CoordinateShifterManager.getCoordinateShifter().unshiftPoint(src);
rawCoordinates.a... | java | @Override
public JsonElement serialize(Point src, Type typeOfSrc, JsonSerializationContext context) {
JsonArray rawCoordinates = new JsonArray();
// Unshift coordinates
List<Double> unshiftedCoordinates =
CoordinateShifterManager.getCoordinateShifter().unshiftPoint(src);
rawCoordinates.a... | [
"@",
"Override",
"public",
"JsonElement",
"serialize",
"(",
"Point",
"src",
",",
"Type",
"typeOfSrc",
",",
"JsonSerializationContext",
"context",
")",
"{",
"JsonArray",
"rawCoordinates",
"=",
"new",
"JsonArray",
"(",
")",
";",
"// Unshift coordinates",
"List",
"<"... | Required to handle the special case where the altitude might be a Double.NaN, which isn't a
valid double value as per JSON specification.
@param src A {@link Point} defined by a longitude, latitude, and optionally, an
altitude.
@param typeOfSrc Common superinterface for all types in the Java.
@param context Co... | [
"Required",
"to",
"handle",
"the",
"special",
"case",
"where",
"the",
"altitude",
"might",
"be",
"a",
"Double",
".",
"NaN",
"which",
"isn",
"t",
"a",
"valid",
"double",
"value",
"as",
"per",
"JSON",
"specification",
"."
] | c0be138f462f91441388584c668f3760ba0e18e2 | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-geojson/src/main/java/com/mapbox/geojson/gson/PointSerializer.java#L47-L64 |
51,730 | mapbox/mapbox-java | services-core/src/main/java/com/mapbox/core/utils/MapboxUtils.java | MapboxUtils.isAccessTokenValid | public static boolean isAccessTokenValid(String accessToken) {
return !TextUtils.isEmpty(accessToken) && !(!accessToken.startsWith("pk.")
&& !accessToken.startsWith("sk.") && !accessToken.startsWith("tk."));
} | java | public static boolean isAccessTokenValid(String accessToken) {
return !TextUtils.isEmpty(accessToken) && !(!accessToken.startsWith("pk.")
&& !accessToken.startsWith("sk.") && !accessToken.startsWith("tk."));
} | [
"public",
"static",
"boolean",
"isAccessTokenValid",
"(",
"String",
"accessToken",
")",
"{",
"return",
"!",
"TextUtils",
".",
"isEmpty",
"(",
"accessToken",
")",
"&&",
"!",
"(",
"!",
"accessToken",
".",
"startsWith",
"(",
"\"pk.\"",
")",
"&&",
"!",
"accessTo... | Checks that the provided access token is not empty or null, and that it starts with
the right prefixes. Note that this method does not check Mapbox servers to verify that
it actually belongs to an account.
@param accessToken A Mapbox access token.
@return true if the provided access token is valid, false otherwise.
@s... | [
"Checks",
"that",
"the",
"provided",
"access",
"token",
"is",
"not",
"empty",
"or",
"null",
"and",
"that",
"it",
"starts",
"with",
"the",
"right",
"prefixes",
".",
"Note",
"that",
"this",
"method",
"does",
"not",
"check",
"Mapbox",
"servers",
"to",
"verify... | c0be138f462f91441388584c668f3760ba0e18e2 | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-core/src/main/java/com/mapbox/core/utils/MapboxUtils.java#L23-L26 |
51,731 | mapbox/mapbox-java | services-turf/src/main/java/com/mapbox/turf/TurfAssertions.java | TurfAssertions.geojsonType | public static void geojsonType(GeoJson value, String type, String name) {
if (type == null || type.length() == 0 || name == null || name.length() == 0) {
throw new TurfException("Type and name required");
}
if (value == null || !value.type().equals(type)) {
throw new TurfException("Invalid input... | java | public static void geojsonType(GeoJson value, String type, String name) {
if (type == null || type.length() == 0 || name == null || name.length() == 0) {
throw new TurfException("Type and name required");
}
if (value == null || !value.type().equals(type)) {
throw new TurfException("Invalid input... | [
"public",
"static",
"void",
"geojsonType",
"(",
"GeoJson",
"value",
",",
"String",
"type",
",",
"String",
"name",
")",
"{",
"if",
"(",
"type",
"==",
"null",
"||",
"type",
".",
"length",
"(",
")",
"==",
"0",
"||",
"name",
"==",
"null",
"||",
"name",
... | Enforce expectations about types of GeoJson objects for Turf.
@param value any GeoJson object
@param type expected GeoJson type
@param name name of calling function
@see <a href="http://turfjs.org/docs/#geojsontype">Turf geojsonType documentation</a>
@since 1.2.0 | [
"Enforce",
"expectations",
"about",
"types",
"of",
"GeoJson",
"objects",
"for",
"Turf",
"."
] | c0be138f462f91441388584c668f3760ba0e18e2 | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-turf/src/main/java/com/mapbox/turf/TurfAssertions.java#L44-L52 |
51,732 | mapbox/mapbox-java | services-geojson/src/main/java/com/mapbox/geojson/BoundingBox.java | BoundingBox.fromCoordinates | @Deprecated
public static BoundingBox fromCoordinates(
@FloatRange(from = MIN_LONGITUDE, to = GeoJsonConstants.MAX_LONGITUDE) double west,
@FloatRange(from = MIN_LATITUDE, to = GeoJsonConstants.MAX_LATITUDE) double south,
@FloatRange(from = MIN_LONGITUDE, to = GeoJsonConstants.MAX_LONGITUDE) double east,
... | java | @Deprecated
public static BoundingBox fromCoordinates(
@FloatRange(from = MIN_LONGITUDE, to = GeoJsonConstants.MAX_LONGITUDE) double west,
@FloatRange(from = MIN_LATITUDE, to = GeoJsonConstants.MAX_LATITUDE) double south,
@FloatRange(from = MIN_LONGITUDE, to = GeoJsonConstants.MAX_LONGITUDE) double east,
... | [
"@",
"Deprecated",
"public",
"static",
"BoundingBox",
"fromCoordinates",
"(",
"@",
"FloatRange",
"(",
"from",
"=",
"MIN_LONGITUDE",
",",
"to",
"=",
"GeoJsonConstants",
".",
"MAX_LONGITUDE",
")",
"double",
"west",
",",
"@",
"FloatRange",
"(",
"from",
"=",
"MIN_... | Define a new instance of this class by passing in four coordinates in the same order they would
appear in the serialized GeoJson form. Limits are placed on the minimum and maximum coordinate
values which can exist and comply with the GeoJson spec.
@param west the left side of the bounding box when the map is facing d... | [
"Define",
"a",
"new",
"instance",
"of",
"this",
"class",
"by",
"passing",
"in",
"four",
"coordinates",
"in",
"the",
"same",
"order",
"they",
"would",
"appear",
"in",
"the",
"serialized",
"GeoJson",
"form",
".",
"Limits",
"are",
"placed",
"on",
"the",
"mini... | c0be138f462f91441388584c668f3760ba0e18e2 | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-geojson/src/main/java/com/mapbox/geojson/BoundingBox.java#L83-L90 |
51,733 | mapbox/mapbox-java | services-geojson/src/main/java/com/mapbox/geojson/utils/PolylineUtils.java | PolylineUtils.encode | @NonNull
public static String encode(@NonNull final List<Point> path, int precision) {
long lastLat = 0;
long lastLng = 0;
final StringBuilder result = new StringBuilder();
// OSRM uses precision=6, the default Polyline spec divides by 1E5, capping at precision=5
double factor = Math.pow(10, pre... | java | @NonNull
public static String encode(@NonNull final List<Point> path, int precision) {
long lastLat = 0;
long lastLng = 0;
final StringBuilder result = new StringBuilder();
// OSRM uses precision=6, the default Polyline spec divides by 1E5, capping at precision=5
double factor = Math.pow(10, pre... | [
"@",
"NonNull",
"public",
"static",
"String",
"encode",
"(",
"@",
"NonNull",
"final",
"List",
"<",
"Point",
">",
"path",
",",
"int",
"precision",
")",
"{",
"long",
"lastLat",
"=",
"0",
";",
"long",
"lastLng",
"=",
"0",
";",
"final",
"StringBuilder",
"r... | Encodes a sequence of Points into an encoded path string.
@param path list of {@link Point}s making up the line
@param precision OSRMv4 uses 6, OSRMv5 and Google uses 5
@return a String representing a path string
@since 1.0.0 | [
"Encodes",
"a",
"sequence",
"of",
"Points",
"into",
"an",
"encoded",
"path",
"string",
"."
] | c0be138f462f91441388584c668f3760ba0e18e2 | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-geojson/src/main/java/com/mapbox/geojson/utils/PolylineUtils.java#L88-L112 |
51,734 | mapbox/mapbox-java | services-geojson/src/main/java/com/mapbox/geojson/utils/PolylineUtils.java | PolylineUtils.getSqDist | private static double getSqDist(Point p1, Point p2) {
double dx = p1.longitude() - p2.longitude();
double dy = p1.latitude() - p2.latitude();
return dx * dx + dy * dy;
} | java | private static double getSqDist(Point p1, Point p2) {
double dx = p1.longitude() - p2.longitude();
double dy = p1.latitude() - p2.latitude();
return dx * dx + dy * dy;
} | [
"private",
"static",
"double",
"getSqDist",
"(",
"Point",
"p1",
",",
"Point",
"p2",
")",
"{",
"double",
"dx",
"=",
"p1",
".",
"longitude",
"(",
")",
"-",
"p2",
".",
"longitude",
"(",
")",
";",
"double",
"dy",
"=",
"p1",
".",
"latitude",
"(",
")",
... | Square distance between 2 points.
@param p1 first {@link Point}
@param p2 second Point
@return square of the distance between two input points | [
"Square",
"distance",
"between",
"2",
"points",
"."
] | c0be138f462f91441388584c668f3760ba0e18e2 | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-geojson/src/main/java/com/mapbox/geojson/utils/PolylineUtils.java#L209-L213 |
51,735 | mapbox/mapbox-java | services-geojson/src/main/java/com/mapbox/geojson/utils/PolylineUtils.java | PolylineUtils.getSqSegDist | private static double getSqSegDist(Point point, Point p1, Point p2) {
double horizontal = p1.longitude();
double vertical = p1.latitude();
double diffHorizontal = p2.longitude() - horizontal;
double diffVertical = p2.latitude() - vertical;
if (diffHorizontal != 0 || diffVertical != 0) {
doubl... | java | private static double getSqSegDist(Point point, Point p1, Point p2) {
double horizontal = p1.longitude();
double vertical = p1.latitude();
double diffHorizontal = p2.longitude() - horizontal;
double diffVertical = p2.latitude() - vertical;
if (diffHorizontal != 0 || diffVertical != 0) {
doubl... | [
"private",
"static",
"double",
"getSqSegDist",
"(",
"Point",
"point",
",",
"Point",
"p1",
",",
"Point",
"p2",
")",
"{",
"double",
"horizontal",
"=",
"p1",
".",
"longitude",
"(",
")",
";",
"double",
"vertical",
"=",
"p1",
".",
"latitude",
"(",
")",
";",... | Square distance from a point to a segment.
@param point {@link Point} whose distance from segment needs to be determined
@param p1,p2 points defining the segment
@return square of the distance between first input point and segment defined by
other two input points | [
"Square",
"distance",
"from",
"a",
"point",
"to",
"a",
"segment",
"."
] | c0be138f462f91441388584c668f3760ba0e18e2 | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-geojson/src/main/java/com/mapbox/geojson/utils/PolylineUtils.java#L223-L247 |
51,736 | mapbox/mapbox-java | services-geojson/src/main/java/com/mapbox/geojson/utils/PolylineUtils.java | PolylineUtils.simplifyRadialDist | private static List<Point> simplifyRadialDist(List<Point> points, double sqTolerance) {
Point prevPoint = points.get(0);
ArrayList<Point> newPoints = new ArrayList<>();
newPoints.add(prevPoint);
Point point = null;
for (int i = 1, len = points.size(); i < len; i++) {
point = points.get(i);
... | java | private static List<Point> simplifyRadialDist(List<Point> points, double sqTolerance) {
Point prevPoint = points.get(0);
ArrayList<Point> newPoints = new ArrayList<>();
newPoints.add(prevPoint);
Point point = null;
for (int i = 1, len = points.size(); i < len; i++) {
point = points.get(i);
... | [
"private",
"static",
"List",
"<",
"Point",
">",
"simplifyRadialDist",
"(",
"List",
"<",
"Point",
">",
"points",
",",
"double",
"sqTolerance",
")",
"{",
"Point",
"prevPoint",
"=",
"points",
".",
"get",
"(",
"0",
")",
";",
"ArrayList",
"<",
"Point",
">",
... | Basic distance-based simplification.
@param points a list of points to be simplified
@param sqTolerance square of amount of simplification
@return a list of simplified points | [
"Basic",
"distance",
"-",
"based",
"simplification",
"."
] | c0be138f462f91441388584c668f3760ba0e18e2 | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-geojson/src/main/java/com/mapbox/geojson/utils/PolylineUtils.java#L256-L275 |
51,737 | mapbox/mapbox-java | services-geojson/src/main/java/com/mapbox/geojson/utils/PolylineUtils.java | PolylineUtils.simplifyDouglasPeucker | private static List<Point> simplifyDouglasPeucker(List<Point> points, double sqTolerance) {
int last = points.size() - 1;
ArrayList<Point> simplified = new ArrayList<>();
simplified.add(points.get(0));
simplified.addAll(simplifyDpStep(points, 0, last, sqTolerance, simplified));
simplified.add(points... | java | private static List<Point> simplifyDouglasPeucker(List<Point> points, double sqTolerance) {
int last = points.size() - 1;
ArrayList<Point> simplified = new ArrayList<>();
simplified.add(points.get(0));
simplified.addAll(simplifyDpStep(points, 0, last, sqTolerance, simplified));
simplified.add(points... | [
"private",
"static",
"List",
"<",
"Point",
">",
"simplifyDouglasPeucker",
"(",
"List",
"<",
"Point",
">",
"points",
",",
"double",
"sqTolerance",
")",
"{",
"int",
"last",
"=",
"points",
".",
"size",
"(",
")",
"-",
"1",
";",
"ArrayList",
"<",
"Point",
"... | Simplification using Ramer-Douglas-Peucker algorithm.
@param points a list of points to be simplified
@param sqTolerance square of amount of simplification
@return a list of simplified points | [
"Simplification",
"using",
"Ramer",
"-",
"Douglas",
"-",
"Peucker",
"algorithm",
"."
] | c0be138f462f91441388584c668f3760ba0e18e2 | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-geojson/src/main/java/com/mapbox/geojson/utils/PolylineUtils.java#L314-L321 |
51,738 | mapbox/mapbox-java | services-geojson/src/main/java/com/mapbox/geojson/utils/GeoJsonUtils.java | GeoJsonUtils.trim | public static double trim(double value) {
if (value > MAX_DOUBLE_TO_ROUND || value < -MAX_DOUBLE_TO_ROUND) {
return value;
}
return Math.round(value * ROUND_PRECISION) / ROUND_PRECISION;
} | java | public static double trim(double value) {
if (value > MAX_DOUBLE_TO_ROUND || value < -MAX_DOUBLE_TO_ROUND) {
return value;
}
return Math.round(value * ROUND_PRECISION) / ROUND_PRECISION;
} | [
"public",
"static",
"double",
"trim",
"(",
"double",
"value",
")",
"{",
"if",
"(",
"value",
">",
"MAX_DOUBLE_TO_ROUND",
"||",
"value",
"<",
"-",
"MAX_DOUBLE_TO_ROUND",
")",
"{",
"return",
"value",
";",
"}",
"return",
"Math",
".",
"round",
"(",
"value",
"... | Trims a double value to have only 7 digits after period.
@param value to be trimed
@return trimmed value | [
"Trims",
"a",
"double",
"value",
"to",
"have",
"only",
"7",
"digits",
"after",
"period",
"."
] | c0be138f462f91441388584c668f3760ba0e18e2 | https://github.com/mapbox/mapbox-java/blob/c0be138f462f91441388584c668f3760ba0e18e2/services-geojson/src/main/java/com/mapbox/geojson/utils/GeoJsonUtils.java#L19-L24 |
51,739 | jaredrummler/ColorPicker | library/src/main/java/com/jaredrummler/android/colorpicker/ColorPanelView.java | ColorPanelView.showHint | public void showHint() {
final int[] screenPos = new int[2];
final Rect displayFrame = new Rect();
getLocationOnScreen(screenPos);
getWindowVisibleDisplayFrame(displayFrame);
final Context context = getContext();
final int width = getWidth();
final int height = getHeight();
final int mid... | java | public void showHint() {
final int[] screenPos = new int[2];
final Rect displayFrame = new Rect();
getLocationOnScreen(screenPos);
getWindowVisibleDisplayFrame(displayFrame);
final Context context = getContext();
final int width = getWidth();
final int height = getHeight();
final int mid... | [
"public",
"void",
"showHint",
"(",
")",
"{",
"final",
"int",
"[",
"]",
"screenPos",
"=",
"new",
"int",
"[",
"2",
"]",
";",
"final",
"Rect",
"displayFrame",
"=",
"new",
"Rect",
"(",
")",
";",
"getLocationOnScreen",
"(",
"screenPos",
")",
";",
"getWindow... | Show a toast message with the hex color code below the view. | [
"Show",
"a",
"toast",
"message",
"with",
"the",
"hex",
"color",
"code",
"below",
"the",
"view",
"."
] | ab06208ddcfbd7ab1b1fde140f10b3ca06d8175a | https://github.com/jaredrummler/ColorPicker/blob/ab06208ddcfbd7ab1b1fde140f10b3ca06d8175a/library/src/main/java/com/jaredrummler/android/colorpicker/ColorPanelView.java#L278-L307 |
51,740 | jaredrummler/ColorPicker | library/src/main/java/com/jaredrummler/android/colorpicker/ColorPickerDialog.java | ColorPickerDialog.createPickerView | View createPickerView() {
View contentView = View.inflate(getActivity(), R.layout.cpv_dialog_color_picker, null);
colorPicker = (ColorPickerView) contentView.findViewById(R.id.cpv_color_picker_view);
ColorPanelView oldColorPanel = (ColorPanelView) contentView.findViewById(R.id.cpv_color_panel_old);
newC... | java | View createPickerView() {
View contentView = View.inflate(getActivity(), R.layout.cpv_dialog_color_picker, null);
colorPicker = (ColorPickerView) contentView.findViewById(R.id.cpv_color_picker_view);
ColorPanelView oldColorPanel = (ColorPanelView) contentView.findViewById(R.id.cpv_color_panel_old);
newC... | [
"View",
"createPickerView",
"(",
")",
"{",
"View",
"contentView",
"=",
"View",
".",
"inflate",
"(",
"getActivity",
"(",
")",
",",
"R",
".",
"layout",
".",
"cpv_dialog_color_picker",
",",
"null",
")",
";",
"colorPicker",
"=",
"(",
"ColorPickerView",
")",
"c... | region Custom Picker | [
"region",
"Custom",
"Picker"
] | ab06208ddcfbd7ab1b1fde140f10b3ca06d8175a | https://github.com/jaredrummler/ColorPicker/blob/ab06208ddcfbd7ab1b1fde140f10b3ca06d8175a/library/src/main/java/com/jaredrummler/android/colorpicker/ColorPickerDialog.java#L275-L326 |
51,741 | jaredrummler/ColorPicker | library/src/main/java/com/jaredrummler/android/colorpicker/ColorPickerDialog.java | ColorPickerDialog.createPresetsView | View createPresetsView() {
View contentView = View.inflate(getActivity(), R.layout.cpv_dialog_presets, null);
shadesLayout = (LinearLayout) contentView.findViewById(R.id.shades_layout);
transparencySeekBar = (SeekBar) contentView.findViewById(R.id.transparency_seekbar);
transparencyPercText = (TextView)... | java | View createPresetsView() {
View contentView = View.inflate(getActivity(), R.layout.cpv_dialog_presets, null);
shadesLayout = (LinearLayout) contentView.findViewById(R.id.shades_layout);
transparencySeekBar = (SeekBar) contentView.findViewById(R.id.transparency_seekbar);
transparencyPercText = (TextView)... | [
"View",
"createPresetsView",
"(",
")",
"{",
"View",
"contentView",
"=",
"View",
".",
"inflate",
"(",
"getActivity",
"(",
")",
",",
"R",
".",
"layout",
".",
"cpv_dialog_presets",
",",
"null",
")",
";",
"shadesLayout",
"=",
"(",
"LinearLayout",
")",
"content... | region Presets Picker | [
"region",
"Presets",
"Picker"
] | ab06208ddcfbd7ab1b1fde140f10b3ca06d8175a | https://github.com/jaredrummler/ColorPicker/blob/ab06208ddcfbd7ab1b1fde140f10b3ca06d8175a/library/src/main/java/com/jaredrummler/android/colorpicker/ColorPickerDialog.java#L428-L469 |
51,742 | jaredrummler/ColorPicker | library/src/main/java/com/jaredrummler/android/colorpicker/ColorPickerView.java | ColorPickerView.setColor | public void setColor(int color, boolean callback) {
int alpha = Color.alpha(color);
int red = Color.red(color);
int blue = Color.blue(color);
int green = Color.green(color);
float[] hsv = new float[3];
Color.RGBToHSV(red, green, blue, hsv);
this.alpha = alpha;
hue = hsv[0];
sat =... | java | public void setColor(int color, boolean callback) {
int alpha = Color.alpha(color);
int red = Color.red(color);
int blue = Color.blue(color);
int green = Color.green(color);
float[] hsv = new float[3];
Color.RGBToHSV(red, green, blue, hsv);
this.alpha = alpha;
hue = hsv[0];
sat =... | [
"public",
"void",
"setColor",
"(",
"int",
"color",
",",
"boolean",
"callback",
")",
"{",
"int",
"alpha",
"=",
"Color",
".",
"alpha",
"(",
"color",
")",
";",
"int",
"red",
"=",
"Color",
".",
"red",
"(",
"color",
")",
";",
"int",
"blue",
"=",
"Color"... | Set the color this view should show.
@param color The color that should be selected. #argb
@param callback If you want to get a callback to your OnColorChangedListener. | [
"Set",
"the",
"color",
"this",
"view",
"should",
"show",
"."
] | ab06208ddcfbd7ab1b1fde140f10b3ca06d8175a | https://github.com/jaredrummler/ColorPicker/blob/ab06208ddcfbd7ab1b1fde140f10b3ca06d8175a/library/src/main/java/com/jaredrummler/android/colorpicker/ColorPickerView.java#L835-L856 |
51,743 | jaredrummler/ColorPicker | library/src/main/java/com/jaredrummler/android/colorpicker/ColorPickerView.java | ColorPickerView.setAlphaSliderVisible | public void setAlphaSliderVisible(boolean visible) {
if (showAlphaPanel != visible) {
showAlphaPanel = visible;
/*
* Force recreation.
*/
valShader = null;
satShader = null;
alphaShader = null;
hueBackgroundCache = null;
satValBackgroundCache = null;
r... | java | public void setAlphaSliderVisible(boolean visible) {
if (showAlphaPanel != visible) {
showAlphaPanel = visible;
/*
* Force recreation.
*/
valShader = null;
satShader = null;
alphaShader = null;
hueBackgroundCache = null;
satValBackgroundCache = null;
r... | [
"public",
"void",
"setAlphaSliderVisible",
"(",
"boolean",
"visible",
")",
"{",
"if",
"(",
"showAlphaPanel",
"!=",
"visible",
")",
"{",
"showAlphaPanel",
"=",
"visible",
";",
"/*\n * Force recreation.\n */",
"valShader",
"=",
"null",
";",
"satShader",
"=... | Set if the user is allowed to adjust the alpha panel. Default is false.
If it is set to false no alpha will be set.
@param visible {@code true} to show the alpha slider | [
"Set",
"if",
"the",
"user",
"is",
"allowed",
"to",
"adjust",
"the",
"alpha",
"panel",
".",
"Default",
"is",
"false",
".",
"If",
"it",
"is",
"set",
"to",
"false",
"no",
"alpha",
"will",
"be",
"set",
"."
] | ab06208ddcfbd7ab1b1fde140f10b3ca06d8175a | https://github.com/jaredrummler/ColorPicker/blob/ab06208ddcfbd7ab1b1fde140f10b3ca06d8175a/library/src/main/java/com/jaredrummler/android/colorpicker/ColorPickerView.java#L864-L879 |
51,744 | HaraldWalker/user-agent-utils | src/main/java/eu/bitwalker/useragentutils/UserAgent.java | UserAgent.valueOf | public static UserAgent valueOf(int id)
{
OperatingSystem operatingSystem = OperatingSystem.valueOf((short) (id >> 16));
Browser browser = Browser.valueOf( (short) (id & 0x0FFFF));
return new UserAgent(operatingSystem,browser);
} | java | public static UserAgent valueOf(int id)
{
OperatingSystem operatingSystem = OperatingSystem.valueOf((short) (id >> 16));
Browser browser = Browser.valueOf( (short) (id & 0x0FFFF));
return new UserAgent(operatingSystem,browser);
} | [
"public",
"static",
"UserAgent",
"valueOf",
"(",
"int",
"id",
")",
"{",
"OperatingSystem",
"operatingSystem",
"=",
"OperatingSystem",
".",
"valueOf",
"(",
"(",
"short",
")",
"(",
"id",
">>",
"16",
")",
")",
";",
"Browser",
"browser",
"=",
"Browser",
".",
... | Returns UserAgent based on specified unique id
@param id Id value of the user agent.
@return UserAgent | [
"Returns",
"UserAgent",
"based",
"on",
"specified",
"unique",
"id"
] | 7f954514298f76afff8a75723bc25205bfe30d1b | https://github.com/HaraldWalker/user-agent-utils/blob/7f954514298f76afff8a75723bc25205bfe30d1b/src/main/java/eu/bitwalker/useragentutils/UserAgent.java#L167-L172 |
51,745 | HaraldWalker/user-agent-utils | src/main/java/eu/bitwalker/useragentutils/UserAgent.java | UserAgent.valueOf | public static UserAgent valueOf(String name)
{
if (name == null)
throw new NullPointerException("Name is null");
String[] elements = name.split("-");
if (elements.length == 2)
{
OperatingSystem operatingSystem = OperatingSystem.valueOf(elements[0]);
Browser browser = Browser.valueOf(ele... | java | public static UserAgent valueOf(String name)
{
if (name == null)
throw new NullPointerException("Name is null");
String[] elements = name.split("-");
if (elements.length == 2)
{
OperatingSystem operatingSystem = OperatingSystem.valueOf(elements[0]);
Browser browser = Browser.valueOf(ele... | [
"public",
"static",
"UserAgent",
"valueOf",
"(",
"String",
"name",
")",
"{",
"if",
"(",
"name",
"==",
"null",
")",
"throw",
"new",
"NullPointerException",
"(",
"\"Name is null\"",
")",
";",
"String",
"[",
"]",
"elements",
"=",
"name",
".",
"split",
"(",
... | Returns UserAgent based on combined string representation
@param name Name of the user agent.
@return UserAgent | [
"Returns",
"UserAgent",
"based",
"on",
"combined",
"string",
"representation"
] | 7f954514298f76afff8a75723bc25205bfe30d1b | https://github.com/HaraldWalker/user-agent-utils/blob/7f954514298f76afff8a75723bc25205bfe30d1b/src/main/java/eu/bitwalker/useragentutils/UserAgent.java#L179-L195 |
51,746 | msgpack/msgpack-java | msgpack-core/src/main/java/org/msgpack/core/buffer/ByteBufferInput.java | ByteBufferInput.reset | public ByteBuffer reset(ByteBuffer input)
{
ByteBuffer old = this.input;
this.input = checkNotNull(input, "input ByteBuffer is null").slice();
isRead = false;
return old;
} | java | public ByteBuffer reset(ByteBuffer input)
{
ByteBuffer old = this.input;
this.input = checkNotNull(input, "input ByteBuffer is null").slice();
isRead = false;
return old;
} | [
"public",
"ByteBuffer",
"reset",
"(",
"ByteBuffer",
"input",
")",
"{",
"ByteBuffer",
"old",
"=",
"this",
".",
"input",
";",
"this",
".",
"input",
"=",
"checkNotNull",
"(",
"input",
",",
"\"input ByteBuffer is null\"",
")",
".",
"slice",
"(",
")",
";",
"isR... | Reset buffer.
@param input new buffer
@return the old buffer | [
"Reset",
"buffer",
"."
] | 16e370e348215a72a14c210b42d448d513aee015 | https://github.com/msgpack/msgpack-java/blob/16e370e348215a72a14c210b42d448d513aee015/msgpack-core/src/main/java/org/msgpack/core/buffer/ByteBufferInput.java#L42-L48 |
51,747 | msgpack/msgpack-java | msgpack-core/src/main/java/org/msgpack/core/MessagePacker.java | MessagePacker.packString | public MessagePacker packString(String s)
throws IOException
{
if (s.length() <= 0) {
packRawStringHeader(0);
return this;
}
else if (CORRUPTED_CHARSET_ENCODER || s.length() < smallStringOptimizationThreshold) {
// Using String.getBytes is gene... | java | public MessagePacker packString(String s)
throws IOException
{
if (s.length() <= 0) {
packRawStringHeader(0);
return this;
}
else if (CORRUPTED_CHARSET_ENCODER || s.length() < smallStringOptimizationThreshold) {
// Using String.getBytes is gene... | [
"public",
"MessagePacker",
"packString",
"(",
"String",
"s",
")",
"throws",
"IOException",
"{",
"if",
"(",
"s",
".",
"length",
"(",
")",
"<=",
"0",
")",
"{",
"packRawStringHeader",
"(",
"0",
")",
";",
"return",
"this",
";",
"}",
"else",
"if",
"(",
"C... | Writes a String vlaue in UTF-8 encoding.
<p>
This method writes a UTF-8 string using the smallest format from the str format family by default. If {@link MessagePack.PackerConfig#withStr8FormatSupport(boolean)} is set to false, smallest format from the str format family excepting str8 format.
@param s the string to b... | [
"Writes",
"a",
"String",
"vlaue",
"in",
"UTF",
"-",
"8",
"encoding",
"."
] | 16e370e348215a72a14c210b42d448d513aee015 | https://github.com/msgpack/msgpack-java/blob/16e370e348215a72a14c210b42d448d513aee015/msgpack-core/src/main/java/org/msgpack/core/MessagePacker.java#L722-L799 |
51,748 | msgpack/msgpack-java | msgpack-core/src/main/java/org/msgpack/core/buffer/MessageBuffer.java | MessageBuffer.newMessageBuffer | private static MessageBuffer newMessageBuffer(byte[] arr, int off, int len)
{
checkNotNull(arr);
if (mbArrConstructor != null) {
return newInstance(mbArrConstructor, arr, off, len);
}
return new MessageBuffer(arr, off, len);
} | java | private static MessageBuffer newMessageBuffer(byte[] arr, int off, int len)
{
checkNotNull(arr);
if (mbArrConstructor != null) {
return newInstance(mbArrConstructor, arr, off, len);
}
return new MessageBuffer(arr, off, len);
} | [
"private",
"static",
"MessageBuffer",
"newMessageBuffer",
"(",
"byte",
"[",
"]",
"arr",
",",
"int",
"off",
",",
"int",
"len",
")",
"{",
"checkNotNull",
"(",
"arr",
")",
";",
"if",
"(",
"mbArrConstructor",
"!=",
"null",
")",
"{",
"return",
"newInstance",
... | Creates a new MessageBuffer instance backed by a java heap array
@param arr
@return | [
"Creates",
"a",
"new",
"MessageBuffer",
"instance",
"backed",
"by",
"a",
"java",
"heap",
"array"
] | 16e370e348215a72a14c210b42d448d513aee015 | https://github.com/msgpack/msgpack-java/blob/16e370e348215a72a14c210b42d448d513aee015/msgpack-core/src/main/java/org/msgpack/core/buffer/MessageBuffer.java#L273-L280 |
51,749 | msgpack/msgpack-java | msgpack-core/src/main/java/org/msgpack/core/buffer/MessageBuffer.java | MessageBuffer.newMessageBuffer | private static MessageBuffer newMessageBuffer(ByteBuffer bb)
{
checkNotNull(bb);
if (mbBBConstructor != null) {
return newInstance(mbBBConstructor, bb);
}
return new MessageBuffer(bb);
} | java | private static MessageBuffer newMessageBuffer(ByteBuffer bb)
{
checkNotNull(bb);
if (mbBBConstructor != null) {
return newInstance(mbBBConstructor, bb);
}
return new MessageBuffer(bb);
} | [
"private",
"static",
"MessageBuffer",
"newMessageBuffer",
"(",
"ByteBuffer",
"bb",
")",
"{",
"checkNotNull",
"(",
"bb",
")",
";",
"if",
"(",
"mbBBConstructor",
"!=",
"null",
")",
"{",
"return",
"newInstance",
"(",
"mbBBConstructor",
",",
"bb",
")",
";",
"}",... | Creates a new MessageBuffer instance backed by ByteBuffer
@param bb
@return | [
"Creates",
"a",
"new",
"MessageBuffer",
"instance",
"backed",
"by",
"ByteBuffer"
] | 16e370e348215a72a14c210b42d448d513aee015 | https://github.com/msgpack/msgpack-java/blob/16e370e348215a72a14c210b42d448d513aee015/msgpack-core/src/main/java/org/msgpack/core/buffer/MessageBuffer.java#L288-L295 |
51,750 | msgpack/msgpack-java | msgpack-core/src/main/java/org/msgpack/core/buffer/MessageBuffer.java | MessageBuffer.newInstance | private static MessageBuffer newInstance(Constructor<?> constructor, Object... args)
{
try {
// We need to use reflection to create MessageBuffer instances in order to prevent TypeProfile generation for getInt method. TypeProfile will be
// generated to resolve one of the method refe... | java | private static MessageBuffer newInstance(Constructor<?> constructor, Object... args)
{
try {
// We need to use reflection to create MessageBuffer instances in order to prevent TypeProfile generation for getInt method. TypeProfile will be
// generated to resolve one of the method refe... | [
"private",
"static",
"MessageBuffer",
"newInstance",
"(",
"Constructor",
"<",
"?",
">",
"constructor",
",",
"Object",
"...",
"args",
")",
"{",
"try",
"{",
"// We need to use reflection to create MessageBuffer instances in order to prevent TypeProfile generation for getInt method.... | Creates a new MessageBuffer instance
@param constructor A MessageBuffer constructor
@return new MessageBuffer instance | [
"Creates",
"a",
"new",
"MessageBuffer",
"instance"
] | 16e370e348215a72a14c210b42d448d513aee015 | https://github.com/msgpack/msgpack-java/blob/16e370e348215a72a14c210b42d448d513aee015/msgpack-core/src/main/java/org/msgpack/core/buffer/MessageBuffer.java#L303-L329 |
51,751 | msgpack/msgpack-java | msgpack-core/src/main/java/org/msgpack/core/buffer/MessageBuffer.java | MessageBuffer.getInt | public int getInt(int index)
{
// Reading little-endian value
int i = unsafe.getInt(base, address + index);
// Reversing the endian
return Integer.reverseBytes(i);
} | java | public int getInt(int index)
{
// Reading little-endian value
int i = unsafe.getInt(base, address + index);
// Reversing the endian
return Integer.reverseBytes(i);
} | [
"public",
"int",
"getInt",
"(",
"int",
"index",
")",
"{",
"// Reading little-endian value",
"int",
"i",
"=",
"unsafe",
".",
"getInt",
"(",
"base",
",",
"address",
"+",
"index",
")",
";",
"// Reversing the endian",
"return",
"Integer",
".",
"reverseBytes",
"(",... | Read a big-endian int value at the specified index
@param index
@return | [
"Read",
"a",
"big",
"-",
"endian",
"int",
"value",
"at",
"the",
"specified",
"index"
] | 16e370e348215a72a14c210b42d448d513aee015 | https://github.com/msgpack/msgpack-java/blob/16e370e348215a72a14c210b42d448d513aee015/msgpack-core/src/main/java/org/msgpack/core/buffer/MessageBuffer.java#L443-L449 |
51,752 | msgpack/msgpack-java | msgpack-core/src/main/java/org/msgpack/core/buffer/MessageBuffer.java | MessageBuffer.putInt | public void putInt(int index, int v)
{
// Reversing the endian
v = Integer.reverseBytes(v);
unsafe.putInt(base, address + index, v);
} | java | public void putInt(int index, int v)
{
// Reversing the endian
v = Integer.reverseBytes(v);
unsafe.putInt(base, address + index, v);
} | [
"public",
"void",
"putInt",
"(",
"int",
"index",
",",
"int",
"v",
")",
"{",
"// Reversing the endian",
"v",
"=",
"Integer",
".",
"reverseBytes",
"(",
"v",
")",
";",
"unsafe",
".",
"putInt",
"(",
"base",
",",
"address",
"+",
"index",
",",
"v",
")",
";... | Write a big-endian integer value to the memory
@param index
@param v | [
"Write",
"a",
"big",
"-",
"endian",
"integer",
"value",
"to",
"the",
"memory"
] | 16e370e348215a72a14c210b42d448d513aee015 | https://github.com/msgpack/msgpack-java/blob/16e370e348215a72a14c210b42d448d513aee015/msgpack-core/src/main/java/org/msgpack/core/buffer/MessageBuffer.java#L503-L508 |
51,753 | 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 |
51,754 | 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 |
51,755 | 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 |
51,756 | 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 |
51,757 | 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 |
51,758 | 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 |
51,759 | 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 |
51,760 | 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 |
51,761 | 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 |
51,762 | 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 |
51,763 | 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 |
51,764 | 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 |
51,765 | 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 |
51,766 | 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 |
51,767 | 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 |
51,768 | 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 |
51,769 | 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 |
51,770 | 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 |
51,771 | 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 |
51,772 | 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 |
51,773 | 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 |
51,774 | 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 |
51,775 | 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 |
51,776 | 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 |
51,777 | 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 |
51,778 | 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 |
51,779 | 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 |
51,780 | 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 |
51,781 | 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 |
51,782 | 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 |
51,783 | 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 |
51,784 | 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 |
51,785 | 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 |
51,786 | 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 |
51,787 | 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 |
51,788 | 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 |
51,789 | 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 |
51,790 | 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 |
51,791 | 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 |
51,792 | 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 |
51,793 | 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 |
51,794 | 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 |
51,795 | 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 |
51,796 | 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 |
51,797 | 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 |
51,798 | 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 |
51,799 | 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 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.