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 |
|---|---|---|---|---|---|---|---|---|---|---|---|
48,300 | playn/playn | android/src/playn/android/AndroidAudio.java | AndroidAudio.createSound | public SoundImpl<?> createSound(FileDescriptor fd, long offset, long length) {
PooledSound sound = new PooledSound(pool.load(fd, offset, length, 1));
loadingSounds.put(sound.soundId, sound);
return sound;
} | java | public SoundImpl<?> createSound(FileDescriptor fd, long offset, long length) {
PooledSound sound = new PooledSound(pool.load(fd, offset, length, 1));
loadingSounds.put(sound.soundId, sound);
return sound;
} | [
"public",
"SoundImpl",
"<",
"?",
">",
"createSound",
"(",
"FileDescriptor",
"fd",
",",
"long",
"offset",
",",
"long",
"length",
")",
"{",
"PooledSound",
"sound",
"=",
"new",
"PooledSound",
"(",
"pool",
".",
"load",
"(",
"fd",
",",
"offset",
",",
"length"... | Creates a sound instance from the supplied file descriptor offset. | [
"Creates",
"a",
"sound",
"instance",
"from",
"the",
"supplied",
"file",
"descriptor",
"offset",
"."
] | 7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66 | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/android/src/playn/android/AndroidAudio.java#L134-L138 |
48,301 | playn/playn | html/src/playn/super/java/nio/ByteBuffer.java | ByteBuffer.compareTo | public int compareTo (ByteBuffer otherBuffer) {
int compareRemaining = (remaining() < otherBuffer.remaining()) ?
remaining() : otherBuffer.remaining();
int thisPos = position;
int otherPos = otherBuffer.position;
byte thisByte, otherByte;
while (compareRemaining > 0) {
... | java | public int compareTo (ByteBuffer otherBuffer) {
int compareRemaining = (remaining() < otherBuffer.remaining()) ?
remaining() : otherBuffer.remaining();
int thisPos = position;
int otherPos = otherBuffer.position;
byte thisByte, otherByte;
while (compareRemaining > 0) {
... | [
"public",
"int",
"compareTo",
"(",
"ByteBuffer",
"otherBuffer",
")",
"{",
"int",
"compareRemaining",
"=",
"(",
"remaining",
"(",
")",
"<",
"otherBuffer",
".",
"remaining",
"(",
")",
")",
"?",
"remaining",
"(",
")",
":",
"otherBuffer",
".",
"remaining",
"("... | Compares the remaining bytes of this buffer to another byte buffer's remaining bytes.
@param otherBuffer another byte buffer.
@return a negative value if this is less than {@code other}; 0 if this equals to {@code
other}; a positive value if this is greater than {@code other}.
@exception ClassCastException if {@code o... | [
"Compares",
"the",
"remaining",
"bytes",
"of",
"this",
"buffer",
"to",
"another",
"byte",
"buffer",
"s",
"remaining",
"bytes",
"."
] | 7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66 | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/html/src/playn/super/java/nio/ByteBuffer.java#L218-L235 |
48,302 | playn/playn | html/src/playn/super/java/nio/ByteBuffer.java | ByteBuffer.get | public final ByteBuffer get (byte[] dest, int off, int len) {
int length = dest.length;
if (off < 0 || len < 0 || (long)off + (long)len > length) {
throw new IndexOutOfBoundsException();
}
if (len > remaining()) {
throw new BufferUnderflowException();
}
for (int ... | java | public final ByteBuffer get (byte[] dest, int off, int len) {
int length = dest.length;
if (off < 0 || len < 0 || (long)off + (long)len > length) {
throw new IndexOutOfBoundsException();
}
if (len > remaining()) {
throw new BufferUnderflowException();
}
for (int ... | [
"public",
"final",
"ByteBuffer",
"get",
"(",
"byte",
"[",
"]",
"dest",
",",
"int",
"off",
",",
"int",
"len",
")",
"{",
"int",
"length",
"=",
"dest",
".",
"length",
";",
"if",
"(",
"off",
"<",
"0",
"||",
"len",
"<",
"0",
"||",
"(",
"long",
")",
... | Reads bytes from the current position into the specified byte array, starting at the
specified offset, and increases the position by the number of bytes read.
@param dest the target byte array.
@param off the offset of the byte array, must not be negative and not greater than {@code
dest.length}.
@param len the number... | [
"Reads",
"bytes",
"from",
"the",
"current",
"position",
"into",
"the",
"specified",
"byte",
"array",
"starting",
"at",
"the",
"specified",
"offset",
"and",
"increases",
"the",
"position",
"by",
"the",
"number",
"of",
"bytes",
"read",
"."
] | 7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66 | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/html/src/playn/super/java/nio/ByteBuffer.java#L316-L331 |
48,303 | playn/playn | html/src/playn/super/java/nio/ByteBuffer.java | ByteBuffer.put | public ByteBuffer put (byte[] src, int off, int len) {
int length = src.length;
if (off < 0 || len < 0 || off + len > length) {
throw new IndexOutOfBoundsException();
}
if (len > remaining()) {
throw new BufferOverflowException();
}
for (int i = 0... | java | public ByteBuffer put (byte[] src, int off, int len) {
int length = src.length;
if (off < 0 || len < 0 || off + len > length) {
throw new IndexOutOfBoundsException();
}
if (len > remaining()) {
throw new BufferOverflowException();
}
for (int i = 0... | [
"public",
"ByteBuffer",
"put",
"(",
"byte",
"[",
"]",
"src",
",",
"int",
"off",
",",
"int",
"len",
")",
"{",
"int",
"length",
"=",
"src",
".",
"length",
";",
"if",
"(",
"off",
"<",
"0",
"||",
"len",
"<",
"0",
"||",
"off",
"+",
"len",
">",
"le... | Writes bytes in the given byte array, starting from the specified offset, to the current
position and increases the position by the number of bytes written.
@param src the source byte array.
@param off the offset of byte array, must not be negative and not greater than {@code
src.length}.
@param len the number of byte... | [
"Writes",
"bytes",
"in",
"the",
"given",
"byte",
"array",
"starting",
"from",
"the",
"specified",
"offset",
"to",
"the",
"current",
"position",
"and",
"increases",
"the",
"position",
"by",
"the",
"number",
"of",
"bytes",
"written",
"."
] | 7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66 | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/html/src/playn/super/java/nio/ByteBuffer.java#L629-L643 |
48,304 | playn/playn | core/src/playn/core/Texture.java | Texture.close | @Override public void close () {
if (!disposed) {
disposed = true;
if (gfx.exec().isMainThread()) {
gfx.gl.glDeleteTexture(id);
} else {
gfx.exec().invokeNextFrame(new Runnable() {
public void run () { gfx.gl.glDeleteTexture(id); }
});
}
}
} | java | @Override public void close () {
if (!disposed) {
disposed = true;
if (gfx.exec().isMainThread()) {
gfx.gl.glDeleteTexture(id);
} else {
gfx.exec().invokeNextFrame(new Runnable() {
public void run () { gfx.gl.glDeleteTexture(id); }
});
}
}
} | [
"@",
"Override",
"public",
"void",
"close",
"(",
")",
"{",
"if",
"(",
"!",
"disposed",
")",
"{",
"disposed",
"=",
"true",
";",
"if",
"(",
"gfx",
".",
"exec",
"(",
")",
".",
"isMainThread",
"(",
")",
")",
"{",
"gfx",
".",
"gl",
".",
"glDeleteTextu... | Deletes this texture's GPU resources and renders it unusable. | [
"Deletes",
"this",
"texture",
"s",
"GPU",
"resources",
"and",
"renders",
"it",
"unusable",
"."
] | 7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66 | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/core/src/playn/core/Texture.java#L240-L251 |
48,305 | playn/playn | android/src/playn/android/AndroidGraphics.java | AndroidGraphics.onSurfaceChanged | public void onSurfaceChanged (int pixelWidth, int pixelHeight, int orient) {
viewportChanged(pixelWidth, pixelHeight);
screenSize.setSize(viewSize);
switch (orient) {
case Configuration.ORIENTATION_LANDSCAPE:
orientDetailM.update(OrientationDetail.LANDSCAPE_LEFT);
break;
case Configurati... | java | public void onSurfaceChanged (int pixelWidth, int pixelHeight, int orient) {
viewportChanged(pixelWidth, pixelHeight);
screenSize.setSize(viewSize);
switch (orient) {
case Configuration.ORIENTATION_LANDSCAPE:
orientDetailM.update(OrientationDetail.LANDSCAPE_LEFT);
break;
case Configurati... | [
"public",
"void",
"onSurfaceChanged",
"(",
"int",
"pixelWidth",
",",
"int",
"pixelHeight",
",",
"int",
"orient",
")",
"{",
"viewportChanged",
"(",
"pixelWidth",
",",
"pixelHeight",
")",
";",
"screenSize",
".",
"setSize",
"(",
"viewSize",
")",
";",
"switch",
... | Informs the graphics system that the surface into which it is rendering has changed size. The
supplied width and height are in pixels, not display units. | [
"Informs",
"the",
"graphics",
"system",
"that",
"the",
"surface",
"into",
"which",
"it",
"is",
"rendering",
"has",
"changed",
"size",
".",
"The",
"supplied",
"width",
"and",
"height",
"are",
"in",
"pixels",
"not",
"display",
"units",
"."
] | 7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66 | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/android/src/playn/android/AndroidGraphics.java#L134-L148 |
48,306 | playn/playn | robovm/src/playn/robovm/RoboGraphics.java | RoboGraphics.viewDidInit | void viewDidInit(CGRect bounds) {
defaultFramebuffer = gl.glGetInteger(GL20.GL_FRAMEBUFFER_BINDING);
if (defaultFramebuffer == 0) throw new IllegalStateException(
"Failed to determine defaultFramebuffer");
boundsChanged(bounds);
} | java | void viewDidInit(CGRect bounds) {
defaultFramebuffer = gl.glGetInteger(GL20.GL_FRAMEBUFFER_BINDING);
if (defaultFramebuffer == 0) throw new IllegalStateException(
"Failed to determine defaultFramebuffer");
boundsChanged(bounds);
} | [
"void",
"viewDidInit",
"(",
"CGRect",
"bounds",
")",
"{",
"defaultFramebuffer",
"=",
"gl",
".",
"glGetInteger",
"(",
"GL20",
".",
"GL_FRAMEBUFFER_BINDING",
")",
";",
"if",
"(",
"defaultFramebuffer",
"==",
"0",
")",
"throw",
"new",
"IllegalStateException",
"(",
... | called when our view appears | [
"called",
"when",
"our",
"view",
"appears"
] | 7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66 | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/robovm/src/playn/robovm/RoboGraphics.java#L131-L136 |
48,307 | playn/playn | core/src/playn/core/Input.java | Input.getText | public RFuture<String> getText (Keyboard.TextType textType, String label, String initialValue) {
return getText(textType, label, initialValue, "Ok", "Cancel");
} | java | public RFuture<String> getText (Keyboard.TextType textType, String label, String initialValue) {
return getText(textType, label, initialValue, "Ok", "Cancel");
} | [
"public",
"RFuture",
"<",
"String",
">",
"getText",
"(",
"Keyboard",
".",
"TextType",
"textType",
",",
"String",
"label",
",",
"String",
"initialValue",
")",
"{",
"return",
"getText",
"(",
"textType",
",",
"label",
",",
"initialValue",
",",
"\"Ok\"",
",",
... | Requests a line of text from the user. On platforms that have only a virtual keyboard, this
will display a text entry interface, obtain the line of text, and dismiss the text entry
interface when finished.
@param textType the expected type of text. On mobile devices this hint may be used to display a
keyboard customiz... | [
"Requests",
"a",
"line",
"of",
"text",
"from",
"the",
"user",
".",
"On",
"platforms",
"that",
"have",
"only",
"a",
"virtual",
"keyboard",
"this",
"will",
"display",
"a",
"text",
"entry",
"interface",
"obtain",
"the",
"line",
"of",
"text",
"and",
"dismiss",... | 7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66 | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/core/src/playn/core/Input.java#L96-L98 |
48,308 | playn/playn | core/src/playn/core/Input.java | Input.getText | public RFuture<String> getText (Keyboard.TextType textType, String label, String initialValue,
String ok, String cancel) {
return RFuture.failure(new Exception("getText not supported"));
} | java | public RFuture<String> getText (Keyboard.TextType textType, String label, String initialValue,
String ok, String cancel) {
return RFuture.failure(new Exception("getText not supported"));
} | [
"public",
"RFuture",
"<",
"String",
">",
"getText",
"(",
"Keyboard",
".",
"TextType",
"textType",
",",
"String",
"label",
",",
"String",
"initialValue",
",",
"String",
"ok",
",",
"String",
"cancel",
")",
"{",
"return",
"RFuture",
".",
"failure",
"(",
"new"... | Requests a line of text from the user. On platforms that have only a virtual keyboard, this
will display a text entry interface, obtain the line of text, and dismiss the text entry
interface when finished. Note that HTML5 and some Java backends do not support customization
of the OK and Cancel labels. Thus those platfo... | [
"Requests",
"a",
"line",
"of",
"text",
"from",
"the",
"user",
".",
"On",
"platforms",
"that",
"have",
"only",
"a",
"virtual",
"keyboard",
"this",
"will",
"display",
"a",
"text",
"entry",
"interface",
"obtain",
"the",
"line",
"of",
"text",
"and",
"dismiss",... | 7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66 | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/core/src/playn/core/Input.java#L119-L122 |
48,309 | playn/playn | core/src/playn/core/Input.java | Input.sysDialog | public RFuture<Boolean> sysDialog (String title, String text, String ok, String cancel) {
return RFuture.failure(new Exception("sysDialog not supported"));
} | java | public RFuture<Boolean> sysDialog (String title, String text, String ok, String cancel) {
return RFuture.failure(new Exception("sysDialog not supported"));
} | [
"public",
"RFuture",
"<",
"Boolean",
">",
"sysDialog",
"(",
"String",
"title",
",",
"String",
"text",
",",
"String",
"ok",
",",
"String",
"cancel",
")",
"{",
"return",
"RFuture",
".",
"failure",
"(",
"new",
"Exception",
"(",
"\"sysDialog not supported\"",
")... | Displays a system dialog with the specified title and text, an OK button and optionally a
Cancel button.
@param title the title for the dialog window. Note: some platforms (mainly mobile) do not
display the title, so be sure your dialog makes sense if only {@code text} is showing.
@param text the text of the dialog. T... | [
"Displays",
"a",
"system",
"dialog",
"with",
"the",
"specified",
"title",
"and",
"text",
"an",
"OK",
"button",
"and",
"optionally",
"a",
"Cancel",
"button",
"."
] | 7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66 | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/core/src/playn/core/Input.java#L145-L147 |
48,310 | playn/playn | scene/src/playn/scene/LayerUtil.java | LayerUtil.layerToScreen | public static Point layerToScreen(Layer layer, float x, float y) {
Point into = new Point(x, y);
return layerToScreen(layer, into, into);
} | java | public static Point layerToScreen(Layer layer, float x, float y) {
Point into = new Point(x, y);
return layerToScreen(layer, into, into);
} | [
"public",
"static",
"Point",
"layerToScreen",
"(",
"Layer",
"layer",
",",
"float",
"x",
",",
"float",
"y",
")",
"{",
"Point",
"into",
"=",
"new",
"Point",
"(",
"x",
",",
"y",
")",
";",
"return",
"layerToScreen",
"(",
"layer",
",",
"into",
",",
"into"... | Converts the supplied point from coordinates relative to the specified
layer to screen coordinates. | [
"Converts",
"the",
"supplied",
"point",
"from",
"coordinates",
"relative",
"to",
"the",
"specified",
"layer",
"to",
"screen",
"coordinates",
"."
] | 7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66 | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/scene/src/playn/scene/LayerUtil.java#L44-L47 |
48,311 | playn/playn | scene/src/playn/scene/LayerUtil.java | LayerUtil.layerToParent | public static Point layerToParent(Layer layer, Layer parent, float x, float y) {
Point into = new Point(x, y);
return layerToParent(layer, parent, into, into);
} | java | public static Point layerToParent(Layer layer, Layer parent, float x, float y) {
Point into = new Point(x, y);
return layerToParent(layer, parent, into, into);
} | [
"public",
"static",
"Point",
"layerToParent",
"(",
"Layer",
"layer",
",",
"Layer",
"parent",
",",
"float",
"x",
",",
"float",
"y",
")",
"{",
"Point",
"into",
"=",
"new",
"Point",
"(",
"x",
",",
"y",
")",
";",
"return",
"layerToParent",
"(",
"layer",
... | Converts the supplied point from coordinates relative to the specified
child layer to coordinates relative to the specified parent layer. | [
"Converts",
"the",
"supplied",
"point",
"from",
"coordinates",
"relative",
"to",
"the",
"specified",
"child",
"layer",
"to",
"coordinates",
"relative",
"to",
"the",
"specified",
"parent",
"layer",
"."
] | 7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66 | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/scene/src/playn/scene/LayerUtil.java#L74-L77 |
48,312 | playn/playn | scene/src/playn/scene/LayerUtil.java | LayerUtil.screenToLayer | public static Point screenToLayer(Layer layer, float x, float y) {
Point into = new Point(x, y);
return screenToLayer(layer, into, into);
} | java | public static Point screenToLayer(Layer layer, float x, float y) {
Point into = new Point(x, y);
return screenToLayer(layer, into, into);
} | [
"public",
"static",
"Point",
"screenToLayer",
"(",
"Layer",
"layer",
",",
"float",
"x",
",",
"float",
"y",
")",
"{",
"Point",
"into",
"=",
"new",
"Point",
"(",
"x",
",",
"y",
")",
";",
"return",
"screenToLayer",
"(",
"layer",
",",
"into",
",",
"into"... | Converts the supplied point from screen coordinates to coordinates
relative to the specified layer. | [
"Converts",
"the",
"supplied",
"point",
"from",
"screen",
"coordinates",
"to",
"coordinates",
"relative",
"to",
"the",
"specified",
"layer",
"."
] | 7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66 | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/scene/src/playn/scene/LayerUtil.java#L94-L97 |
48,313 | playn/playn | scene/src/playn/scene/LayerUtil.java | LayerUtil.layerUnderPoint | public static Layer layerUnderPoint (Layer root, float x, float y) {
Point p = new Point(x, y);
root.transform().inverseTransform(p, p);
p.x += root.originX();
p.y += root.originY();
return layerUnderPoint(root, p);
} | java | public static Layer layerUnderPoint (Layer root, float x, float y) {
Point p = new Point(x, y);
root.transform().inverseTransform(p, p);
p.x += root.originX();
p.y += root.originY();
return layerUnderPoint(root, p);
} | [
"public",
"static",
"Layer",
"layerUnderPoint",
"(",
"Layer",
"root",
",",
"float",
"x",
",",
"float",
"y",
")",
"{",
"Point",
"p",
"=",
"new",
"Point",
"(",
"x",
",",
"y",
")",
";",
"root",
".",
"transform",
"(",
")",
".",
"inverseTransform",
"(",
... | Gets the layer underneath the given screen coordinates, ignoring hit testers. This is
useful for inspecting the scene graph for debugging purposes, and is not intended for use
is shipped code. The layer returned is the one that has a size and is the deepest within
the graph and contains the coordinate. | [
"Gets",
"the",
"layer",
"underneath",
"the",
"given",
"screen",
"coordinates",
"ignoring",
"hit",
"testers",
".",
"This",
"is",
"useful",
"for",
"inspecting",
"the",
"scene",
"graph",
"for",
"debugging",
"purposes",
"and",
"is",
"not",
"intended",
"for",
"use"... | 7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66 | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/scene/src/playn/scene/LayerUtil.java#L159-L165 |
48,314 | playn/playn | scene/src/playn/scene/LayerUtil.java | LayerUtil.indexInParent | public static int indexInParent (Layer layer) {
GroupLayer parent = layer.parent();
if (parent == null) return -1;
for (int ii = parent.children()-1; ii >= 0; ii--) {
if (parent.childAt(ii) == layer) return ii;
}
throw new AssertionError();
} | java | public static int indexInParent (Layer layer) {
GroupLayer parent = layer.parent();
if (parent == null) return -1;
for (int ii = parent.children()-1; ii >= 0; ii--) {
if (parent.childAt(ii) == layer) return ii;
}
throw new AssertionError();
} | [
"public",
"static",
"int",
"indexInParent",
"(",
"Layer",
"layer",
")",
"{",
"GroupLayer",
"parent",
"=",
"layer",
".",
"parent",
"(",
")",
";",
"if",
"(",
"parent",
"==",
"null",
")",
"return",
"-",
"1",
";",
"for",
"(",
"int",
"ii",
"=",
"parent",
... | Returns the index of the given layer within its parent, or -1 if the parent is null. | [
"Returns",
"the",
"index",
"of",
"the",
"given",
"layer",
"within",
"its",
"parent",
"or",
"-",
"1",
"if",
"the",
"parent",
"is",
"null",
"."
] | 7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66 | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/scene/src/playn/scene/LayerUtil.java#L170-L177 |
48,315 | playn/playn | core/src/playn/core/RenderTarget.java | RenderTarget.bind | public void bind () {
gfx.gl.glBindFramebuffer(GL_FRAMEBUFFER, id());
gfx.gl.glViewport(0, 0, width(), height());
} | java | public void bind () {
gfx.gl.glBindFramebuffer(GL_FRAMEBUFFER, id());
gfx.gl.glViewport(0, 0, width(), height());
} | [
"public",
"void",
"bind",
"(",
")",
"{",
"gfx",
".",
"gl",
".",
"glBindFramebuffer",
"(",
"GL_FRAMEBUFFER",
",",
"id",
"(",
")",
")",
";",
"gfx",
".",
"gl",
".",
"glViewport",
"(",
"0",
",",
"0",
",",
"width",
"(",
")",
",",
"height",
"(",
")",
... | Binds the framebuffer. | [
"Binds",
"the",
"framebuffer",
"."
] | 7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66 | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/core/src/playn/core/RenderTarget.java#L70-L73 |
48,316 | playn/playn | core/src/playn/core/GLProgram.java | GLProgram.close | @Override public void close () {
gl.glDeleteShader(vertexShader);
gl.glDeleteShader(fragmentShader);
gl.glDeleteProgram(id);
} | java | @Override public void close () {
gl.glDeleteShader(vertexShader);
gl.glDeleteShader(fragmentShader);
gl.glDeleteProgram(id);
} | [
"@",
"Override",
"public",
"void",
"close",
"(",
")",
"{",
"gl",
".",
"glDeleteShader",
"(",
"vertexShader",
")",
";",
"gl",
".",
"glDeleteShader",
"(",
"fragmentShader",
")",
";",
"gl",
".",
"glDeleteProgram",
"(",
"id",
")",
";",
"}"
] | Frees this program and associated compiled shaders.
The program must not be used after closure. | [
"Frees",
"this",
"program",
"and",
"associated",
"compiled",
"shaders",
".",
"The",
"program",
"must",
"not",
"be",
"used",
"after",
"closure",
"."
] | 7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66 | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/core/src/playn/core/GLProgram.java#L99-L103 |
48,317 | playn/playn | core/src/playn/core/json/JsonWriterBase.java | JsonWriterBase.emitStringValue | private void emitStringValue(String s) {
raw('"');
char b = 0, c = 0;
for (int i = 0; i < s.length(); i++) {
b = c;
c = s.charAt(i);
switch (c) {
case '\\':
case '"':
raw('\\');
raw(c);
break;
case '/':
// Special case to ens... | java | private void emitStringValue(String s) {
raw('"');
char b = 0, c = 0;
for (int i = 0; i < s.length(); i++) {
b = c;
c = s.charAt(i);
switch (c) {
case '\\':
case '"':
raw('\\');
raw(c);
break;
case '/':
// Special case to ens... | [
"private",
"void",
"emitStringValue",
"(",
"String",
"s",
")",
"{",
"raw",
"(",
"'",
"'",
")",
";",
"char",
"b",
"=",
"0",
",",
"c",
"=",
"0",
";",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"s",
".",
"length",
"(",
")",
";",
"i",
"... | Emits a quoted string value, escaping characters that are required to be escaped. | [
"Emits",
"a",
"quoted",
"string",
"value",
"escaping",
"characters",
"that",
"are",
"required",
"to",
"be",
"escaped",
"."
] | 7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66 | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/core/src/playn/core/json/JsonWriterBase.java#L399-L445 |
48,318 | playn/playn | java-base/src/playn/java/JavaGraphics.java | JavaGraphics.aaFontContext | FontRenderContext aaFontContext() {
if (aaFontContext == null) {
// set up the dummy font contexts
Graphics2D aaGfx = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB).createGraphics();
aaGfx.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
aaFontConte... | java | FontRenderContext aaFontContext() {
if (aaFontContext == null) {
// set up the dummy font contexts
Graphics2D aaGfx = new BufferedImage(1, 1, BufferedImage.TYPE_INT_ARGB).createGraphics();
aaGfx.setRenderingHint(RenderingHints.KEY_ANTIALIASING, RenderingHints.VALUE_ANTIALIAS_ON);
aaFontConte... | [
"FontRenderContext",
"aaFontContext",
"(",
")",
"{",
"if",
"(",
"aaFontContext",
"==",
"null",
")",
"{",
"// set up the dummy font contexts",
"Graphics2D",
"aaGfx",
"=",
"new",
"BufferedImage",
"(",
"1",
",",
"1",
",",
"BufferedImage",
".",
"TYPE_INT_ARGB",
")",
... | these are initialized lazily to avoid doing any AWT stuff during startup | [
"these",
"are",
"initialized",
"lazily",
"to",
"avoid",
"doing",
"any",
"AWT",
"stuff",
"during",
"startup"
] | 7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66 | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/java-base/src/playn/java/JavaGraphics.java#L47-L55 |
48,319 | playn/playn | html/src/playn/super/java/nio/DoubleBuffer.java | DoubleBuffer.compareTo | public int compareTo (DoubleBuffer otherBuffer) {
int compareRemaining = (remaining() < otherBuffer.remaining()) ?
remaining() : otherBuffer.remaining();
int thisPos = position;
int otherPos = otherBuffer.position;
// BEGIN android-changed
double thisDouble, otherDouble... | java | public int compareTo (DoubleBuffer otherBuffer) {
int compareRemaining = (remaining() < otherBuffer.remaining()) ?
remaining() : otherBuffer.remaining();
int thisPos = position;
int otherPos = otherBuffer.position;
// BEGIN android-changed
double thisDouble, otherDouble... | [
"public",
"int",
"compareTo",
"(",
"DoubleBuffer",
"otherBuffer",
")",
"{",
"int",
"compareRemaining",
"=",
"(",
"remaining",
"(",
")",
"<",
"otherBuffer",
".",
"remaining",
"(",
")",
")",
"?",
"remaining",
"(",
")",
":",
"otherBuffer",
".",
"remaining",
"... | Compare the remaining doubles of this buffer to another double buffer's remaining doubles.
@param otherBuffer another double buffer.
@return a negative value if this is less than {@code other}; 0 if this equals to {@code
other}; a positive value if this is greater than {@code other}.
@exception ClassCastException if {... | [
"Compare",
"the",
"remaining",
"doubles",
"of",
"this",
"buffer",
"to",
"another",
"double",
"buffer",
"s",
"remaining",
"doubles",
"."
] | 7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66 | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/html/src/playn/super/java/nio/DoubleBuffer.java#L105-L126 |
48,320 | playn/playn | html/src/playn/super/java/nio/DoubleBuffer.java | DoubleBuffer.get | public DoubleBuffer get (double[] dest, int off, int len) {
int length = dest.length;
if (off < 0 || len < 0 || (long)off + (long)len > length) {
throw new IndexOutOfBoundsException();
}
if (len > remaining()) {
throw new BufferUnderflowException();
}
... | java | public DoubleBuffer get (double[] dest, int off, int len) {
int length = dest.length;
if (off < 0 || len < 0 || (long)off + (long)len > length) {
throw new IndexOutOfBoundsException();
}
if (len > remaining()) {
throw new BufferUnderflowException();
}
... | [
"public",
"DoubleBuffer",
"get",
"(",
"double",
"[",
"]",
"dest",
",",
"int",
"off",
",",
"int",
"len",
")",
"{",
"int",
"length",
"=",
"dest",
".",
"length",
";",
"if",
"(",
"off",
"<",
"0",
"||",
"len",
"<",
"0",
"||",
"(",
"long",
")",
"off"... | Reads doubles from the current position into the specified double array, starting from the
specified offset, and increases the position by the number of doubles read.
@param dest the target double array.
@param off the offset of the double array, must not be negative and not greater than {@code
dest.length}.
@param le... | [
"Reads",
"doubles",
"from",
"the",
"current",
"position",
"into",
"the",
"specified",
"double",
"array",
"starting",
"from",
"the",
"specified",
"offset",
"and",
"increases",
"the",
"position",
"by",
"the",
"number",
"of",
"doubles",
"read",
"."
] | 7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66 | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/html/src/playn/super/java/nio/DoubleBuffer.java#L199-L212 |
48,321 | playn/playn | html/src/playn/super/java/nio/DoubleBuffer.java | DoubleBuffer.put | public DoubleBuffer put (double[] src, int off, int len) {
int length = src.length;
if (off < 0 || len < 0 || (long)off + (long)len > length) {
throw new IndexOutOfBoundsException();
}
if (len > remaining()) {
throw new BufferOverflowException();
}
... | java | public DoubleBuffer put (double[] src, int off, int len) {
int length = src.length;
if (off < 0 || len < 0 || (long)off + (long)len > length) {
throw new IndexOutOfBoundsException();
}
if (len > remaining()) {
throw new BufferOverflowException();
}
... | [
"public",
"DoubleBuffer",
"put",
"(",
"double",
"[",
"]",
"src",
",",
"int",
"off",
",",
"int",
"len",
")",
"{",
"int",
"length",
"=",
"src",
".",
"length",
";",
"if",
"(",
"off",
"<",
"0",
"||",
"len",
"<",
"0",
"||",
"(",
"long",
")",
"off",
... | Writes doubles from the given double array, starting from the specified offset, to the
current position and increases the position by the number of doubles written.
@param src the source double array.
@param off the offset of double array, must not be negative and not greater than {@code
src.length}.
@param len the nu... | [
"Writes",
"doubles",
"from",
"the",
"given",
"double",
"array",
"starting",
"from",
"the",
"specified",
"offset",
"to",
"the",
"current",
"position",
"and",
"increases",
"the",
"position",
"by",
"the",
"number",
"of",
"doubles",
"written",
"."
] | 7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66 | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/html/src/playn/super/java/nio/DoubleBuffer.java#L316-L329 |
48,322 | playn/playn | core/src/playn/core/SoundImpl.java | SoundImpl.succeed | public synchronized void succeed (I impl) {
this.impl = impl;
setVolumeImpl(volume);
setLoopingImpl(looping);
if (playing) playImpl();
((RPromise<Sound>)state).succeed(this);
} | java | public synchronized void succeed (I impl) {
this.impl = impl;
setVolumeImpl(volume);
setLoopingImpl(looping);
if (playing) playImpl();
((RPromise<Sound>)state).succeed(this);
} | [
"public",
"synchronized",
"void",
"succeed",
"(",
"I",
"impl",
")",
"{",
"this",
".",
"impl",
"=",
"impl",
";",
"setVolumeImpl",
"(",
"volume",
")",
";",
"setLoopingImpl",
"(",
"looping",
")",
";",
"if",
"(",
"playing",
")",
"playImpl",
"(",
")",
";",
... | Configures this sound with its platform implementation.
This may be called from any thread. | [
"Configures",
"this",
"sound",
"with",
"its",
"platform",
"implementation",
".",
"This",
"may",
"be",
"called",
"from",
"any",
"thread",
"."
] | 7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66 | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/core/src/playn/core/SoundImpl.java#L36-L42 |
48,323 | playn/playn | java-lwjgl/src/playn/java/GLFWInput.java | GLFWInput.toModifierFlags | private int toModifierFlags (int mods) {
return modifierFlags((mods & GLFW_MOD_ALT) != 0,
(mods & GLFW_MOD_CONTROL) != 0,
(mods & GLFW_MOD_SUPER) != 0,
(mods & GLFW_MOD_SHIFT) != 0);
} | java | private int toModifierFlags (int mods) {
return modifierFlags((mods & GLFW_MOD_ALT) != 0,
(mods & GLFW_MOD_CONTROL) != 0,
(mods & GLFW_MOD_SUPER) != 0,
(mods & GLFW_MOD_SHIFT) != 0);
} | [
"private",
"int",
"toModifierFlags",
"(",
"int",
"mods",
")",
"{",
"return",
"modifierFlags",
"(",
"(",
"mods",
"&",
"GLFW_MOD_ALT",
")",
"!=",
"0",
",",
"(",
"mods",
"&",
"GLFW_MOD_CONTROL",
")",
"!=",
"0",
",",
"(",
"mods",
"&",
"GLFW_MOD_SUPER",
")",
... | Converts GLFW modifier key flags into PlayN modifier key flags. | [
"Converts",
"GLFW",
"modifier",
"key",
"flags",
"into",
"PlayN",
"modifier",
"key",
"flags",
"."
] | 7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66 | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/java-lwjgl/src/playn/java/GLFWInput.java#L174-L179 |
48,324 | playn/playn | core/src/playn/core/Exec.java | Exec.deferredPromise | public <T> RPromise<T> deferredPromise () {
return new RPromise<T>() {
@Override public void succeed (final T value) {
invokeLater(new Runnable() {
public void run () { superSucceed(value); }
});
}
@Override public void fail (final Throwable cause) {
invokeLater(n... | java | public <T> RPromise<T> deferredPromise () {
return new RPromise<T>() {
@Override public void succeed (final T value) {
invokeLater(new Runnable() {
public void run () { superSucceed(value); }
});
}
@Override public void fail (final Throwable cause) {
invokeLater(n... | [
"public",
"<",
"T",
">",
"RPromise",
"<",
"T",
">",
"deferredPromise",
"(",
")",
"{",
"return",
"new",
"RPromise",
"<",
"T",
">",
"(",
")",
"{",
"@",
"Override",
"public",
"void",
"succeed",
"(",
"final",
"T",
"value",
")",
"{",
"invokeLater",
"(",
... | Creates a promise which defers notification of success or failure to the game thread,
regardless of what thread on which it is completed. Note that even if it is completed on the
game thread, it will still defer completion until the next frame. | [
"Creates",
"a",
"promise",
"which",
"defers",
"notification",
"of",
"success",
"or",
"failure",
"to",
"the",
"game",
"thread",
"regardless",
"of",
"what",
"thread",
"on",
"which",
"it",
"is",
"completed",
".",
"Note",
"that",
"even",
"if",
"it",
"is",
"com... | 7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66 | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/core/src/playn/core/Exec.java#L100-L115 |
48,325 | playn/playn | core/src/playn/core/TriangleBatch.java | TriangleBatch.addTris | public void addTris (Texture tex, int tint, AffineTransform xf,
float[] xys, int xysOffset, int xysLen, float tw, float th,
int[] indices, int indicesOffset, int indicesLen, int indexBase) {
setTexture(tex);
prepare(tint, xf);
addTris(xys, xysOffset, xysLen, tw,... | java | public void addTris (Texture tex, int tint, AffineTransform xf,
float[] xys, int xysOffset, int xysLen, float tw, float th,
int[] indices, int indicesOffset, int indicesLen, int indexBase) {
setTexture(tex);
prepare(tint, xf);
addTris(xys, xysOffset, xysLen, tw,... | [
"public",
"void",
"addTris",
"(",
"Texture",
"tex",
",",
"int",
"tint",
",",
"AffineTransform",
"xf",
",",
"float",
"[",
"]",
"xys",
",",
"int",
"xysOffset",
",",
"int",
"xysLen",
",",
"float",
"tw",
",",
"float",
"th",
",",
"int",
"[",
"]",
"indices... | Adds a collection of textured triangles to the current render operation.
@param xys a list of x/y coordinates as: {@code [x1, y1, x2, y2, ...]}.
@param xysOffset the offset of the coordinates array, must not be negative and no greater than
{@code xys.length}. Note: this is an absolute offset; since {@code xys} contain... | [
"Adds",
"a",
"collection",
"of",
"textured",
"triangles",
"to",
"the",
"current",
"render",
"operation",
"."
] | 7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66 | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/core/src/playn/core/TriangleBatch.java#L194-L200 |
48,326 | playn/playn | html/src/playn/html/HtmlFontMetrics.java | HtmlFontMetrics.adjustWidth | public float adjustWidth(float width) {
// Canvas.measureText does not account for the extra width consumed by italic characters, so we
// fudge in a fraction of an em and hope the font isn't too slanted
switch (font.style) {
case ITALIC: return width + emwidth/8;
case BOLD_ITALIC: return width... | java | public float adjustWidth(float width) {
// Canvas.measureText does not account for the extra width consumed by italic characters, so we
// fudge in a fraction of an em and hope the font isn't too slanted
switch (font.style) {
case ITALIC: return width + emwidth/8;
case BOLD_ITALIC: return width... | [
"public",
"float",
"adjustWidth",
"(",
"float",
"width",
")",
"{",
"// Canvas.measureText does not account for the extra width consumed by italic characters, so we",
"// fudge in a fraction of an em and hope the font isn't too slanted",
"switch",
"(",
"font",
".",
"style",
")",
"{",
... | Adjusts a measured width to account for italic and bold italic text. We have to handle this
hackily because there's no way to measure exact text extent in HTML5. | [
"Adjusts",
"a",
"measured",
"width",
"to",
"account",
"for",
"italic",
"and",
"bold",
"italic",
"text",
".",
"We",
"have",
"to",
"handle",
"this",
"hackily",
"because",
"there",
"s",
"no",
"way",
"to",
"measure",
"exact",
"text",
"extent",
"in",
"HTML5",
... | 7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66 | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/html/src/playn/html/HtmlFontMetrics.java#L65-L73 |
48,327 | playn/playn | html/src/playn/rebind/AutoClientBundleGenerator.java | AutoClientBundleGenerator.getWarDirectory | private File getWarDirectory(TreeLogger logger) throws UnableToCompleteException {
File currentDirectory = new File(".");
try {
String canonicalPath = currentDirectory.getCanonicalPath();
logger.log(TreeLogger.INFO, "Current directory in which this generator is executing: "
+ canonicalPath... | java | private File getWarDirectory(TreeLogger logger) throws UnableToCompleteException {
File currentDirectory = new File(".");
try {
String canonicalPath = currentDirectory.getCanonicalPath();
logger.log(TreeLogger.INFO, "Current directory in which this generator is executing: "
+ canonicalPath... | [
"private",
"File",
"getWarDirectory",
"(",
"TreeLogger",
"logger",
")",
"throws",
"UnableToCompleteException",
"{",
"File",
"currentDirectory",
"=",
"new",
"File",
"(",
"\".\"",
")",
";",
"try",
"{",
"String",
"canonicalPath",
"=",
"currentDirectory",
".",
"getCan... | When invoking the GWT compiler from GPE, the working directory is the Eclipse project
directory. However, when launching a GPE project, the working directory is the project 'war'
directory. This methods returns the war directory in either case in a fairly naive and
non-robust manner. | [
"When",
"invoking",
"the",
"GWT",
"compiler",
"from",
"GPE",
"the",
"working",
"directory",
"is",
"the",
"Eclipse",
"project",
"directory",
".",
"However",
"when",
"launching",
"a",
"GPE",
"project",
"the",
"working",
"directory",
"is",
"the",
"project",
"war"... | 7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66 | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/html/src/playn/rebind/AutoClientBundleGenerator.java#L291-L306 |
48,328 | playn/playn | scene/src/playn/scene/SceneGame.java | SceneGame.paintScene | protected void paintScene () {
viewSurf.saveTx();
viewSurf.begin();
viewSurf.clear(cred, cgreen, cblue, calpha);
try {
rootLayer.paint(viewSurf);
} finally {
viewSurf.end();
viewSurf.restoreTx();
}
} | java | protected void paintScene () {
viewSurf.saveTx();
viewSurf.begin();
viewSurf.clear(cred, cgreen, cblue, calpha);
try {
rootLayer.paint(viewSurf);
} finally {
viewSurf.end();
viewSurf.restoreTx();
}
} | [
"protected",
"void",
"paintScene",
"(",
")",
"{",
"viewSurf",
".",
"saveTx",
"(",
")",
";",
"viewSurf",
".",
"begin",
"(",
")",
";",
"viewSurf",
".",
"clear",
"(",
"cred",
",",
"cgreen",
",",
"cblue",
",",
"calpha",
")",
";",
"try",
"{",
"rootLayer",... | Renders the main scene graph into the OpenGL frame buffer. | [
"Renders",
"the",
"main",
"scene",
"graph",
"into",
"the",
"OpenGL",
"frame",
"buffer",
"."
] | 7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66 | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/scene/src/playn/scene/SceneGame.java#L68-L78 |
48,329 | playn/playn | java-base/src/playn/java/JavaAssets.java | JavaAssets.requireResource | protected Resource requireResource(String path) throws IOException {
URL url = getClass().getClassLoader().getResource(pathPrefix + path);
if (url != null) {
return url.getProtocol().equals("file") ?
new FileResource(new File(URLDecoder.decode(url.getPath(), "UTF-8"))) :
new URLResource(ur... | java | protected Resource requireResource(String path) throws IOException {
URL url = getClass().getClassLoader().getResource(pathPrefix + path);
if (url != null) {
return url.getProtocol().equals("file") ?
new FileResource(new File(URLDecoder.decode(url.getPath(), "UTF-8"))) :
new URLResource(ur... | [
"protected",
"Resource",
"requireResource",
"(",
"String",
"path",
")",
"throws",
"IOException",
"{",
"URL",
"url",
"=",
"getClass",
"(",
")",
".",
"getClassLoader",
"(",
")",
".",
"getResource",
"(",
"pathPrefix",
"+",
"path",
")",
";",
"if",
"(",
"url",
... | Attempts to locate the resource at the given path, and returns a wrapper which allows its data
to be efficiently read.
<p>First, the path prefix is prepended (see {@link #setPathPrefix(String)}) and the the class
loader checked. If not found, then the extra directories, if any, are checked, in order. If
the file is no... | [
"Attempts",
"to",
"locate",
"the",
"resource",
"at",
"the",
"given",
"path",
"and",
"returns",
"a",
"wrapper",
"which",
"allows",
"its",
"data",
"to",
"be",
"efficiently",
"read",
"."
] | 7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66 | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/java-base/src/playn/java/JavaAssets.java#L174-L188 |
48,330 | playn/playn | html/src/playn/html/HtmlGL20.java | HtmlGL20.prepareDraw | protected void prepareDraw() {
VertexAttribArrayState previousNio = null;
int previousElementSize = 0;
if (useNioBuffer == 0 && enabledArrays == previouslyEnabledArrays) {
return;
}
for(int i = 0; i < VERTEX_ATTRIB_ARRAY_COUNT; i++) {
int mask = 1 << i;
int enabled = enabledArray... | java | protected void prepareDraw() {
VertexAttribArrayState previousNio = null;
int previousElementSize = 0;
if (useNioBuffer == 0 && enabledArrays == previouslyEnabledArrays) {
return;
}
for(int i = 0; i < VERTEX_ATTRIB_ARRAY_COUNT; i++) {
int mask = 1 << i;
int enabled = enabledArray... | [
"protected",
"void",
"prepareDraw",
"(",
")",
"{",
"VertexAttribArrayState",
"previousNio",
"=",
"null",
";",
"int",
"previousElementSize",
"=",
"0",
";",
"if",
"(",
"useNioBuffer",
"==",
"0",
"&&",
"enabledArrays",
"==",
"previouslyEnabledArrays",
")",
"{",
"re... | The content of non-VBO buffers may be changed between the glVertexAttribPointer call
and the glDrawXxx call. Thus, we need to defer copying them to a VBO buffer until just
before the actual glDrawXxx call. | [
"The",
"content",
"of",
"non",
"-",
"VBO",
"buffers",
"may",
"be",
"changed",
"between",
"the",
"glVertexAttribPointer",
"call",
"and",
"the",
"glDrawXxx",
"call",
".",
"Thus",
"we",
"need",
"to",
"defer",
"copying",
"them",
"to",
"a",
"VBO",
"buffer",
"un... | 7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66 | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/html/src/playn/html/HtmlGL20.java#L239-L294 |
48,331 | playn/playn | jbox2d/src/playn/core/DebugDrawBox2D.java | DebugDrawBox2D.setFillColor | private void setFillColor(Color3f color) {
if (cacheFillR == color.x && cacheFillG == color.y && cacheFillB == color.z) {
// no need to re-set the fill color, just use the cached values
} else {
cacheFillR = color.x;
cacheFillG = color.y;
cacheFillB = color.z;
setFillColorFromCache... | java | private void setFillColor(Color3f color) {
if (cacheFillR == color.x && cacheFillG == color.y && cacheFillB == color.z) {
// no need to re-set the fill color, just use the cached values
} else {
cacheFillR = color.x;
cacheFillG = color.y;
cacheFillB = color.z;
setFillColorFromCache... | [
"private",
"void",
"setFillColor",
"(",
"Color3f",
"color",
")",
"{",
"if",
"(",
"cacheFillR",
"==",
"color",
".",
"x",
"&&",
"cacheFillG",
"==",
"color",
".",
"y",
"&&",
"cacheFillB",
"==",
"color",
".",
"z",
")",
"{",
"// no need to re-set the fill color, ... | Sets the fill color from a Color3f
@param color color where (r,g,b) = (x,y,z) | [
"Sets",
"the",
"fill",
"color",
"from",
"a",
"Color3f"
] | 7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66 | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/jbox2d/src/playn/core/DebugDrawBox2D.java#L175-L184 |
48,332 | playn/playn | jbox2d/src/playn/core/DebugDrawBox2D.java | DebugDrawBox2D.setStrokeColor | private void setStrokeColor(Color3f color) {
if (cacheStrokeR == color.x && cacheStrokeG == color.y && cacheStrokeB == color.z) {
// no need to re-set the stroke color, just use the cached values
} else {
cacheStrokeR = color.x;
cacheStrokeG = color.y;
cacheStrokeB = color.z;
setSt... | java | private void setStrokeColor(Color3f color) {
if (cacheStrokeR == color.x && cacheStrokeG == color.y && cacheStrokeB == color.z) {
// no need to re-set the stroke color, just use the cached values
} else {
cacheStrokeR = color.x;
cacheStrokeG = color.y;
cacheStrokeB = color.z;
setSt... | [
"private",
"void",
"setStrokeColor",
"(",
"Color3f",
"color",
")",
"{",
"if",
"(",
"cacheStrokeR",
"==",
"color",
".",
"x",
"&&",
"cacheStrokeG",
"==",
"color",
".",
"y",
"&&",
"cacheStrokeB",
"==",
"color",
".",
"z",
")",
"{",
"// no need to re-set the stro... | Sets the stroke color from a Color3f
@param color color where (r,g,b) = (x,y,z) | [
"Sets",
"the",
"stroke",
"color",
"from",
"a",
"Color3f"
] | 7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66 | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/jbox2d/src/playn/core/DebugDrawBox2D.java#L200-L209 |
48,333 | playn/playn | java-base/src/playn/java/JavaPlatform.java | JavaPlatform.start | public void start () {
if (config.activationKey != null) {
input().keyboardEvents.connect(new Slot<Keyboard.Event>() {
public void onEmit (Keyboard.Event event) {
if (event instanceof Keyboard.KeyEvent) {
Keyboard.KeyEvent kevent = (Keyboard.KeyEvent)event;
if (kevent... | java | public void start () {
if (config.activationKey != null) {
input().keyboardEvents.connect(new Slot<Keyboard.Event>() {
public void onEmit (Keyboard.Event event) {
if (event instanceof Keyboard.KeyEvent) {
Keyboard.KeyEvent kevent = (Keyboard.KeyEvent)event;
if (kevent... | [
"public",
"void",
"start",
"(",
")",
"{",
"if",
"(",
"config",
".",
"activationKey",
"!=",
"null",
")",
"{",
"input",
"(",
")",
".",
"keyboardEvents",
".",
"connect",
"(",
"new",
"Slot",
"<",
"Keyboard",
".",
"Event",
">",
"(",
")",
"{",
"public",
... | Starts the game loop. This method will not return until the game exits. | [
"Starts",
"the",
"game",
"loop",
".",
"This",
"method",
"will",
"not",
"return",
"until",
"the",
"game",
"exits",
"."
] | 7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66 | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/java-base/src/playn/java/JavaPlatform.java#L128-L163 |
48,334 | playn/playn | html/src/playn/super/java/nio/IntBuffer.java | IntBuffer.allocate | public static IntBuffer allocate (int capacity) {
if (capacity < 0) {
throw new IllegalArgumentException();
}
ByteBuffer bb = ByteBuffer.allocateDirect(capacity * 4);
bb.order(ByteOrder.nativeOrder());
return bb.asIntBuffer();
} | java | public static IntBuffer allocate (int capacity) {
if (capacity < 0) {
throw new IllegalArgumentException();
}
ByteBuffer bb = ByteBuffer.allocateDirect(capacity * 4);
bb.order(ByteOrder.nativeOrder());
return bb.asIntBuffer();
} | [
"public",
"static",
"IntBuffer",
"allocate",
"(",
"int",
"capacity",
")",
"{",
"if",
"(",
"capacity",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
")",
";",
"}",
"ByteBuffer",
"bb",
"=",
"ByteBuffer",
".",
"allocateDirect",
"(",
"ca... | Creates an int buffer based on a newly allocated int array.
@param capacity the capacity of the new buffer.
@return the created int buffer.
@throws IllegalArgumentException if {@code capacity} is less than zero. | [
"Creates",
"an",
"int",
"buffer",
"based",
"on",
"a",
"newly",
"allocated",
"int",
"array",
"."
] | 7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66 | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/html/src/playn/super/java/nio/IntBuffer.java#L52-L59 |
48,335 | playn/playn | html/src/playn/super/java/nio/IntBuffer.java | IntBuffer.compareTo | public int compareTo (IntBuffer otherBuffer) {
int compareRemaining = (remaining() < otherBuffer.remaining()) ?
remaining() : otherBuffer.remaining();
int thisPos = position;
int otherPos = otherBuffer.position;
// BEGIN android-changed
int thisInt, otherInt;
wh... | java | public int compareTo (IntBuffer otherBuffer) {
int compareRemaining = (remaining() < otherBuffer.remaining()) ?
remaining() : otherBuffer.remaining();
int thisPos = position;
int otherPos = otherBuffer.position;
// BEGIN android-changed
int thisInt, otherInt;
wh... | [
"public",
"int",
"compareTo",
"(",
"IntBuffer",
"otherBuffer",
")",
"{",
"int",
"compareRemaining",
"=",
"(",
"remaining",
"(",
")",
"<",
"otherBuffer",
".",
"remaining",
"(",
")",
")",
"?",
"remaining",
"(",
")",
":",
"otherBuffer",
".",
"remaining",
"(",... | Compares the remaining ints of this buffer to another int buffer's remaining ints.
@param otherBuffer another int buffer.
@return a negative value if this is less than {@code other}; 0 if this equals to {@code
other}; a positive value if this is greater than {@code other}.
@exception ClassCastException if {@code other... | [
"Compares",
"the",
"remaining",
"ints",
"of",
"this",
"buffer",
"to",
"another",
"int",
"buffer",
"s",
"remaining",
"ints",
"."
] | 7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66 | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/html/src/playn/super/java/nio/IntBuffer.java#L96-L115 |
48,336 | playn/playn | core/src/playn/core/TextFormat.java | TextFormat.withFont | public TextFormat withFont(String name, Font.Style style, float size) {
return withFont(new Font(name, style, size));
} | java | public TextFormat withFont(String name, Font.Style style, float size) {
return withFont(new Font(name, style, size));
} | [
"public",
"TextFormat",
"withFont",
"(",
"String",
"name",
",",
"Font",
".",
"Style",
"style",
",",
"float",
"size",
")",
"{",
"return",
"withFont",
"(",
"new",
"Font",
"(",
"name",
",",
"style",
",",
"size",
")",
")",
";",
"}"
] | Returns a clone of this text format with the font configured as specified. | [
"Returns",
"a",
"clone",
"of",
"this",
"text",
"format",
"with",
"the",
"font",
"configured",
"as",
"specified",
"."
] | 7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66 | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/core/src/playn/core/TextFormat.java#L51-L53 |
48,337 | playn/playn | core/src/playn/core/Assets.java | Assets.getImageSync | public Image getImageSync (String path) {
ImageImpl image = createImage(false, 0, 0, path);
try {
image.succeed(load(path));
} catch (Throwable t) {
image.fail(t);
}
return image;
} | java | public Image getImageSync (String path) {
ImageImpl image = createImage(false, 0, 0, path);
try {
image.succeed(load(path));
} catch (Throwable t) {
image.fail(t);
}
return image;
} | [
"public",
"Image",
"getImageSync",
"(",
"String",
"path",
")",
"{",
"ImageImpl",
"image",
"=",
"createImage",
"(",
"false",
",",
"0",
",",
"0",
",",
"path",
")",
";",
"try",
"{",
"image",
".",
"succeed",
"(",
"load",
"(",
"path",
")",
")",
";",
"}"... | Synchronously loads and returns an image. The calling thread will block while the image is
loaded from disk and decoded. When this call returns, the image's width and height will be
valid, and the image can be immediately converted to a texture and drawn into a canvas.
@param path the path to the image asset.
@throws ... | [
"Synchronously",
"loads",
"and",
"returns",
"an",
"image",
".",
"The",
"calling",
"thread",
"will",
"block",
"while",
"the",
"image",
"is",
"loaded",
"from",
"disk",
"and",
"decoded",
".",
"When",
"this",
"call",
"returns",
"the",
"image",
"s",
"width",
"a... | 7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66 | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/core/src/playn/core/Assets.java#L37-L45 |
48,338 | playn/playn | core/src/playn/core/Assets.java | Assets.getText | public RFuture<String> getText (final String path) {
final RPromise<String> result = exec.deferredPromise();
exec.invokeAsync(new Runnable() {
public void run () {
try {
result.succeed(getTextSync(path));
} catch (Throwable t) {
result.fail(t);
}
}
});... | java | public RFuture<String> getText (final String path) {
final RPromise<String> result = exec.deferredPromise();
exec.invokeAsync(new Runnable() {
public void run () {
try {
result.succeed(getTextSync(path));
} catch (Throwable t) {
result.fail(t);
}
}
});... | [
"public",
"RFuture",
"<",
"String",
">",
"getText",
"(",
"final",
"String",
"path",
")",
"{",
"final",
"RPromise",
"<",
"String",
">",
"result",
"=",
"exec",
".",
"deferredPromise",
"(",
")",
";",
"exec",
".",
"invokeAsync",
"(",
"new",
"Runnable",
"(",
... | Loads UTF-8 encoded text asynchronously. The returned state instance provides a means to
listen for the arrival of the text.
@param path the path to the text asset. | [
"Loads",
"UTF",
"-",
"8",
"encoded",
"text",
"asynchronously",
".",
"The",
"returned",
"state",
"instance",
"provides",
"a",
"means",
"to",
"listen",
"for",
"the",
"arrival",
"of",
"the",
"text",
"."
] | 7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66 | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/core/src/playn/core/Assets.java#L135-L147 |
48,339 | playn/playn | core/src/playn/core/Assets.java | Assets.getBytes | public RFuture<ByteBuffer> getBytes (final String path) {
final RPromise<ByteBuffer> result = exec.deferredPromise();
exec.invokeAsync(new Runnable() {
public void run () {
try {
result.succeed(getBytesSync(path));
} catch (Throwable t) {
result.fail(t);
}
... | java | public RFuture<ByteBuffer> getBytes (final String path) {
final RPromise<ByteBuffer> result = exec.deferredPromise();
exec.invokeAsync(new Runnable() {
public void run () {
try {
result.succeed(getBytesSync(path));
} catch (Throwable t) {
result.fail(t);
}
... | [
"public",
"RFuture",
"<",
"ByteBuffer",
">",
"getBytes",
"(",
"final",
"String",
"path",
")",
"{",
"final",
"RPromise",
"<",
"ByteBuffer",
">",
"result",
"=",
"exec",
".",
"deferredPromise",
"(",
")",
";",
"exec",
".",
"invokeAsync",
"(",
"new",
"Runnable"... | Loads binary data asynchronously. The returned state instance provides a means to listen for
the arrival of the data.
@param path the path to the binary asset. | [
"Loads",
"binary",
"data",
"asynchronously",
".",
"The",
"returned",
"state",
"instance",
"provides",
"a",
"means",
"to",
"listen",
"for",
"the",
"arrival",
"of",
"the",
"data",
"."
] | 7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66 | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/core/src/playn/core/Assets.java#L165-L177 |
48,340 | playn/playn | html/src/playn/html/HtmlInput.java | HtmlInput.getRelativeX | static float getRelativeX (NativeEvent e, Element target) {
return (e.getClientX() - target.getAbsoluteLeft() + target.getScrollLeft() +
target.getOwnerDocument().getScrollLeft()) / HtmlGraphics.experimentalScale;
} | java | static float getRelativeX (NativeEvent e, Element target) {
return (e.getClientX() - target.getAbsoluteLeft() + target.getScrollLeft() +
target.getOwnerDocument().getScrollLeft()) / HtmlGraphics.experimentalScale;
} | [
"static",
"float",
"getRelativeX",
"(",
"NativeEvent",
"e",
",",
"Element",
"target",
")",
"{",
"return",
"(",
"e",
".",
"getClientX",
"(",
")",
"-",
"target",
".",
"getAbsoluteLeft",
"(",
")",
"+",
"target",
".",
"getScrollLeft",
"(",
")",
"+",
"target"... | Gets the event's x-position relative to a given element.
@param e native event
@param target the element whose coordinate system is to be used
@return the relative x-position | [
"Gets",
"the",
"event",
"s",
"x",
"-",
"position",
"relative",
"to",
"a",
"given",
"element",
"."
] | 7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66 | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/html/src/playn/html/HtmlInput.java#L311-L314 |
48,341 | playn/playn | html/src/playn/html/HtmlInput.java | HtmlInput.getRelativeY | static float getRelativeY (NativeEvent e, Element target) {
return (e.getClientY() - target.getAbsoluteTop() + target.getScrollTop() +
target.getOwnerDocument().getScrollTop()) / HtmlGraphics.experimentalScale;
} | java | static float getRelativeY (NativeEvent e, Element target) {
return (e.getClientY() - target.getAbsoluteTop() + target.getScrollTop() +
target.getOwnerDocument().getScrollTop()) / HtmlGraphics.experimentalScale;
} | [
"static",
"float",
"getRelativeY",
"(",
"NativeEvent",
"e",
",",
"Element",
"target",
")",
"{",
"return",
"(",
"e",
".",
"getClientY",
"(",
")",
"-",
"target",
".",
"getAbsoluteTop",
"(",
")",
"+",
"target",
".",
"getScrollTop",
"(",
")",
"+",
"target",
... | Gets the event's y-position relative to a given element.
@param e native event
@param target the element whose coordinate system is to be used
@return the relative y-position | [
"Gets",
"the",
"event",
"s",
"y",
"-",
"position",
"relative",
"to",
"a",
"given",
"element",
"."
] | 7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66 | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/html/src/playn/html/HtmlInput.java#L323-L326 |
48,342 | playn/playn | core/src/playn/core/ImageImpl.java | ImageImpl.succeed | public synchronized void succeed (Data data) {
scale = data.scale;
pixelWidth = data.pixelWidth;
assert pixelWidth > 0;
pixelHeight = data.pixelHeight;
assert pixelHeight > 0;
setBitmap(data.bitmap);
((RPromise<Image>)state).succeed(this); // state is a deferred promise
} | java | public synchronized void succeed (Data data) {
scale = data.scale;
pixelWidth = data.pixelWidth;
assert pixelWidth > 0;
pixelHeight = data.pixelHeight;
assert pixelHeight > 0;
setBitmap(data.bitmap);
((RPromise<Image>)state).succeed(this); // state is a deferred promise
} | [
"public",
"synchronized",
"void",
"succeed",
"(",
"Data",
"data",
")",
"{",
"scale",
"=",
"data",
".",
"scale",
";",
"pixelWidth",
"=",
"data",
".",
"pixelWidth",
";",
"assert",
"pixelWidth",
">",
"0",
";",
"pixelHeight",
"=",
"data",
".",
"pixelHeight",
... | Notifies this image that its implementation bitmap is available.
This can be called from any thread. | [
"Notifies",
"this",
"image",
"that",
"its",
"implementation",
"bitmap",
"is",
"available",
".",
"This",
"can",
"be",
"called",
"from",
"any",
"thread",
"."
] | 7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66 | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/core/src/playn/core/ImageImpl.java#L43-L51 |
48,343 | playn/playn | core/src/playn/core/ImageImpl.java | ImageImpl.fail | public synchronized void fail (Throwable error) {
if (pixelWidth == 0) pixelWidth = 50;
if (pixelHeight == 0) pixelHeight = 50;
setBitmap(createErrorBitmap(pixelWidth, pixelHeight));
((RPromise<Image>)state).fail(error); // state is a deferred promise
} | java | public synchronized void fail (Throwable error) {
if (pixelWidth == 0) pixelWidth = 50;
if (pixelHeight == 0) pixelHeight = 50;
setBitmap(createErrorBitmap(pixelWidth, pixelHeight));
((RPromise<Image>)state).fail(error); // state is a deferred promise
} | [
"public",
"synchronized",
"void",
"fail",
"(",
"Throwable",
"error",
")",
"{",
"if",
"(",
"pixelWidth",
"==",
"0",
")",
"pixelWidth",
"=",
"50",
";",
"if",
"(",
"pixelHeight",
"==",
"0",
")",
"pixelHeight",
"=",
"50",
";",
"setBitmap",
"(",
"createErrorB... | Notifies this image that its implementation bitmap failed to load.
This can be called from any thread. | [
"Notifies",
"this",
"image",
"that",
"its",
"implementation",
"bitmap",
"failed",
"to",
"load",
".",
"This",
"can",
"be",
"called",
"from",
"any",
"thread",
"."
] | 7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66 | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/core/src/playn/core/ImageImpl.java#L55-L60 |
48,344 | playn/playn | html/src/playn/appcachelinker/AppCacheLinker.java | AppCacheLinker.accept | protected boolean accept(String path) {
// GWT Development Mode files
if (path.equals("hosted.html") || path.endsWith(".devmode.js")) {
return false;
}
// Default or welcome file
if (path.equals("/")) {
return true;
}
// Whitelisted file extension
int pos = path.lastIndexO... | java | protected boolean accept(String path) {
// GWT Development Mode files
if (path.equals("hosted.html") || path.endsWith(".devmode.js")) {
return false;
}
// Default or welcome file
if (path.equals("/")) {
return true;
}
// Whitelisted file extension
int pos = path.lastIndexO... | [
"protected",
"boolean",
"accept",
"(",
"String",
"path",
")",
"{",
"// GWT Development Mode files",
"if",
"(",
"path",
".",
"equals",
"(",
"\"hosted.html\"",
")",
"||",
"path",
".",
"endsWith",
"(",
"\".devmode.js\"",
")",
")",
"{",
"return",
"false",
";",
"... | Determines whether our not the given should be included in the app cache
manifest. Subclasses may override this method in order to filter out
specific file patterns.
@param path the path of the resource being considered
@return true if the file should be included in the manifest | [
"Determines",
"whether",
"our",
"not",
"the",
"given",
"should",
"be",
"included",
"in",
"the",
"app",
"cache",
"manifest",
".",
"Subclasses",
"may",
"override",
"this",
"method",
"in",
"order",
"to",
"filter",
"out",
"specific",
"file",
"patterns",
"."
] | 7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66 | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/html/src/playn/appcachelinker/AppCacheLinker.java#L99-L122 |
48,345 | playn/playn | core/src/playn/core/Graphics.java | Graphics.createTexture | public Texture createTexture (float width, float height, Texture.Config config) {
int texWidth = config.toTexWidth(scale.scaledCeil(width));
int texHeight = config.toTexHeight(scale.scaledCeil(height));
if (texWidth <= 0 || texHeight <= 0) throw new IllegalArgumentException(
"Invalid texture size: " +... | java | public Texture createTexture (float width, float height, Texture.Config config) {
int texWidth = config.toTexWidth(scale.scaledCeil(width));
int texHeight = config.toTexHeight(scale.scaledCeil(height));
if (texWidth <= 0 || texHeight <= 0) throw new IllegalArgumentException(
"Invalid texture size: " +... | [
"public",
"Texture",
"createTexture",
"(",
"float",
"width",
",",
"float",
"height",
",",
"Texture",
".",
"Config",
"config",
")",
"{",
"int",
"texWidth",
"=",
"config",
".",
"toTexWidth",
"(",
"scale",
".",
"scaledCeil",
"(",
"width",
")",
")",
";",
"in... | Creates an empty texture into which one can render. The supplied width and height are in
display units and will be converted to pixels based on the current scale factor. | [
"Creates",
"an",
"empty",
"texture",
"into",
"which",
"one",
"can",
"render",
".",
"The",
"supplied",
"width",
"and",
"height",
"are",
"in",
"display",
"units",
"and",
"will",
"be",
"converted",
"to",
"pixels",
"based",
"on",
"the",
"current",
"scale",
"fa... | 7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66 | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/core/src/playn/core/Graphics.java#L124-L134 |
48,346 | playn/playn | core/src/playn/core/Graphics.java | Graphics.viewportChanged | protected void viewportChanged (int pixelWidth, int pixelHeight) {
viewPixelWidth = pixelWidth;
viewPixelHeight = pixelHeight;
viewSizeM.width = scale.invScaled(pixelWidth);
viewSizeM.height = scale.invScaled(pixelHeight);
plat.log().info("viewPortChanged " + pixelWidth + "x" + pixelHeight + " / " +... | java | protected void viewportChanged (int pixelWidth, int pixelHeight) {
viewPixelWidth = pixelWidth;
viewPixelHeight = pixelHeight;
viewSizeM.width = scale.invScaled(pixelWidth);
viewSizeM.height = scale.invScaled(pixelHeight);
plat.log().info("viewPortChanged " + pixelWidth + "x" + pixelHeight + " / " +... | [
"protected",
"void",
"viewportChanged",
"(",
"int",
"pixelWidth",
",",
"int",
"pixelHeight",
")",
"{",
"viewPixelWidth",
"=",
"pixelWidth",
";",
"viewPixelHeight",
"=",
"pixelHeight",
";",
"viewSizeM",
".",
"width",
"=",
"scale",
".",
"invScaled",
"(",
"pixelWid... | Informs the graphics system that the main framebuffer size has changed. The supplied size
should be in physical pixels. | [
"Informs",
"the",
"graphics",
"system",
"that",
"the",
"main",
"framebuffer",
"size",
"has",
"changed",
".",
"The",
"supplied",
"size",
"should",
"be",
"in",
"physical",
"pixels",
"."
] | 7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66 | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/core/src/playn/core/Graphics.java#L196-L203 |
48,347 | playn/playn | html/src/playn/super/java/nio/ShortBuffer.java | ShortBuffer.allocate | public static ShortBuffer allocate (int capacity) {
if (capacity < 0) {
throw new IllegalArgumentException();
}
ByteBuffer bb = ByteBuffer.allocateDirect(capacity * 2);
bb.order(ByteOrder.nativeOrder());
return bb.asShortBuffer();
} | java | public static ShortBuffer allocate (int capacity) {
if (capacity < 0) {
throw new IllegalArgumentException();
}
ByteBuffer bb = ByteBuffer.allocateDirect(capacity * 2);
bb.order(ByteOrder.nativeOrder());
return bb.asShortBuffer();
} | [
"public",
"static",
"ShortBuffer",
"allocate",
"(",
"int",
"capacity",
")",
"{",
"if",
"(",
"capacity",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
")",
";",
"}",
"ByteBuffer",
"bb",
"=",
"ByteBuffer",
".",
"allocateDirect",
"(",
"... | Creates a short buffer based on a newly allocated short array.
@param capacity the capacity of the new buffer.
@return the created short buffer.
@throws IllegalArgumentException if {@code capacity} is less than zero. | [
"Creates",
"a",
"short",
"buffer",
"based",
"on",
"a",
"newly",
"allocated",
"short",
"array",
"."
] | 7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66 | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/html/src/playn/super/java/nio/ShortBuffer.java#L49-L56 |
48,348 | playn/playn | core/src/playn/core/json/JsonParser.java | JsonParser.parse | @SuppressWarnings("unchecked")
<T> T parse(Class<T> clazz) throws JsonParserException {
advanceToken();
Object parsed = currentValue();
if (advanceToken() != Token.EOF)
throw createParseException(null, "Expected end of input, got " + token, true);
if (clazz != Object.class && (parsed == null || ... | java | @SuppressWarnings("unchecked")
<T> T parse(Class<T> clazz) throws JsonParserException {
advanceToken();
Object parsed = currentValue();
if (advanceToken() != Token.EOF)
throw createParseException(null, "Expected end of input, got " + token, true);
if (clazz != Object.class && (parsed == null || ... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"<",
"T",
">",
"T",
"parse",
"(",
"Class",
"<",
"T",
">",
"clazz",
")",
"throws",
"JsonParserException",
"{",
"advanceToken",
"(",
")",
";",
"Object",
"parsed",
"=",
"currentValue",
"(",
")",
";",
"if",... | Parse a single JSON value from the string, expecting an EOF at the end. | [
"Parse",
"a",
"single",
"JSON",
"value",
"from",
"the",
"string",
"expecting",
"an",
"EOF",
"at",
"the",
"end",
"."
] | 7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66 | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/core/src/playn/core/json/JsonParser.java#L120-L130 |
48,349 | playn/playn | core/src/playn/core/json/JsonParser.java | JsonParser.currentValue | private Object currentValue() throws JsonParserException {
// Only a value start token should appear when we're in the context of parsing a JSON value
if (token.isValue)
return value;
throw createParseException(null, "Expected JSON value, got " + token, true);
} | java | private Object currentValue() throws JsonParserException {
// Only a value start token should appear when we're in the context of parsing a JSON value
if (token.isValue)
return value;
throw createParseException(null, "Expected JSON value, got " + token, true);
} | [
"private",
"Object",
"currentValue",
"(",
")",
"throws",
"JsonParserException",
"{",
"// Only a value start token should appear when we're in the context of parsing a JSON value",
"if",
"(",
"token",
".",
"isValue",
")",
"return",
"value",
";",
"throw",
"createParseException",
... | Starts parsing a JSON value at the current token position. | [
"Starts",
"parsing",
"a",
"JSON",
"value",
"at",
"the",
"current",
"token",
"position",
"."
] | 7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66 | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/core/src/playn/core/json/JsonParser.java#L135-L140 |
48,350 | playn/playn | core/src/playn/core/json/JsonParser.java | JsonParser.consumeKeyword | private void consumeKeyword(char first, char[] expected) throws JsonParserException {
for (int i = 0; i < expected.length; i++)
if (advanceChar() != expected[i])
throw createHelpfulException(first, expected, i);
// The token should end with something other than an ASCII letter
if (isAsciiLett... | java | private void consumeKeyword(char first, char[] expected) throws JsonParserException {
for (int i = 0; i < expected.length; i++)
if (advanceChar() != expected[i])
throw createHelpfulException(first, expected, i);
// The token should end with something other than an ASCII letter
if (isAsciiLett... | [
"private",
"void",
"consumeKeyword",
"(",
"char",
"first",
",",
"char",
"[",
"]",
"expected",
")",
"throws",
"JsonParserException",
"{",
"for",
"(",
"int",
"i",
"=",
"0",
";",
"i",
"<",
"expected",
".",
"length",
";",
"i",
"++",
")",
"if",
"(",
"adva... | Expects a given string at the current position. | [
"Expects",
"a",
"given",
"string",
"at",
"the",
"current",
"position",
"."
] | 7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66 | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/core/src/playn/core/json/JsonParser.java#L245-L253 |
48,351 | playn/playn | core/src/playn/core/json/JsonParser.java | JsonParser.stringChar | private char stringChar() throws JsonParserException {
int c = advanceChar();
if (c == -1)
throw createParseException(null, "String was not terminated before end of input", true);
if (c < 32)
throw createParseException(null,
"Strings may not contain control characters: 0x" + Integer.to... | java | private char stringChar() throws JsonParserException {
int c = advanceChar();
if (c == -1)
throw createParseException(null, "String was not terminated before end of input", true);
if (c < 32)
throw createParseException(null,
"Strings may not contain control characters: 0x" + Integer.to... | [
"private",
"char",
"stringChar",
"(",
")",
"throws",
"JsonParserException",
"{",
"int",
"c",
"=",
"advanceChar",
"(",
")",
";",
"if",
"(",
"c",
"==",
"-",
"1",
")",
"throw",
"createParseException",
"(",
"null",
",",
"\"String was not terminated before end of inp... | Advances a character, throwing if it is illegal in the context of a JSON string. | [
"Advances",
"a",
"character",
"throwing",
"if",
"it",
"is",
"illegal",
"in",
"the",
"context",
"of",
"a",
"JSON",
"string",
"."
] | 7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66 | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/core/src/playn/core/json/JsonParser.java#L373-L381 |
48,352 | playn/playn | core/src/playn/core/json/JsonParser.java | JsonParser.stringHexChar | private int stringHexChar() throws JsonParserException {
// GWT-compatible Character.digit(char, int)
int c = "0123456789abcdef0123456789ABCDEF".indexOf(advanceChar()) % 16;
if (c == -1)
throw createParseException(null, "Expected unicode hex escape character", false);
return c;
} | java | private int stringHexChar() throws JsonParserException {
// GWT-compatible Character.digit(char, int)
int c = "0123456789abcdef0123456789ABCDEF".indexOf(advanceChar()) % 16;
if (c == -1)
throw createParseException(null, "Expected unicode hex escape character", false);
return c;
} | [
"private",
"int",
"stringHexChar",
"(",
")",
"throws",
"JsonParserException",
"{",
"// GWT-compatible Character.digit(char, int)",
"int",
"c",
"=",
"\"0123456789abcdef0123456789ABCDEF\"",
".",
"indexOf",
"(",
"advanceChar",
"(",
")",
")",
"%",
"16",
";",
"if",
"(",
... | Advances a character, throwing if it is illegal in the context of a JSON string hex unicode escape. | [
"Advances",
"a",
"character",
"throwing",
"if",
"it",
"is",
"illegal",
"in",
"the",
"context",
"of",
"a",
"JSON",
"string",
"hex",
"unicode",
"escape",
"."
] | 7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66 | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/core/src/playn/core/json/JsonParser.java#L386-L392 |
48,353 | playn/playn | core/src/playn/core/json/JsonParser.java | JsonParser.createHelpfulException | private JsonParserException createHelpfulException(char first, char[] expected, int failurePosition)
throws JsonParserException {
// Build the first part of the token
StringBuilder errorToken = new StringBuilder(first
+ (expected == null ? "" : new String(expected, 0, failurePosition)));
// C... | java | private JsonParserException createHelpfulException(char first, char[] expected, int failurePosition)
throws JsonParserException {
// Build the first part of the token
StringBuilder errorToken = new StringBuilder(first
+ (expected == null ? "" : new String(expected, 0, failurePosition)));
// C... | [
"private",
"JsonParserException",
"createHelpfulException",
"(",
"char",
"first",
",",
"char",
"[",
"]",
"expected",
",",
"int",
"failurePosition",
")",
"throws",
"JsonParserException",
"{",
"// Build the first part of the token",
"StringBuilder",
"errorToken",
"=",
"new"... | Throws a helpful exception based on the current alphanumeric token. | [
"Throws",
"a",
"helpful",
"exception",
"based",
"on",
"the",
"current",
"alphanumeric",
"token",
"."
] | 7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66 | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/core/src/playn/core/json/JsonParser.java#L445-L457 |
48,354 | playn/playn | scene/src/playn/scene/Interaction.java | Interaction.capture | public void capture (CaptureMode mode) {
assert dispatchLayer != null;
if (canceled) throw new IllegalStateException("Cannot capture canceled interaction.");
if (capturingLayer != dispatchLayer && captured()) throw new IllegalStateException(
"Interaction already captured by " + capturingLayer);
ca... | java | public void capture (CaptureMode mode) {
assert dispatchLayer != null;
if (canceled) throw new IllegalStateException("Cannot capture canceled interaction.");
if (capturingLayer != dispatchLayer && captured()) throw new IllegalStateException(
"Interaction already captured by " + capturingLayer);
ca... | [
"public",
"void",
"capture",
"(",
"CaptureMode",
"mode",
")",
"{",
"assert",
"dispatchLayer",
"!=",
"null",
";",
"if",
"(",
"canceled",
")",
"throw",
"new",
"IllegalStateException",
"(",
"\"Cannot capture canceled interaction.\"",
")",
";",
"if",
"(",
"capturingLa... | Captures this interaction in the specified capture mode. Depending on the mode, subsequent
events will go only to the current layer, or that layer and its parents, or that layer and
its children. Other layers in the interaction will receive a cancellation event and nothing
further. | [
"Captures",
"this",
"interaction",
"in",
"the",
"specified",
"capture",
"mode",
".",
"Depending",
"on",
"the",
"mode",
"subsequent",
"events",
"will",
"go",
"only",
"to",
"the",
"current",
"layer",
"or",
"that",
"layer",
"and",
"its",
"parents",
"or",
"that"... | 7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66 | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/scene/src/playn/scene/Interaction.java#L80-L88 |
48,355 | playn/playn | core/src/playn/core/GLBatch.java | GLBatch.begin | public void begin (float fbufWidth, float fbufHeight, boolean flip) {
if (begun) throw new IllegalStateException(getClass().getSimpleName() + " mismatched begin()");
begun = true;
} | java | public void begin (float fbufWidth, float fbufHeight, boolean flip) {
if (begun) throw new IllegalStateException(getClass().getSimpleName() + " mismatched begin()");
begun = true;
} | [
"public",
"void",
"begin",
"(",
"float",
"fbufWidth",
",",
"float",
"fbufHeight",
",",
"boolean",
"flip",
")",
"{",
"if",
"(",
"begun",
")",
"throw",
"new",
"IllegalStateException",
"(",
"getClass",
"(",
")",
".",
"getSimpleName",
"(",
")",
"+",
"\" mismat... | Must be called before this batch is used to accumulate and send drawing commands.
@param flip whether or not to flip the y-axis. This is generally true when rendering to the
default frame buffer (the screen), and false when rendering to textures. | [
"Must",
"be",
"called",
"before",
"this",
"batch",
"is",
"used",
"to",
"accumulate",
"and",
"send",
"drawing",
"commands",
"."
] | 7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66 | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/core/src/playn/core/GLBatch.java#L32-L35 |
48,356 | playn/playn | robovm/src/playn/robovm/RoboFont.java | RoboFont.registerVariant | public static void registerVariant(String name, Style style, String variantName) {
Map<String,String> styleVariants = _variants.get(style);
if (styleVariants == null) {
_variants.put(style, styleVariants = new HashMap<String,String>());
}
styleVariants.put(name, variantName);
} | java | public static void registerVariant(String name, Style style, String variantName) {
Map<String,String> styleVariants = _variants.get(style);
if (styleVariants == null) {
_variants.put(style, styleVariants = new HashMap<String,String>());
}
styleVariants.put(name, variantName);
} | [
"public",
"static",
"void",
"registerVariant",
"(",
"String",
"name",
",",
"Style",
"style",
",",
"String",
"variantName",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"styleVariants",
"=",
"_variants",
".",
"get",
"(",
"style",
")",
";",
"if",
"(... | Registers a font for use when a bold, italic or bold italic variant is requested. iOS does not
programmatically generate bold, italic and bold italic variants of fonts. Instead it uses the
actual bold, italic or bold italic variant of the font provided by the original designer.
<p> The built-in iOS fonts (Helvetica, C... | [
"Registers",
"a",
"font",
"for",
"use",
"when",
"a",
"bold",
"italic",
"or",
"bold",
"italic",
"variant",
"is",
"requested",
".",
"iOS",
"does",
"not",
"programmatically",
"generate",
"bold",
"italic",
"and",
"bold",
"italic",
"variants",
"of",
"fonts",
".",... | 7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66 | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/robovm/src/playn/robovm/RoboFont.java#L41-L47 |
48,357 | playn/playn | html/src/playn/super/java/nio/FloatBuffer.java | FloatBuffer.allocate | public static FloatBuffer allocate (int capacity) {
if (capacity < 0) {
throw new IllegalArgumentException();
}
ByteBuffer bb = ByteBuffer.allocateDirect(capacity * 4);
bb.order(ByteOrder.nativeOrder());
return bb.asFloatBuffer();
} | java | public static FloatBuffer allocate (int capacity) {
if (capacity < 0) {
throw new IllegalArgumentException();
}
ByteBuffer bb = ByteBuffer.allocateDirect(capacity * 4);
bb.order(ByteOrder.nativeOrder());
return bb.asFloatBuffer();
} | [
"public",
"static",
"FloatBuffer",
"allocate",
"(",
"int",
"capacity",
")",
"{",
"if",
"(",
"capacity",
"<",
"0",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
")",
";",
"}",
"ByteBuffer",
"bb",
"=",
"ByteBuffer",
".",
"allocateDirect",
"(",
"... | Creates a float buffer based on a newly allocated float array.
@param capacity the capacity of the new buffer.
@return the created float buffer.
@throws IllegalArgumentException if {@code capacity} is less than zero. | [
"Creates",
"a",
"float",
"buffer",
"based",
"on",
"a",
"newly",
"allocated",
"float",
"array",
"."
] | 7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66 | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/html/src/playn/super/java/nio/FloatBuffer.java#L50-L57 |
48,358 | playn/playn | html/src/playn/super/java/nio/FloatBuffer.java | FloatBuffer.compareTo | public int compareTo (FloatBuffer otherBuffer) {
int compareRemaining = (remaining() < otherBuffer.remaining()) ?
remaining() : otherBuffer.remaining();
int thisPos = position;
int otherPos = otherBuffer.position;
// BEGIN android-changed
float thisFloat, otherFloat;
... | java | public int compareTo (FloatBuffer otherBuffer) {
int compareRemaining = (remaining() < otherBuffer.remaining()) ?
remaining() : otherBuffer.remaining();
int thisPos = position;
int otherPos = otherBuffer.position;
// BEGIN android-changed
float thisFloat, otherFloat;
... | [
"public",
"int",
"compareTo",
"(",
"FloatBuffer",
"otherBuffer",
")",
"{",
"int",
"compareRemaining",
"=",
"(",
"remaining",
"(",
")",
"<",
"otherBuffer",
".",
"remaining",
"(",
")",
")",
"?",
"remaining",
"(",
")",
":",
"otherBuffer",
".",
"remaining",
"(... | Compare the remaining floats of this buffer to another float buffer's remaining floats.
@param otherBuffer another float buffer.
@return a negative value if this is less than {@code otherBuffer}; 0 if this equals to
{@code otherBuffer}; a positive value if this is greater than {@code otherBuffer}.
@exception ClassCast... | [
"Compare",
"the",
"remaining",
"floats",
"of",
"this",
"buffer",
"to",
"another",
"float",
"buffer",
"s",
"remaining",
"floats",
"."
] | 7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66 | https://github.com/playn/playn/blob/7e7a9d048ba6afe550dc0cdeaca3e1d5b0d01c66/html/src/playn/super/java/nio/FloatBuffer.java#L93-L114 |
48,359 | pinterest/secor | src/main/java/com/pinterest/secor/util/ThriftUtil.java | ThriftUtil.getMessageClass | @SuppressWarnings("rawtypes")
public Class<? extends TBase> getMessageClass(String topic) {
return allTopics ? messageClassForAll : messageClassByTopic.get(topic);
} | java | @SuppressWarnings("rawtypes")
public Class<? extends TBase> getMessageClass(String topic) {
return allTopics ? messageClassForAll : messageClassByTopic.get(topic);
} | [
"@",
"SuppressWarnings",
"(",
"\"rawtypes\"",
")",
"public",
"Class",
"<",
"?",
"extends",
"TBase",
">",
"getMessageClass",
"(",
"String",
"topic",
")",
"{",
"return",
"allTopics",
"?",
"messageClassForAll",
":",
"messageClassByTopic",
".",
"get",
"(",
"topic",
... | Returns configured thrift message class for the given Kafka topic
@param topic
Kafka topic
@return thrift message class used by this utility instance, or
<code>null</code> in case valid class couldn't be found in the
configuration. | [
"Returns",
"configured",
"thrift",
"message",
"class",
"for",
"the",
"given",
"Kafka",
"topic"
] | 4099ff061db392f11044e57dedf46c1617895278 | https://github.com/pinterest/secor/blob/4099ff061db392f11044e57dedf46c1617895278/src/main/java/com/pinterest/secor/util/ThriftUtil.java#L120-L123 |
48,360 | pinterest/secor | src/main/java/com/pinterest/secor/uploader/Uploader.java | Uploader.init | public void init(SecorConfig config, OffsetTracker offsetTracker, FileRegistry fileRegistry,
UploadManager uploadManager, MessageReader messageReader, MetricCollector metricCollector,
DeterministicUploadPolicyTracker deterministicUploadPolicyTracker) {
init(config, offs... | java | public void init(SecorConfig config, OffsetTracker offsetTracker, FileRegistry fileRegistry,
UploadManager uploadManager, MessageReader messageReader, MetricCollector metricCollector,
DeterministicUploadPolicyTracker deterministicUploadPolicyTracker) {
init(config, offs... | [
"public",
"void",
"init",
"(",
"SecorConfig",
"config",
",",
"OffsetTracker",
"offsetTracker",
",",
"FileRegistry",
"fileRegistry",
",",
"UploadManager",
"uploadManager",
",",
"MessageReader",
"messageReader",
",",
"MetricCollector",
"metricCollector",
",",
"Deterministic... | Init the Uploader with its dependent objects.
@param config Secor configuration
@param offsetTracker Tracker of the current offset of topics partitions
@param fileRegistry Registry of log files on a per-topic and per-partition basis
@param uploadManager Manager of the physical upload of log files to the remote reposit... | [
"Init",
"the",
"Uploader",
"with",
"its",
"dependent",
"objects",
"."
] | 4099ff061db392f11044e57dedf46c1617895278 | https://github.com/pinterest/secor/blob/4099ff061db392f11044e57dedf46c1617895278/src/main/java/com/pinterest/secor/uploader/Uploader.java#L79-L84 |
48,361 | pinterest/secor | src/main/java/com/pinterest/secor/uploader/Uploader.java | Uploader.init | public void init(SecorConfig config, OffsetTracker offsetTracker, FileRegistry fileRegistry,
UploadManager uploadManager, MessageReader messageReader,
ZookeeperConnector zookeeperConnector, MetricCollector metricCollector,
DeterministicUploadPolicyTracker d... | java | public void init(SecorConfig config, OffsetTracker offsetTracker, FileRegistry fileRegistry,
UploadManager uploadManager, MessageReader messageReader,
ZookeeperConnector zookeeperConnector, MetricCollector metricCollector,
DeterministicUploadPolicyTracker d... | [
"public",
"void",
"init",
"(",
"SecorConfig",
"config",
",",
"OffsetTracker",
"offsetTracker",
",",
"FileRegistry",
"fileRegistry",
",",
"UploadManager",
"uploadManager",
",",
"MessageReader",
"messageReader",
",",
"ZookeeperConnector",
"zookeeperConnector",
",",
"MetricC... | For testing use only. | [
"For",
"testing",
"use",
"only",
"."
] | 4099ff061db392f11044e57dedf46c1617895278 | https://github.com/pinterest/secor/blob/4099ff061db392f11044e57dedf46c1617895278/src/main/java/com/pinterest/secor/uploader/Uploader.java#L87-L103 |
48,362 | pinterest/secor | src/main/java/com/pinterest/secor/uploader/Uploader.java | Uploader.createReader | protected FileReader createReader(LogFilePath srcPath, CompressionCodec codec) throws Exception {
return ReflectionUtil.createFileReader(
mConfig.getFileReaderWriterFactory(),
srcPath,
codec,
mConfig
);
} | java | protected FileReader createReader(LogFilePath srcPath, CompressionCodec codec) throws Exception {
return ReflectionUtil.createFileReader(
mConfig.getFileReaderWriterFactory(),
srcPath,
codec,
mConfig
);
} | [
"protected",
"FileReader",
"createReader",
"(",
"LogFilePath",
"srcPath",
",",
"CompressionCodec",
"codec",
")",
"throws",
"Exception",
"{",
"return",
"ReflectionUtil",
".",
"createFileReader",
"(",
"mConfig",
".",
"getFileReaderWriterFactory",
"(",
")",
",",
"srcPath... | This method is intended to be overwritten in tests.
@param srcPath source Path
@param codec compression codec
@return FileReader created file reader
@throws Exception on error | [
"This",
"method",
"is",
"intended",
"to",
"be",
"overwritten",
"in",
"tests",
"."
] | 4099ff061db392f11044e57dedf46c1617895278 | https://github.com/pinterest/secor/blob/4099ff061db392f11044e57dedf46c1617895278/src/main/java/com/pinterest/secor/uploader/Uploader.java#L162-L169 |
48,363 | pinterest/secor | src/main/java/com/pinterest/secor/uploader/Uploader.java | Uploader.applyPolicy | public void applyPolicy(boolean forceUpload) throws Exception {
Collection<TopicPartition> topicPartitions = mFileRegistry.getTopicPartitions();
for (TopicPartition topicPartition : topicPartitions) {
checkTopicPartition(topicPartition, forceUpload);
}
} | java | public void applyPolicy(boolean forceUpload) throws Exception {
Collection<TopicPartition> topicPartitions = mFileRegistry.getTopicPartitions();
for (TopicPartition topicPartition : topicPartitions) {
checkTopicPartition(topicPartition, forceUpload);
}
} | [
"public",
"void",
"applyPolicy",
"(",
"boolean",
"forceUpload",
")",
"throws",
"Exception",
"{",
"Collection",
"<",
"TopicPartition",
">",
"topicPartitions",
"=",
"mFileRegistry",
".",
"getTopicPartitions",
"(",
")",
";",
"for",
"(",
"TopicPartition",
"topicPartitio... | Apply the Uploader policy for pushing partition files to the underlying storage.
For each of the partitions of the file registry, apply the policy for flushing
them to the underlying storage.
This method could be subclassed to provide an alternate policy. The custom uploader
class name would need to be specified in t... | [
"Apply",
"the",
"Uploader",
"policy",
"for",
"pushing",
"partition",
"files",
"to",
"the",
"underlying",
"storage",
"."
] | 4099ff061db392f11044e57dedf46c1617895278 | https://github.com/pinterest/secor/blob/4099ff061db392f11044e57dedf46c1617895278/src/main/java/com/pinterest/secor/uploader/Uploader.java#L317-L322 |
48,364 | pinterest/secor | src/main/java/com/pinterest/secor/io/impl/JsonORCFileReaderWriterFactory.java | JsonORCFileReaderWriterFactory.resolveCompression | private CompressionKind resolveCompression(CompressionCodec codec) {
if (codec instanceof Lz4Codec)
return CompressionKind.LZ4;
else if (codec instanceof SnappyCodec)
return CompressionKind.SNAPPY;
// although GZip and ZLIB are not same thing
// there is no better... | java | private CompressionKind resolveCompression(CompressionCodec codec) {
if (codec instanceof Lz4Codec)
return CompressionKind.LZ4;
else if (codec instanceof SnappyCodec)
return CompressionKind.SNAPPY;
// although GZip and ZLIB are not same thing
// there is no better... | [
"private",
"CompressionKind",
"resolveCompression",
"(",
"CompressionCodec",
"codec",
")",
"{",
"if",
"(",
"codec",
"instanceof",
"Lz4Codec",
")",
"return",
"CompressionKind",
".",
"LZ4",
";",
"else",
"if",
"(",
"codec",
"instanceof",
"SnappyCodec",
")",
"return",... | Used for returning the compression kind used in ORC
@param codec
@return | [
"Used",
"for",
"returning",
"the",
"compression",
"kind",
"used",
"in",
"ORC"
] | 4099ff061db392f11044e57dedf46c1617895278 | https://github.com/pinterest/secor/blob/4099ff061db392f11044e57dedf46c1617895278/src/main/java/com/pinterest/secor/io/impl/JsonORCFileReaderWriterFactory.java#L197-L209 |
48,365 | pinterest/secor | src/main/java/com/pinterest/secor/tools/LogFileVerifier.java | LogFileVerifier.createFileReader | private FileReader createFileReader(LogFilePath logFilePath) throws Exception {
CompressionCodec codec = null;
if (mConfig.getCompressionCodec() != null && !mConfig.getCompressionCodec().isEmpty()) {
codec = CompressionUtil.createCompressionCodec(mConfig.getCompressionCodec());
}
... | java | private FileReader createFileReader(LogFilePath logFilePath) throws Exception {
CompressionCodec codec = null;
if (mConfig.getCompressionCodec() != null && !mConfig.getCompressionCodec().isEmpty()) {
codec = CompressionUtil.createCompressionCodec(mConfig.getCompressionCodec());
}
... | [
"private",
"FileReader",
"createFileReader",
"(",
"LogFilePath",
"logFilePath",
")",
"throws",
"Exception",
"{",
"CompressionCodec",
"codec",
"=",
"null",
";",
"if",
"(",
"mConfig",
".",
"getCompressionCodec",
"(",
")",
"!=",
"null",
"&&",
"!",
"mConfig",
".",
... | Helper to create a file reader writer from config
@param logFilePath
@return
@throws Exception | [
"Helper",
"to",
"create",
"a",
"file",
"reader",
"writer",
"from",
"config"
] | 4099ff061db392f11044e57dedf46c1617895278 | https://github.com/pinterest/secor/blob/4099ff061db392f11044e57dedf46c1617895278/src/main/java/com/pinterest/secor/tools/LogFileVerifier.java#L203-L215 |
48,366 | pinterest/secor | src/main/java/com/pinterest/secor/util/ProtobufUtil.java | ProtobufUtil.getMessageClass | public Class<? extends Message> getMessageClass(String topic) {
return allTopics ? messageClassForAll : messageClassByTopic.get(topic);
} | java | public Class<? extends Message> getMessageClass(String topic) {
return allTopics ? messageClassForAll : messageClassByTopic.get(topic);
} | [
"public",
"Class",
"<",
"?",
"extends",
"Message",
">",
"getMessageClass",
"(",
"String",
"topic",
")",
"{",
"return",
"allTopics",
"?",
"messageClassForAll",
":",
"messageClassByTopic",
".",
"get",
"(",
"topic",
")",
";",
"}"
] | Returns configured protobuf message class for the given Kafka topic
@param topic
Kafka topic
@return protobuf message class used by this utility instance, or
<code>null</code> in case valid class couldn't be found in the
configuration. | [
"Returns",
"configured",
"protobuf",
"message",
"class",
"for",
"the",
"given",
"Kafka",
"topic"
] | 4099ff061db392f11044e57dedf46c1617895278 | https://github.com/pinterest/secor/blob/4099ff061db392f11044e57dedf46c1617895278/src/main/java/com/pinterest/secor/util/ProtobufUtil.java#L139-L141 |
48,367 | pinterest/secor | src/main/java/com/pinterest/secor/util/ProtobufUtil.java | ProtobufUtil.decodeProtobufMessage | public Message decodeProtobufMessage(String topic, byte[] payload){
Method parseMethod = allTopics ? messageParseMethodForAll : messageParseMethodByTopic.get(topic);
try {
return (Message) parseMethod.invoke(null, payload);
} catch (IllegalArgumentException e) {
throw new... | java | public Message decodeProtobufMessage(String topic, byte[] payload){
Method parseMethod = allTopics ? messageParseMethodForAll : messageParseMethodByTopic.get(topic);
try {
return (Message) parseMethod.invoke(null, payload);
} catch (IllegalArgumentException e) {
throw new... | [
"public",
"Message",
"decodeProtobufMessage",
"(",
"String",
"topic",
",",
"byte",
"[",
"]",
"payload",
")",
"{",
"Method",
"parseMethod",
"=",
"allTopics",
"?",
"messageParseMethodForAll",
":",
"messageParseMethodByTopic",
".",
"get",
"(",
"topic",
")",
";",
"t... | Decodes protobuf message
@param topic
Kafka topic name
@param payload
Byte array containing encoded protobuf
@return protobuf message instance
@throws RuntimeException
when there's problem decoding protobuf | [
"Decodes",
"protobuf",
"message"
] | 4099ff061db392f11044e57dedf46c1617895278 | https://github.com/pinterest/secor/blob/4099ff061db392f11044e57dedf46c1617895278/src/main/java/com/pinterest/secor/util/ProtobufUtil.java#L181-L194 |
48,368 | pinterest/secor | src/main/java/com/pinterest/secor/util/ProtobufUtil.java | ProtobufUtil.decodeProtobufOrJsonMessage | public Message decodeProtobufOrJsonMessage(String topic, byte[] payload) {
try {
if (shouldDecodeFromJsonMessage(topic)) {
return decodeJsonMessage(topic, payload);
}
} catch (InvalidProtocolBufferException e) {
//When trimming files, the Uploader will... | java | public Message decodeProtobufOrJsonMessage(String topic, byte[] payload) {
try {
if (shouldDecodeFromJsonMessage(topic)) {
return decodeJsonMessage(topic, payload);
}
} catch (InvalidProtocolBufferException e) {
//When trimming files, the Uploader will... | [
"public",
"Message",
"decodeProtobufOrJsonMessage",
"(",
"String",
"topic",
",",
"byte",
"[",
"]",
"payload",
")",
"{",
"try",
"{",
"if",
"(",
"shouldDecodeFromJsonMessage",
"(",
"topic",
")",
")",
"{",
"return",
"decodeJsonMessage",
"(",
"topic",
",",
"payloa... | Decodes protobuf message
If the secor.topic.message.format property is set to "JSON" for "topic" assume "payload" is JSON
@param topic
Kafka topic name
@param payload
Byte array containing encoded protobuf or JSON message
@return protobuf message instance
@throws RuntimeException
when there's problem decoding protobuf... | [
"Decodes",
"protobuf",
"message",
"If",
"the",
"secor",
".",
"topic",
".",
"message",
".",
"format",
"property",
"is",
"set",
"to",
"JSON",
"for",
"topic",
"assume",
"payload",
"is",
"JSON"
] | 4099ff061db392f11044e57dedf46c1617895278 | https://github.com/pinterest/secor/blob/4099ff061db392f11044e57dedf46c1617895278/src/main/java/com/pinterest/secor/util/ProtobufUtil.java#L208-L218 |
48,369 | pinterest/secor | src/main/java/com/pinterest/secor/util/ReflectionUtil.java | ReflectionUtil.createUploadManager | public static UploadManager createUploadManager(String className,
SecorConfig config) throws Exception {
Class<?> clazz = Class.forName(className);
if (!UploadManager.class.isAssignableFrom(clazz)) {
throw new IllegalArgumentException(Strin... | java | public static UploadManager createUploadManager(String className,
SecorConfig config) throws Exception {
Class<?> clazz = Class.forName(className);
if (!UploadManager.class.isAssignableFrom(clazz)) {
throw new IllegalArgumentException(Strin... | [
"public",
"static",
"UploadManager",
"createUploadManager",
"(",
"String",
"className",
",",
"SecorConfig",
"config",
")",
"throws",
"Exception",
"{",
"Class",
"<",
"?",
">",
"clazz",
"=",
"Class",
".",
"forName",
"(",
"className",
")",
";",
"if",
"(",
"!",
... | Create an UploadManager from its fully qualified class name.
The class passed in by name must be assignable to UploadManager
and have 1-parameter constructor accepting a SecorConfig.
See the secor.upload.manager.class config option.
@param className The class name of a subclass of UploadManager
@param config The Sec... | [
"Create",
"an",
"UploadManager",
"from",
"its",
"fully",
"qualified",
"class",
"name",
"."
] | 4099ff061db392f11044e57dedf46c1617895278 | https://github.com/pinterest/secor/blob/4099ff061db392f11044e57dedf46c1617895278/src/main/java/com/pinterest/secor/util/ReflectionUtil.java#L56-L66 |
48,370 | pinterest/secor | src/main/java/com/pinterest/secor/util/ReflectionUtil.java | ReflectionUtil.createUploader | public static Uploader createUploader(String className) throws Exception {
Class<?> clazz = Class.forName(className);
if (!Uploader.class.isAssignableFrom(clazz)) {
throw new IllegalArgumentException(String.format("The class '%s' is not assignable to '%s'.",
className, Up... | java | public static Uploader createUploader(String className) throws Exception {
Class<?> clazz = Class.forName(className);
if (!Uploader.class.isAssignableFrom(clazz)) {
throw new IllegalArgumentException(String.format("The class '%s' is not assignable to '%s'.",
className, Up... | [
"public",
"static",
"Uploader",
"createUploader",
"(",
"String",
"className",
")",
"throws",
"Exception",
"{",
"Class",
"<",
"?",
">",
"clazz",
"=",
"Class",
".",
"forName",
"(",
"className",
")",
";",
"if",
"(",
"!",
"Uploader",
".",
"class",
".",
"isAs... | Create an Uploader from its fully qualified class name.
The class passed in by name must be assignable to Uploader.
See the secor.upload.class config option.
@param className The class name of a subclass of Uploader
@return an UploadManager instance with the runtime type of the class passed by name
@throws Except... | [
"Create",
"an",
"Uploader",
"from",
"its",
"fully",
"qualified",
"class",
"name",
"."
] | 4099ff061db392f11044e57dedf46c1617895278 | https://github.com/pinterest/secor/blob/4099ff061db392f11044e57dedf46c1617895278/src/main/java/com/pinterest/secor/util/ReflectionUtil.java#L78-L86 |
48,371 | pinterest/secor | src/main/java/com/pinterest/secor/util/ReflectionUtil.java | ReflectionUtil.createMessageParser | public static MessageParser createMessageParser(String className,
SecorConfig config) throws Exception {
Class<?> clazz = Class.forName(className);
if (!MessageParser.class.isAssignableFrom(clazz)) {
throw new IllegalArgumentException(Strin... | java | public static MessageParser createMessageParser(String className,
SecorConfig config) throws Exception {
Class<?> clazz = Class.forName(className);
if (!MessageParser.class.isAssignableFrom(clazz)) {
throw new IllegalArgumentException(Strin... | [
"public",
"static",
"MessageParser",
"createMessageParser",
"(",
"String",
"className",
",",
"SecorConfig",
"config",
")",
"throws",
"Exception",
"{",
"Class",
"<",
"?",
">",
"clazz",
"=",
"Class",
".",
"forName",
"(",
"className",
")",
";",
"if",
"(",
"!",
... | Create a MessageParser from it's fully qualified class name.
The class passed in by name must be assignable to MessageParser and have 1-parameter constructor accepting a SecorConfig.
Allows the MessageParser to be pluggable by providing the class name of a desired MessageParser in config.
See the secor.message.parser.... | [
"Create",
"a",
"MessageParser",
"from",
"it",
"s",
"fully",
"qualified",
"class",
"name",
".",
"The",
"class",
"passed",
"in",
"by",
"name",
"must",
"be",
"assignable",
"to",
"MessageParser",
"and",
"have",
"1",
"-",
"parameter",
"constructor",
"accepting",
... | 4099ff061db392f11044e57dedf46c1617895278 | https://github.com/pinterest/secor/blob/4099ff061db392f11044e57dedf46c1617895278/src/main/java/com/pinterest/secor/util/ReflectionUtil.java#L100-L110 |
48,372 | pinterest/secor | src/main/java/com/pinterest/secor/util/ReflectionUtil.java | ReflectionUtil.createFileReaderWriterFactory | private static FileReaderWriterFactory createFileReaderWriterFactory(String className,
SecorConfig config) throws Exception {
Class<?> clazz = Class.forName(className);
if (!FileReaderWriterFactory.class.isAssignableFrom(clazz)) {
... | java | private static FileReaderWriterFactory createFileReaderWriterFactory(String className,
SecorConfig config) throws Exception {
Class<?> clazz = Class.forName(className);
if (!FileReaderWriterFactory.class.isAssignableFrom(clazz)) {
... | [
"private",
"static",
"FileReaderWriterFactory",
"createFileReaderWriterFactory",
"(",
"String",
"className",
",",
"SecorConfig",
"config",
")",
"throws",
"Exception",
"{",
"Class",
"<",
"?",
">",
"clazz",
"=",
"Class",
".",
"forName",
"(",
"className",
")",
";",
... | Create a FileReaderWriterFactory that is able to read and write a specific type of output log file.
The class passed in by name must be assignable to FileReaderWriterFactory.
Allows for pluggable FileReader and FileWriter instances to be constructed for a particular type of log file.
See the secor.file.reader.writer.f... | [
"Create",
"a",
"FileReaderWriterFactory",
"that",
"is",
"able",
"to",
"read",
"and",
"write",
"a",
"specific",
"type",
"of",
"output",
"log",
"file",
".",
"The",
"class",
"passed",
"in",
"by",
"name",
"must",
"be",
"assignable",
"to",
"FileReaderWriterFactory"... | 4099ff061db392f11044e57dedf46c1617895278 | https://github.com/pinterest/secor/blob/4099ff061db392f11044e57dedf46c1617895278/src/main/java/com/pinterest/secor/util/ReflectionUtil.java#L124-L140 |
48,373 | pinterest/secor | src/main/java/com/pinterest/secor/util/ReflectionUtil.java | ReflectionUtil.createFileWriter | public static FileWriter createFileWriter(String className, LogFilePath logFilePath,
CompressionCodec codec,
SecorConfig config)
throws Exception {
return createFileReaderWriterFactory(className, config).Buil... | java | public static FileWriter createFileWriter(String className, LogFilePath logFilePath,
CompressionCodec codec,
SecorConfig config)
throws Exception {
return createFileReaderWriterFactory(className, config).Buil... | [
"public",
"static",
"FileWriter",
"createFileWriter",
"(",
"String",
"className",
",",
"LogFilePath",
"logFilePath",
",",
"CompressionCodec",
"codec",
",",
"SecorConfig",
"config",
")",
"throws",
"Exception",
"{",
"return",
"createFileReaderWriterFactory",
"(",
"classNa... | Use the FileReaderWriterFactory specified by className to build a FileWriter
@param className the class name of a subclass of FileReaderWriterFactory to create a FileWriter from
@param logFilePath the LogFilePath that the returned FileWriter should write to
@param codec an instance CompressionCodec to compress the fil... | [
"Use",
"the",
"FileReaderWriterFactory",
"specified",
"by",
"className",
"to",
"build",
"a",
"FileWriter"
] | 4099ff061db392f11044e57dedf46c1617895278 | https://github.com/pinterest/secor/blob/4099ff061db392f11044e57dedf46c1617895278/src/main/java/com/pinterest/secor/util/ReflectionUtil.java#L152-L157 |
48,374 | pinterest/secor | src/main/java/com/pinterest/secor/util/ReflectionUtil.java | ReflectionUtil.createFileReader | public static FileReader createFileReader(String className, LogFilePath logFilePath,
CompressionCodec codec,
SecorConfig config)
throws Exception {
return createFileReaderWriterFactory(className, config).Buil... | java | public static FileReader createFileReader(String className, LogFilePath logFilePath,
CompressionCodec codec,
SecorConfig config)
throws Exception {
return createFileReaderWriterFactory(className, config).Buil... | [
"public",
"static",
"FileReader",
"createFileReader",
"(",
"String",
"className",
",",
"LogFilePath",
"logFilePath",
",",
"CompressionCodec",
"codec",
",",
"SecorConfig",
"config",
")",
"throws",
"Exception",
"{",
"return",
"createFileReaderWriterFactory",
"(",
"classNa... | Use the FileReaderWriterFactory specified by className to build a FileReader
@param className the class name of a subclass of FileReaderWriterFactory to create a FileReader from
@param logFilePath the LogFilePath that the returned FileReader should read from
@param codec an instance CompressionCodec to decompress the ... | [
"Use",
"the",
"FileReaderWriterFactory",
"specified",
"by",
"className",
"to",
"build",
"a",
"FileReader"
] | 4099ff061db392f11044e57dedf46c1617895278 | https://github.com/pinterest/secor/blob/4099ff061db392f11044e57dedf46c1617895278/src/main/java/com/pinterest/secor/util/ReflectionUtil.java#L169-L174 |
48,375 | pinterest/secor | src/main/java/com/pinterest/secor/util/ReflectionUtil.java | ReflectionUtil.createMessageTransformer | public static MessageTransformer createMessageTransformer(
String className, SecorConfig config) throws Exception {
Class<?> clazz = Class.forName(className);
if (!MessageTransformer.class.isAssignableFrom(clazz)) {
throw new IllegalArgumentException(String.format(
... | java | public static MessageTransformer createMessageTransformer(
String className, SecorConfig config) throws Exception {
Class<?> clazz = Class.forName(className);
if (!MessageTransformer.class.isAssignableFrom(clazz)) {
throw new IllegalArgumentException(String.format(
... | [
"public",
"static",
"MessageTransformer",
"createMessageTransformer",
"(",
"String",
"className",
",",
"SecorConfig",
"config",
")",
"throws",
"Exception",
"{",
"Class",
"<",
"?",
">",
"clazz",
"=",
"Class",
".",
"forName",
"(",
"className",
")",
";",
"if",
"(... | Create a MessageTransformer from it's fully qualified class name. The
class passed in by name must be assignable to MessageTransformers and have
1-parameter constructor accepting a SecorConfig. Allows the MessageTransformers
to be pluggable by providing the class name of a desired MessageTransformers in
config.
See th... | [
"Create",
"a",
"MessageTransformer",
"from",
"it",
"s",
"fully",
"qualified",
"class",
"name",
".",
"The",
"class",
"passed",
"in",
"by",
"name",
"must",
"be",
"assignable",
"to",
"MessageTransformers",
"and",
"have",
"1",
"-",
"parameter",
"constructor",
"acc... | 4099ff061db392f11044e57dedf46c1617895278 | https://github.com/pinterest/secor/blob/4099ff061db392f11044e57dedf46c1617895278/src/main/java/com/pinterest/secor/util/ReflectionUtil.java#L190-L200 |
48,376 | pinterest/secor | src/main/java/com/pinterest/secor/util/ReflectionUtil.java | ReflectionUtil.createORCSchemaProvider | public static ORCSchemaProvider createORCSchemaProvider(
String className, SecorConfig config) throws Exception {
Class<?> clazz = Class.forName(className);
if (!ORCSchemaProvider.class.isAssignableFrom(clazz)) {
throw new IllegalArgumentException(String.format(
... | java | public static ORCSchemaProvider createORCSchemaProvider(
String className, SecorConfig config) throws Exception {
Class<?> clazz = Class.forName(className);
if (!ORCSchemaProvider.class.isAssignableFrom(clazz)) {
throw new IllegalArgumentException(String.format(
... | [
"public",
"static",
"ORCSchemaProvider",
"createORCSchemaProvider",
"(",
"String",
"className",
",",
"SecorConfig",
"config",
")",
"throws",
"Exception",
"{",
"Class",
"<",
"?",
">",
"clazz",
"=",
"Class",
".",
"forName",
"(",
"className",
")",
";",
"if",
"(",... | Create a ORCSchemaProvider from it's fully qualified class name. The
class passed in by name must be assignable to ORCSchemaProvider and have
1-parameter constructor accepting a SecorConfig. Allows the ORCSchemaProvider
to be pluggable by providing the class name of a desired ORCSchemaProvider in
config.
See the secor... | [
"Create",
"a",
"ORCSchemaProvider",
"from",
"it",
"s",
"fully",
"qualified",
"class",
"name",
".",
"The",
"class",
"passed",
"in",
"by",
"name",
"must",
"be",
"assignable",
"to",
"ORCSchemaProvider",
"and",
"have",
"1",
"-",
"parameter",
"constructor",
"accept... | 4099ff061db392f11044e57dedf46c1617895278 | https://github.com/pinterest/secor/blob/4099ff061db392f11044e57dedf46c1617895278/src/main/java/com/pinterest/secor/util/ReflectionUtil.java#L243-L253 |
48,377 | pinterest/secor | src/main/java/com/pinterest/secor/util/FileUtil.java | FileUtil.getMd5Hash | public static String getMd5Hash(String topic, String[] partitions) {
ArrayList<String> elements = new ArrayList<String>();
elements.add(topic);
for (String partition : partitions) {
elements.add(partition);
}
String pathPrefix = StringUtils.join(elements, "/");
try {
... | java | public static String getMd5Hash(String topic, String[] partitions) {
ArrayList<String> elements = new ArrayList<String>();
elements.add(topic);
for (String partition : partitions) {
elements.add(partition);
}
String pathPrefix = StringUtils.join(elements, "/");
try {
... | [
"public",
"static",
"String",
"getMd5Hash",
"(",
"String",
"topic",
",",
"String",
"[",
"]",
"partitions",
")",
"{",
"ArrayList",
"<",
"String",
">",
"elements",
"=",
"new",
"ArrayList",
"<",
"String",
">",
"(",
")",
";",
"elements",
".",
"add",
"(",
"... | Generate MD5 hash of topic and partitions. And extract first 4 characters of the MD5 hash.
@param topic topic name
@param partitions partitions
@return md5 hash | [
"Generate",
"MD5",
"hash",
"of",
"topic",
"and",
"partitions",
".",
"And",
"extract",
"first",
"4",
"characters",
"of",
"the",
"MD5",
"hash",
"."
] | 4099ff061db392f11044e57dedf46c1617895278 | https://github.com/pinterest/secor/blob/4099ff061db392f11044e57dedf46c1617895278/src/main/java/com/pinterest/secor/util/FileUtil.java#L248-L265 |
48,378 | pinterest/secor | src/main/java/com/pinterest/secor/util/orc/schema/DefaultORCSchemaProvider.java | DefaultORCSchemaProvider.setSchemas | private void setSchemas(SecorConfig config) {
Map<String, String> schemaPerTopic = config.getORCMessageSchema();
for (Entry<String, String> entry : schemaPerTopic.entrySet()) {
String topic = entry.getKey();
TypeDescription schema = TypeDescription.fromString(entry
... | java | private void setSchemas(SecorConfig config) {
Map<String, String> schemaPerTopic = config.getORCMessageSchema();
for (Entry<String, String> entry : schemaPerTopic.entrySet()) {
String topic = entry.getKey();
TypeDescription schema = TypeDescription.fromString(entry
... | [
"private",
"void",
"setSchemas",
"(",
"SecorConfig",
"config",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"schemaPerTopic",
"=",
"config",
".",
"getORCMessageSchema",
"(",
")",
";",
"for",
"(",
"Entry",
"<",
"String",
",",
"String",
">",
"entry",
... | This method is used for fetching all ORC schemas from config
@param config | [
"This",
"method",
"is",
"used",
"for",
"fetching",
"all",
"ORC",
"schemas",
"from",
"config"
] | 4099ff061db392f11044e57dedf46c1617895278 | https://github.com/pinterest/secor/blob/4099ff061db392f11044e57dedf46c1617895278/src/main/java/com/pinterest/secor/util/orc/schema/DefaultORCSchemaProvider.java#L62-L74 |
48,379 | pinterest/secor | src/main/java/com/pinterest/secor/common/SecorConfig.java | SecorConfig.getPropertyMapForPrefix | public Map<String, String> getPropertyMapForPrefix(String prefix) {
Iterator<String> keys = mProperties.getKeys(prefix);
Map<String, String> map = new HashMap<String, String>();
while (keys.hasNext()) {
String key = keys.next();
String value = mProperties.getString(key);
... | java | public Map<String, String> getPropertyMapForPrefix(String prefix) {
Iterator<String> keys = mProperties.getKeys(prefix);
Map<String, String> map = new HashMap<String, String>();
while (keys.hasNext()) {
String key = keys.next();
String value = mProperties.getString(key);
... | [
"public",
"Map",
"<",
"String",
",",
"String",
">",
"getPropertyMapForPrefix",
"(",
"String",
"prefix",
")",
"{",
"Iterator",
"<",
"String",
">",
"keys",
"=",
"mProperties",
".",
"getKeys",
"(",
"prefix",
")",
";",
"Map",
"<",
"String",
",",
"String",
">... | This method is used for fetching all the properties which start with the given prefix.
It returns a Map of all those key-val.
e.g.
a.b.c=val1
a.b.d=val2
a.b.e=val3
If prefix is a.b then,
These will be fetched as a map {c = val1, d = val2, e = val3}
@param prefix property prefix
@return | [
"This",
"method",
"is",
"used",
"for",
"fetching",
"all",
"the",
"properties",
"which",
"start",
"with",
"the",
"given",
"prefix",
".",
"It",
"returns",
"a",
"Map",
"of",
"all",
"those",
"key",
"-",
"val",
"."
] | 4099ff061db392f11044e57dedf46c1617895278 | https://github.com/pinterest/secor/blob/4099ff061db392f11044e57dedf46c1617895278/src/main/java/com/pinterest/secor/common/SecorConfig.java#L775-L784 |
48,380 | pinterest/secor | src/main/java/com/pinterest/secor/tools/ProgressMonitor.java | ProgressMonitor.exportToStatsD | private void exportToStatsD(List<Stat> stats) {
// group stats by kafka group
for (Stat stat : stats) {
@SuppressWarnings("unchecked")
Map<String, String> tags = (Map<String, String>) stat.get(Stat.STAT_KEYS.TAGS.getName());
long value = Long.parseLong((String) stat.g... | java | private void exportToStatsD(List<Stat> stats) {
// group stats by kafka group
for (Stat stat : stats) {
@SuppressWarnings("unchecked")
Map<String, String> tags = (Map<String, String>) stat.get(Stat.STAT_KEYS.TAGS.getName());
long value = Long.parseLong((String) stat.g... | [
"private",
"void",
"exportToStatsD",
"(",
"List",
"<",
"Stat",
">",
"stats",
")",
"{",
"// group stats by kafka group",
"for",
"(",
"Stat",
"stat",
":",
"stats",
")",
"{",
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"Map",
"<",
"String",
",",
"String... | Helper to publish stats to statsD client | [
"Helper",
"to",
"publish",
"stats",
"to",
"statsD",
"client"
] | 4099ff061db392f11044e57dedf46c1617895278 | https://github.com/pinterest/secor/blob/4099ff061db392f11044e57dedf46c1617895278/src/main/java/com/pinterest/secor/tools/ProgressMonitor.java#L162-L192 |
48,381 | pinterest/secor | src/main/java/com/pinterest/secor/common/FileRegistry.java | FileRegistry.getTopicPartitions | public Collection<TopicPartition> getTopicPartitions() {
Collection<TopicPartitionGroup> topicPartitions = getTopicPartitionGroups();
Set<TopicPartition> tps = new HashSet<TopicPartition>();
if (topicPartitions != null) {
for (TopicPartitionGroup g : topicPartitions) {
... | java | public Collection<TopicPartition> getTopicPartitions() {
Collection<TopicPartitionGroup> topicPartitions = getTopicPartitionGroups();
Set<TopicPartition> tps = new HashSet<TopicPartition>();
if (topicPartitions != null) {
for (TopicPartitionGroup g : topicPartitions) {
... | [
"public",
"Collection",
"<",
"TopicPartition",
">",
"getTopicPartitions",
"(",
")",
"{",
"Collection",
"<",
"TopicPartitionGroup",
">",
"topicPartitions",
"=",
"getTopicPartitionGroups",
"(",
")",
";",
"Set",
"<",
"TopicPartition",
">",
"tps",
"=",
"new",
"HashSet... | Get all topic partitions.
@return Collection of all registered topic partitions. | [
"Get",
"all",
"topic",
"partitions",
"."
] | 4099ff061db392f11044e57dedf46c1617895278 | https://github.com/pinterest/secor/blob/4099ff061db392f11044e57dedf46c1617895278/src/main/java/com/pinterest/secor/common/FileRegistry.java#L58-L67 |
48,382 | pinterest/secor | src/main/java/com/pinterest/secor/common/FileRegistry.java | FileRegistry.getPaths | public Collection<LogFilePath> getPaths(TopicPartitionGroup topicPartitionGroup) {
HashSet<LogFilePath> logFilePaths = mFiles.get(topicPartitionGroup);
if (logFilePaths == null) {
return new HashSet<LogFilePath>();
}
return new HashSet<LogFilePath>(logFilePaths);
} | java | public Collection<LogFilePath> getPaths(TopicPartitionGroup topicPartitionGroup) {
HashSet<LogFilePath> logFilePaths = mFiles.get(topicPartitionGroup);
if (logFilePaths == null) {
return new HashSet<LogFilePath>();
}
return new HashSet<LogFilePath>(logFilePaths);
} | [
"public",
"Collection",
"<",
"LogFilePath",
">",
"getPaths",
"(",
"TopicPartitionGroup",
"topicPartitionGroup",
")",
"{",
"HashSet",
"<",
"LogFilePath",
">",
"logFilePaths",
"=",
"mFiles",
".",
"get",
"(",
"topicPartitionGroup",
")",
";",
"if",
"(",
"logFilePaths"... | Get paths in a given topic partition.
@param topicPartitionGroup The topic partition to retrieve paths for.
@return Collection of file paths in the given topic partition. | [
"Get",
"paths",
"in",
"a",
"given",
"topic",
"partition",
"."
] | 4099ff061db392f11044e57dedf46c1617895278 | https://github.com/pinterest/secor/blob/4099ff061db392f11044e57dedf46c1617895278/src/main/java/com/pinterest/secor/common/FileRegistry.java#L92-L98 |
48,383 | pinterest/secor | src/main/java/com/pinterest/secor/common/FileRegistry.java | FileRegistry.getOrCreateWriter | public FileWriter getOrCreateWriter(LogFilePath path, CompressionCodec codec)
throws Exception {
FileWriter writer = mWriters.get(path);
if (writer == null) {
// Just in case.
FileUtil.delete(path.getLogFilePath());
FileUtil.delete(path.getLogFileCrcPath()... | java | public FileWriter getOrCreateWriter(LogFilePath path, CompressionCodec codec)
throws Exception {
FileWriter writer = mWriters.get(path);
if (writer == null) {
// Just in case.
FileUtil.delete(path.getLogFilePath());
FileUtil.delete(path.getLogFileCrcPath()... | [
"public",
"FileWriter",
"getOrCreateWriter",
"(",
"LogFilePath",
"path",
",",
"CompressionCodec",
"codec",
")",
"throws",
"Exception",
"{",
"FileWriter",
"writer",
"=",
"mWriters",
".",
"get",
"(",
"path",
")",
";",
"if",
"(",
"writer",
"==",
"null",
")",
"{... | Retrieve a writer for a given path or create a new one if it does not exist.
@param path The path to retrieve writer for.
@param codec Optional compression codec.
@return Writer for a given path.
@throws Exception on error | [
"Retrieve",
"a",
"writer",
"for",
"a",
"given",
"path",
"or",
"create",
"a",
"new",
"one",
"if",
"it",
"does",
"not",
"exist",
"."
] | 4099ff061db392f11044e57dedf46c1617895278 | https://github.com/pinterest/secor/blob/4099ff061db392f11044e57dedf46c1617895278/src/main/java/com/pinterest/secor/common/FileRegistry.java#L118-L146 |
48,384 | pinterest/secor | src/main/java/com/pinterest/secor/common/FileRegistry.java | FileRegistry.deletePath | public void deletePath(LogFilePath path) throws IOException {
TopicPartitionGroup topicPartition = new TopicPartitionGroup(path.getTopic(),
path.getKafkaPartitions());
HashSet<LogFilePath> paths = mFiles.get(topicPartition);
paths.remove... | java | public void deletePath(LogFilePath path) throws IOException {
TopicPartitionGroup topicPartition = new TopicPartitionGroup(path.getTopic(),
path.getKafkaPartitions());
HashSet<LogFilePath> paths = mFiles.get(topicPartition);
paths.remove... | [
"public",
"void",
"deletePath",
"(",
"LogFilePath",
"path",
")",
"throws",
"IOException",
"{",
"TopicPartitionGroup",
"topicPartition",
"=",
"new",
"TopicPartitionGroup",
"(",
"path",
".",
"getTopic",
"(",
")",
",",
"path",
".",
"getKafkaPartitions",
"(",
")",
"... | Delete a given path, the underlying file, and the corresponding writer.
@param path The path to delete.
@throws IOException on error | [
"Delete",
"a",
"given",
"path",
"the",
"underlying",
"file",
"and",
"the",
"corresponding",
"writer",
"."
] | 4099ff061db392f11044e57dedf46c1617895278 | https://github.com/pinterest/secor/blob/4099ff061db392f11044e57dedf46c1617895278/src/main/java/com/pinterest/secor/common/FileRegistry.java#L153-L168 |
48,385 | pinterest/secor | src/main/java/com/pinterest/secor/common/FileRegistry.java | FileRegistry.deleteWriter | public void deleteWriter(LogFilePath path) throws IOException {
FileWriter writer = mWriters.get(path);
if (writer == null) {
LOG.warn("No writer found for path {}", path.getLogFilePath());
} else {
LOG.info("Deleting writer for path {}", path.getLogFilePath());
... | java | public void deleteWriter(LogFilePath path) throws IOException {
FileWriter writer = mWriters.get(path);
if (writer == null) {
LOG.warn("No writer found for path {}", path.getLogFilePath());
} else {
LOG.info("Deleting writer for path {}", path.getLogFilePath());
... | [
"public",
"void",
"deleteWriter",
"(",
"LogFilePath",
"path",
")",
"throws",
"IOException",
"{",
"FileWriter",
"writer",
"=",
"mWriters",
".",
"get",
"(",
"path",
")",
";",
"if",
"(",
"writer",
"==",
"null",
")",
"{",
"LOG",
".",
"warn",
"(",
"\"No write... | Delete writer for a given topic partition. Underlying file is not removed.
@param path The path to remove the writer for.
@throws IOException on error | [
"Delete",
"writer",
"for",
"a",
"given",
"topic",
"partition",
".",
"Underlying",
"file",
"is",
"not",
"removed",
"."
] | 4099ff061db392f11044e57dedf46c1617895278 | https://github.com/pinterest/secor/blob/4099ff061db392f11044e57dedf46c1617895278/src/main/java/com/pinterest/secor/common/FileRegistry.java#L195-L205 |
48,386 | NordicSemiconductor/Android-DFU-Library | dfu/src/main/java/no/nordicsemi/android/dfu/DfuServiceListenerHelper.java | DfuServiceListenerHelper.unregisterProgressListener | public static void unregisterProgressListener(@NonNull final Context context, @NonNull final DfuProgressListener listener) {
if (mProgressBroadcastReceiver != null) {
final boolean empty = mProgressBroadcastReceiver.removeProgressListener(listener);
if (empty) {
LocalBroadcastManager.getInstance(context).u... | java | public static void unregisterProgressListener(@NonNull final Context context, @NonNull final DfuProgressListener listener) {
if (mProgressBroadcastReceiver != null) {
final boolean empty = mProgressBroadcastReceiver.removeProgressListener(listener);
if (empty) {
LocalBroadcastManager.getInstance(context).u... | [
"public",
"static",
"void",
"unregisterProgressListener",
"(",
"@",
"NonNull",
"final",
"Context",
"context",
",",
"@",
"NonNull",
"final",
"DfuProgressListener",
"listener",
")",
"{",
"if",
"(",
"mProgressBroadcastReceiver",
"!=",
"null",
")",
"{",
"final",
"bool... | Unregisters the previously registered progress listener.
@param context the application context.
@param listener the listener to unregister. | [
"Unregisters",
"the",
"previously",
"registered",
"progress",
"listener",
"."
] | ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f | https://github.com/NordicSemiconductor/Android-DFU-Library/blob/ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f/dfu/src/main/java/no/nordicsemi/android/dfu/DfuServiceListenerHelper.java#L324-L333 |
48,387 | NordicSemiconductor/Android-DFU-Library | dfu/src/main/java/no/nordicsemi/android/dfu/DfuServiceListenerHelper.java | DfuServiceListenerHelper.unregisterLogListener | public static void unregisterLogListener(@NonNull final Context context, @NonNull final DfuLogListener listener) {
if (mLogBroadcastReceiver != null) {
final boolean empty = mLogBroadcastReceiver.removeLogListener(listener);
if (empty) {
LocalBroadcastManager.getInstance(context).unregisterReceiver(mLogBro... | java | public static void unregisterLogListener(@NonNull final Context context, @NonNull final DfuLogListener listener) {
if (mLogBroadcastReceiver != null) {
final boolean empty = mLogBroadcastReceiver.removeLogListener(listener);
if (empty) {
LocalBroadcastManager.getInstance(context).unregisterReceiver(mLogBro... | [
"public",
"static",
"void",
"unregisterLogListener",
"(",
"@",
"NonNull",
"final",
"Context",
"context",
",",
"@",
"NonNull",
"final",
"DfuLogListener",
"listener",
")",
"{",
"if",
"(",
"mLogBroadcastReceiver",
"!=",
"null",
")",
"{",
"final",
"boolean",
"empty"... | Unregisters the previously registered log listener.
@param context the application context.
@param listener the listener to unregister. | [
"Unregisters",
"the",
"previously",
"registered",
"log",
"listener",
"."
] | ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f | https://github.com/NordicSemiconductor/Android-DFU-Library/blob/ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f/dfu/src/main/java/no/nordicsemi/android/dfu/DfuServiceListenerHelper.java#L378-L387 |
48,388 | NordicSemiconductor/Android-DFU-Library | dfu/src/main/java/no/nordicsemi/android/dfu/internal/ArchiveInputStream.java | ArchiveInputStream.fullReset | public void fullReset() {
// Reset stream to SoftDevice if SD and BL firmware were given separately
if (softDeviceBytes != null && bootloaderBytes != null && currentSource == bootloaderBytes) {
currentSource = softDeviceBytes;
}
// Reset the bytes count to 0
bytesReadFromCurrentSource = 0;
mark(0);
res... | java | public void fullReset() {
// Reset stream to SoftDevice if SD and BL firmware were given separately
if (softDeviceBytes != null && bootloaderBytes != null && currentSource == bootloaderBytes) {
currentSource = softDeviceBytes;
}
// Reset the bytes count to 0
bytesReadFromCurrentSource = 0;
mark(0);
res... | [
"public",
"void",
"fullReset",
"(",
")",
"{",
"// Reset stream to SoftDevice if SD and BL firmware were given separately",
"if",
"(",
"softDeviceBytes",
"!=",
"null",
"&&",
"bootloaderBytes",
"!=",
"null",
"&&",
"currentSource",
"==",
"bootloaderBytes",
")",
"{",
"current... | Resets to the beginning of current stream.
If SD and BL were updated, the stream will be reset to the beginning.
If SD and BL were already sent and the current stream was changed to application,
this method will reset to the beginning of the application stream. | [
"Resets",
"to",
"the",
"beginning",
"of",
"current",
"stream",
".",
"If",
"SD",
"and",
"BL",
"were",
"updated",
"the",
"stream",
"will",
"be",
"reset",
"to",
"the",
"beginning",
".",
"If",
"SD",
"and",
"BL",
"were",
"already",
"sent",
"and",
"the",
"cu... | ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f | https://github.com/NordicSemiconductor/Android-DFU-Library/blob/ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f/dfu/src/main/java/no/nordicsemi/android/dfu/internal/ArchiveInputStream.java#L429-L438 |
48,389 | NordicSemiconductor/Android-DFU-Library | dfu/src/main/java/no/nordicsemi/android/dfu/BaseCustomDfuImpl.java | BaseCustomDfuImpl.writeInitData | void writeInitData(final BluetoothGattCharacteristic characteristic, final CRC32 crc32)
throws DfuException, DeviceDisconnectedException, UploadAbortedException {
try {
byte[] data = mBuffer;
int size;
while ((size = mInitPacketStream.read(data, 0, data.length)) != -1) {
writeInitPacket(characteristic... | java | void writeInitData(final BluetoothGattCharacteristic characteristic, final CRC32 crc32)
throws DfuException, DeviceDisconnectedException, UploadAbortedException {
try {
byte[] data = mBuffer;
int size;
while ((size = mInitPacketStream.read(data, 0, data.length)) != -1) {
writeInitPacket(characteristic... | [
"void",
"writeInitData",
"(",
"final",
"BluetoothGattCharacteristic",
"characteristic",
",",
"final",
"CRC32",
"crc32",
")",
"throws",
"DfuException",
",",
"DeviceDisconnectedException",
",",
"UploadAbortedException",
"{",
"try",
"{",
"byte",
"[",
"]",
"data",
"=",
... | Wends the whole init packet stream to the given characteristic.
@param characteristic the target characteristic
@param crc32 the CRC object to be updated based on the data sent
@throws DeviceDisconnectedException Thrown when the device will disconnect in the middle of
the transmission.
@throws DfuException ... | [
"Wends",
"the",
"whole",
"init",
"packet",
"stream",
"to",
"the",
"given",
"characteristic",
"."
] | ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f | https://github.com/NordicSemiconductor/Android-DFU-Library/blob/ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f/dfu/src/main/java/no/nordicsemi/android/dfu/BaseCustomDfuImpl.java#L293-L307 |
48,390 | NordicSemiconductor/Android-DFU-Library | dfu/src/main/java/no/nordicsemi/android/dfu/BaseCustomDfuImpl.java | BaseCustomDfuImpl.uploadFirmwareImage | void uploadFirmwareImage(final BluetoothGattCharacteristic packetCharacteristic)
throws DeviceDisconnectedException, DfuException, UploadAbortedException {
if (mAborted)
throw new UploadAbortedException();
mReceivedData = null;
mError = 0;
mFirmwareUploadInProgress = true;
mPacketsSentSinceNotification ... | java | void uploadFirmwareImage(final BluetoothGattCharacteristic packetCharacteristic)
throws DeviceDisconnectedException, DfuException, UploadAbortedException {
if (mAborted)
throw new UploadAbortedException();
mReceivedData = null;
mError = 0;
mFirmwareUploadInProgress = true;
mPacketsSentSinceNotification ... | [
"void",
"uploadFirmwareImage",
"(",
"final",
"BluetoothGattCharacteristic",
"packetCharacteristic",
")",
"throws",
"DeviceDisconnectedException",
",",
"DfuException",
",",
"UploadAbortedException",
"{",
"if",
"(",
"mAborted",
")",
"throw",
"new",
"UploadAbortedException",
"... | Starts sending the data. This method is SYNCHRONOUS and terminates when the whole file will
be uploaded or the device get disconnected. If connection state will change, or an error
will occur, an exception will be thrown.
@param packetCharacteristic the characteristic to write file content to. Must be the DFU PACKET.
... | [
"Starts",
"sending",
"the",
"data",
".",
"This",
"method",
"is",
"SYNCHRONOUS",
"and",
"terminates",
"when",
"the",
"whole",
"file",
"will",
"be",
"uploaded",
"or",
"the",
"device",
"get",
"disconnected",
".",
"If",
"connection",
"state",
"will",
"change",
"... | ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f | https://github.com/NordicSemiconductor/Android-DFU-Library/blob/ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f/dfu/src/main/java/no/nordicsemi/android/dfu/BaseCustomDfuImpl.java#L368-L402 |
48,391 | NordicSemiconductor/Android-DFU-Library | dfu/src/main/java/no/nordicsemi/android/dfu/BaseCustomDfuImpl.java | BaseCustomDfuImpl.writePacket | private void writePacket(final BluetoothGatt gatt, final BluetoothGattCharacteristic characteristic, final byte[] buffer, final int size) {
byte[] locBuffer = buffer;
if (size <= 0) // This should never happen
return;
if (buffer.length != size) {
locBuffer = new byte[size];
System.arraycopy(buffer, 0, lo... | java | private void writePacket(final BluetoothGatt gatt, final BluetoothGattCharacteristic characteristic, final byte[] buffer, final int size) {
byte[] locBuffer = buffer;
if (size <= 0) // This should never happen
return;
if (buffer.length != size) {
locBuffer = new byte[size];
System.arraycopy(buffer, 0, lo... | [
"private",
"void",
"writePacket",
"(",
"final",
"BluetoothGatt",
"gatt",
",",
"final",
"BluetoothGattCharacteristic",
"characteristic",
",",
"final",
"byte",
"[",
"]",
"buffer",
",",
"final",
"int",
"size",
")",
"{",
"byte",
"[",
"]",
"locBuffer",
"=",
"buffer... | Writes the buffer to the characteristic. The maximum size of the buffer is dependent on MTU.
This method is ASYNCHRONOUS and returns immediately after adding the data to TX queue.
@param characteristic the characteristic to write to. Should be the DFU PACKET.
@param buffer the buffer with 1-20 bytes.
@param si... | [
"Writes",
"the",
"buffer",
"to",
"the",
"characteristic",
".",
"The",
"maximum",
"size",
"of",
"the",
"buffer",
"is",
"dependent",
"on",
"MTU",
".",
"This",
"method",
"is",
"ASYNCHRONOUS",
"and",
"returns",
"immediately",
"after",
"adding",
"the",
"data",
"t... | ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f | https://github.com/NordicSemiconductor/Android-DFU-Library/blob/ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f/dfu/src/main/java/no/nordicsemi/android/dfu/BaseCustomDfuImpl.java#L412-L423 |
48,392 | NordicSemiconductor/Android-DFU-Library | dfu/src/main/java/no/nordicsemi/android/dfu/LegacyButtonlessDfuImpl.java | LegacyButtonlessDfuImpl.readVersion | private int readVersion(final BluetoothGatt gatt, final BluetoothGattCharacteristic characteristic)
throws DeviceDisconnectedException, DfuException, UploadAbortedException {
if (!mConnected)
throw new DeviceDisconnectedException("Unable to read version number: device disconnected");
if (mAborted)
... | java | private int readVersion(final BluetoothGatt gatt, final BluetoothGattCharacteristic characteristic)
throws DeviceDisconnectedException, DfuException, UploadAbortedException {
if (!mConnected)
throw new DeviceDisconnectedException("Unable to read version number: device disconnected");
if (mAborted)
... | [
"private",
"int",
"readVersion",
"(",
"final",
"BluetoothGatt",
"gatt",
",",
"final",
"BluetoothGattCharacteristic",
"characteristic",
")",
"throws",
"DeviceDisconnectedException",
",",
"DfuException",
",",
"UploadAbortedException",
"{",
"if",
"(",
"!",
"mConnected",
")... | Reads the DFU Version characteristic if such exists. Otherwise it returns 0.
@param gatt the GATT device.
@param characteristic the characteristic to read.
@return a version number or 0 if not present on the bootloader.
@throws DeviceDisconnectedException Thrown when the device will disconnect in the middle ... | [
"Reads",
"the",
"DFU",
"Version",
"characteristic",
"if",
"such",
"exists",
".",
"Otherwise",
"it",
"returns",
"0",
"."
] | ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f | https://github.com/NordicSemiconductor/Android-DFU-Library/blob/ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f/dfu/src/main/java/no/nordicsemi/android/dfu/LegacyButtonlessDfuImpl.java#L210-L248 |
48,393 | NordicSemiconductor/Android-DFU-Library | dfu/src/main/java/no/nordicsemi/android/dfu/BaseDfuImpl.java | BaseDfuImpl.createBondApi18 | private boolean createBondApi18(@NonNull final BluetoothDevice device) {
/*
* There is a createBond() method in BluetoothDevice class but for now it's hidden. We will call it using reflections. It has been revealed in KitKat (Api19)
*/
try {
final Method createBond = device.getClass().getMethod("createBond... | java | private boolean createBondApi18(@NonNull final BluetoothDevice device) {
/*
* There is a createBond() method in BluetoothDevice class but for now it's hidden. We will call it using reflections. It has been revealed in KitKat (Api19)
*/
try {
final Method createBond = device.getClass().getMethod("createBond... | [
"private",
"boolean",
"createBondApi18",
"(",
"@",
"NonNull",
"final",
"BluetoothDevice",
"device",
")",
"{",
"/*\n\t\t * There is a createBond() method in BluetoothDevice class but for now it's hidden. We will call it using reflections. It has been revealed in KitKat (Api19)\n\t\t */",
"try... | A method that creates the bond to given device on API lower than Android 5.
@param device the target device
@return false if bonding failed (no hidden createBond() method in BluetoothDevice, or this method returned false | [
"A",
"method",
"that",
"creates",
"the",
"bond",
"to",
"given",
"device",
"on",
"API",
"lower",
"than",
"Android",
"5",
"."
] | ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f | https://github.com/NordicSemiconductor/Android-DFU-Library/blob/ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f/dfu/src/main/java/no/nordicsemi/android/dfu/BaseDfuImpl.java#L611-L623 |
48,394 | NordicSemiconductor/Android-DFU-Library | dfu/src/main/java/no/nordicsemi/android/dfu/BaseDfuImpl.java | BaseDfuImpl.removeBond | @SuppressWarnings("UnusedReturnValue")
boolean removeBond() {
final BluetoothDevice device = mGatt.getDevice();
if (device.getBondState() == BluetoothDevice.BOND_NONE)
return true;
mService.sendLogBroadcast(DfuBaseService.LOG_LEVEL_VERBOSE, "Removing bond information...");
boolean result = false;
/*
... | java | @SuppressWarnings("UnusedReturnValue")
boolean removeBond() {
final BluetoothDevice device = mGatt.getDevice();
if (device.getBondState() == BluetoothDevice.BOND_NONE)
return true;
mService.sendLogBroadcast(DfuBaseService.LOG_LEVEL_VERBOSE, "Removing bond information...");
boolean result = false;
/*
... | [
"@",
"SuppressWarnings",
"(",
"\"UnusedReturnValue\"",
")",
"boolean",
"removeBond",
"(",
")",
"{",
"final",
"BluetoothDevice",
"device",
"=",
"mGatt",
".",
"getDevice",
"(",
")",
";",
"if",
"(",
"device",
".",
"getBondState",
"(",
")",
"==",
"BluetoothDevice"... | Removes the bond information for the given device.
@return <code>true</code> if operation succeeded, <code>false</code> otherwise | [
"Removes",
"the",
"bond",
"information",
"for",
"the",
"given",
"device",
"."
] | ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f | https://github.com/NordicSemiconductor/Android-DFU-Library/blob/ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f/dfu/src/main/java/no/nordicsemi/android/dfu/BaseDfuImpl.java#L630-L661 |
48,395 | NordicSemiconductor/Android-DFU-Library | dfu/src/main/java/no/nordicsemi/android/dfu/BaseDfuImpl.java | BaseDfuImpl.requestMtu | @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
void requestMtu(@IntRange(from = 0, to = 517) final int mtu)
throws DeviceDisconnectedException, UploadAbortedException {
if (mAborted)
throw new UploadAbortedException();
mRequestCompleted = false;
mService.sendLogBroadcast(DfuBaseService.LOG_LEVE... | java | @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
void requestMtu(@IntRange(from = 0, to = 517) final int mtu)
throws DeviceDisconnectedException, UploadAbortedException {
if (mAborted)
throw new UploadAbortedException();
mRequestCompleted = false;
mService.sendLogBroadcast(DfuBaseService.LOG_LEVE... | [
"@",
"RequiresApi",
"(",
"api",
"=",
"Build",
".",
"VERSION_CODES",
".",
"LOLLIPOP",
")",
"void",
"requestMtu",
"(",
"@",
"IntRange",
"(",
"from",
"=",
"0",
",",
"to",
"=",
"517",
")",
"final",
"int",
"mtu",
")",
"throws",
"DeviceDisconnectedException",
... | Requests given MTU. This method is only supported on Android Lollipop or newer versions.
Only DFU from SDK 14.1 or newer supports MTU > 23.
@param mtu new MTU to be requested. | [
"Requests",
"given",
"MTU",
".",
"This",
"method",
"is",
"only",
"supported",
"on",
"Android",
"Lollipop",
"or",
"newer",
"versions",
".",
"Only",
"DFU",
"from",
"SDK",
"14",
".",
"1",
"or",
"newer",
"supports",
"MTU",
">",
"23",
"."
] | ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f | https://github.com/NordicSemiconductor/Android-DFU-Library/blob/ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f/dfu/src/main/java/no/nordicsemi/android/dfu/BaseDfuImpl.java#L679-L702 |
48,396 | NordicSemiconductor/Android-DFU-Library | dfu/src/main/java/no/nordicsemi/android/dfu/BaseDfuImpl.java | BaseDfuImpl.readNotificationResponse | byte[] readNotificationResponse()
throws DeviceDisconnectedException, DfuException, UploadAbortedException {
// do not clear the mReceiveData here. The response might already be obtained. Clear it in write request instead.
try {
synchronized (mLock) {
while ((mReceivedData == null && mConnected &... | java | byte[] readNotificationResponse()
throws DeviceDisconnectedException, DfuException, UploadAbortedException {
// do not clear the mReceiveData here. The response might already be obtained. Clear it in write request instead.
try {
synchronized (mLock) {
while ((mReceivedData == null && mConnected &... | [
"byte",
"[",
"]",
"readNotificationResponse",
"(",
")",
"throws",
"DeviceDisconnectedException",
",",
"DfuException",
",",
"UploadAbortedException",
"{",
"// do not clear the mReceiveData here. The response might already be obtained. Clear it in write request instead.",
"try",
"{",
"... | Waits until the notification will arrive. Returns the data returned by the notification.
This method will block the thread until response is not ready or the device gets disconnected.
If connection state will change, or an error will occur, an exception will be thrown.
@return the value returned by the Control Point n... | [
"Waits",
"until",
"the",
"notification",
"will",
"arrive",
".",
"Returns",
"the",
"data",
"returned",
"by",
"the",
"notification",
".",
"This",
"method",
"will",
"block",
"the",
"thread",
"until",
"response",
"is",
"not",
"ready",
"or",
"the",
"device",
"get... | ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f | https://github.com/NordicSemiconductor/Android-DFU-Library/blob/ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f/dfu/src/main/java/no/nordicsemi/android/dfu/BaseDfuImpl.java#L715-L733 |
48,397 | NordicSemiconductor/Android-DFU-Library | dfu/src/main/java/no/nordicsemi/android/dfu/BaseDfuImpl.java | BaseDfuImpl.restartService | void restartService(@NonNull final Intent intent, final boolean scanForBootloader) {
String newAddress = null;
if (scanForBootloader) {
mService.sendLogBroadcast(DfuBaseService.LOG_LEVEL_VERBOSE, "Scanning for the DFU Bootloader...");
newAddress = BootloaderScannerFactory.getScanner().searchFor(mGatt.getDevic... | java | void restartService(@NonNull final Intent intent, final boolean scanForBootloader) {
String newAddress = null;
if (scanForBootloader) {
mService.sendLogBroadcast(DfuBaseService.LOG_LEVEL_VERBOSE, "Scanning for the DFU Bootloader...");
newAddress = BootloaderScannerFactory.getScanner().searchFor(mGatt.getDevic... | [
"void",
"restartService",
"(",
"@",
"NonNull",
"final",
"Intent",
"intent",
",",
"final",
"boolean",
"scanForBootloader",
")",
"{",
"String",
"newAddress",
"=",
"null",
";",
"if",
"(",
"scanForBootloader",
")",
"{",
"mService",
".",
"sendLogBroadcast",
"(",
"D... | Restarts the service based on the given intent. If parameter set this method will also scan for
an advertising bootloader that has address equal or incremented by 1 to the current one.
@param intent the intent to be started as a service
@param scanForBootloader true to scan for advertising bootloader, false... | [
"Restarts",
"the",
"service",
"based",
"on",
"the",
"given",
"intent",
".",
"If",
"parameter",
"set",
"this",
"method",
"will",
"also",
"scan",
"for",
"an",
"advertising",
"bootloader",
"that",
"has",
"address",
"equal",
"or",
"incremented",
"by",
"1",
"to",... | ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f | https://github.com/NordicSemiconductor/Android-DFU-Library/blob/ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f/dfu/src/main/java/no/nordicsemi/android/dfu/BaseDfuImpl.java#L742-L762 |
48,398 | NordicSemiconductor/Android-DFU-Library | dfu/src/main/java/no/nordicsemi/android/dfu/DfuServiceInitiator.java | DfuServiceInitiator.setZip | public DfuServiceInitiator setZip(@Nullable final Uri uri, @Nullable final String path) {
return init(uri, path, 0, DfuBaseService.TYPE_AUTO, DfuBaseService.MIME_TYPE_ZIP);
} | java | public DfuServiceInitiator setZip(@Nullable final Uri uri, @Nullable final String path) {
return init(uri, path, 0, DfuBaseService.TYPE_AUTO, DfuBaseService.MIME_TYPE_ZIP);
} | [
"public",
"DfuServiceInitiator",
"setZip",
"(",
"@",
"Nullable",
"final",
"Uri",
"uri",
",",
"@",
"Nullable",
"final",
"String",
"path",
")",
"{",
"return",
"init",
"(",
"uri",
",",
"path",
",",
"0",
",",
"DfuBaseService",
".",
"TYPE_AUTO",
",",
"DfuBaseSe... | Sets the URI or path of the ZIP file.
At least one of the parameters must not be null.
If the URI and path are not null the URI will be used.
@param uri the URI of the file
@param path the path of the file
@return the builder | [
"Sets",
"the",
"URI",
"or",
"path",
"of",
"the",
"ZIP",
"file",
".",
"At",
"least",
"one",
"of",
"the",
"parameters",
"must",
"not",
"be",
"null",
".",
"If",
"the",
"URI",
"and",
"path",
"are",
"not",
"null",
"the",
"URI",
"will",
"be",
"used",
"."... | ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f | https://github.com/NordicSemiconductor/Android-DFU-Library/blob/ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f/dfu/src/main/java/no/nordicsemi/android/dfu/DfuServiceInitiator.java#L604-L606 |
48,399 | NordicSemiconductor/Android-DFU-Library | dfu/src/main/java/no/nordicsemi/android/dfu/DfuServiceInitiator.java | DfuServiceInitiator.start | public DfuServiceController start(@NonNull final Context context, @NonNull final Class<? extends DfuBaseService> service) {
if (fileType == -1)
throw new UnsupportedOperationException("You must specify the firmware file before starting the service");
final Intent intent = new Intent(context, service);
intent... | java | public DfuServiceController start(@NonNull final Context context, @NonNull final Class<? extends DfuBaseService> service) {
if (fileType == -1)
throw new UnsupportedOperationException("You must specify the firmware file before starting the service");
final Intent intent = new Intent(context, service);
intent... | [
"public",
"DfuServiceController",
"start",
"(",
"@",
"NonNull",
"final",
"Context",
"context",
",",
"@",
"NonNull",
"final",
"Class",
"<",
"?",
"extends",
"DfuBaseService",
">",
"service",
")",
"{",
"if",
"(",
"fileType",
"==",
"-",
"1",
")",
"throw",
"new... | Starts the DFU service.
@param context the application context
@param service the class derived from the BaseDfuService | [
"Starts",
"the",
"DFU",
"service",
"."
] | ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f | https://github.com/NordicSemiconductor/Android-DFU-Library/blob/ec14c8c522bebe801a9a4c3dfbbeb1f53262c03f/dfu/src/main/java/no/nordicsemi/android/dfu/DfuServiceInitiator.java#L738-L795 |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.