repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
partition
stringclasses
1 value
chrisjenx/Calligraphy
calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyFactory.java
CalligraphyFactory.applyFontToToolbar
private void applyFontToToolbar(final Toolbar view) { final CharSequence previousTitle = view.getTitle(); final CharSequence previousSubtitle = view.getSubtitle(); // The toolbar inflates both the title and the subtitle views lazily but luckily they do it // synchronously when you set a ...
java
private void applyFontToToolbar(final Toolbar view) { final CharSequence previousTitle = view.getTitle(); final CharSequence previousSubtitle = view.getSubtitle(); // The toolbar inflates both the title and the subtitle views lazily but luckily they do it // synchronously when you set a ...
[ "private", "void", "applyFontToToolbar", "(", "final", "Toolbar", "view", ")", "{", "final", "CharSequence", "previousTitle", "=", "view", ".", "getTitle", "(", ")", ";", "final", "CharSequence", "previousSubtitle", "=", "view", ".", "getSubtitle", "(", ")", "...
Will forcibly set text on the views then remove ones that didn't have copy. @param view toolbar view.
[ "Will", "forcibly", "set", "text", "on", "the", "views", "then", "remove", "ones", "that", "didn", "t", "have", "copy", "." ]
085e441954d787bd4ef31f245afe5f2f2a311ea5
https://github.com/chrisjenx/Calligraphy/blob/085e441954d787bd4ef31f245afe5f2f2a311ea5/calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/CalligraphyFactory.java#L203-L220
train
chrisjenx/Calligraphy
calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/TypefaceUtils.java
TypefaceUtils.load
public static Typeface load(final AssetManager assetManager, final String filePath) { synchronized (sCachedFonts) { try { if (!sCachedFonts.containsKey(filePath)) { final Typeface typeface = Typeface.createFromAsset(assetManager, filePath); sCa...
java
public static Typeface load(final AssetManager assetManager, final String filePath) { synchronized (sCachedFonts) { try { if (!sCachedFonts.containsKey(filePath)) { final Typeface typeface = Typeface.createFromAsset(assetManager, filePath); sCa...
[ "public", "static", "Typeface", "load", "(", "final", "AssetManager", "assetManager", ",", "final", "String", "filePath", ")", "{", "synchronized", "(", "sCachedFonts", ")", "{", "try", "{", "if", "(", "!", "sCachedFonts", ".", "containsKey", "(", "filePath", ...
A helper loading a custom font. @param assetManager App's asset manager. @param filePath The path of the file. @return Return {@link android.graphics.Typeface} or null if the path is invalid.
[ "A", "helper", "loading", "a", "custom", "font", "." ]
085e441954d787bd4ef31f245afe5f2f2a311ea5
https://github.com/chrisjenx/Calligraphy/blob/085e441954d787bd4ef31f245afe5f2f2a311ea5/calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/TypefaceUtils.java#L31-L46
train
chrisjenx/Calligraphy
calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/TypefaceUtils.java
TypefaceUtils.getSpan
public static CalligraphyTypefaceSpan getSpan(final Typeface typeface) { if (typeface == null) return null; synchronized (sCachedSpans) { if (!sCachedSpans.containsKey(typeface)) { final CalligraphyTypefaceSpan span = new CalligraphyTypefaceSpan(typeface); sCa...
java
public static CalligraphyTypefaceSpan getSpan(final Typeface typeface) { if (typeface == null) return null; synchronized (sCachedSpans) { if (!sCachedSpans.containsKey(typeface)) { final CalligraphyTypefaceSpan span = new CalligraphyTypefaceSpan(typeface); sCa...
[ "public", "static", "CalligraphyTypefaceSpan", "getSpan", "(", "final", "Typeface", "typeface", ")", "{", "if", "(", "typeface", "==", "null", ")", "return", "null", ";", "synchronized", "(", "sCachedSpans", ")", "{", "if", "(", "!", "sCachedSpans", ".", "co...
A helper loading custom spans so we don't have to keep creating hundreds of spans. @param typeface not null typeface @return will return null of typeface passed in is null.
[ "A", "helper", "loading", "custom", "spans", "so", "we", "don", "t", "have", "to", "keep", "creating", "hundreds", "of", "spans", "." ]
085e441954d787bd4ef31f245afe5f2f2a311ea5
https://github.com/chrisjenx/Calligraphy/blob/085e441954d787bd4ef31f245afe5f2f2a311ea5/calligraphy/src/main/java/uk/co/chrisjenx/calligraphy/TypefaceUtils.java#L54-L64
train
crossoverJie/distributed-redis-tool
src/main/java/com/crossoverjie/distributed/util/ScriptUtil.java
ScriptUtil.getScript
public static String getScript(String path) { StringBuilder sb = new StringBuilder(); InputStream stream = ScriptUtil.class.getClassLoader().getResourceAsStream(path); try (BufferedReader br = new BufferedReader(new InputStreamReader(stream))){ String str; while ((str =...
java
public static String getScript(String path) { StringBuilder sb = new StringBuilder(); InputStream stream = ScriptUtil.class.getClassLoader().getResourceAsStream(path); try (BufferedReader br = new BufferedReader(new InputStreamReader(stream))){ String str; while ((str =...
[ "public", "static", "String", "getScript", "(", "String", "path", ")", "{", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", ")", ";", "InputStream", "stream", "=", "ScriptUtil", ".", "class", ".", "getClassLoader", "(", ")", ".", "getResourceAsStream"...
return lua script String @param path @return
[ "return", "lua", "script", "String" ]
57169feaccb6a56ab8821fa34e8e15954bb7b3b9
https://github.com/crossoverJie/distributed-redis-tool/blob/57169feaccb6a56ab8821fa34e8e15954bb7b3b9/src/main/java/com/crossoverjie/distributed/util/ScriptUtil.java#L20-L35
train
crossoverJie/distributed-redis-tool
src/main/java/com/crossoverjie/distributed/lock/RedisLock.java
RedisLock.getConnection
private Object getConnection() { Object connection ; if (type == RedisToolsConstant.SINGLE){ RedisConnection redisConnection = jedisConnectionFactory.getConnection(); connection = redisConnection.getNativeConnection(); }else { RedisClusterConnection clusterCon...
java
private Object getConnection() { Object connection ; if (type == RedisToolsConstant.SINGLE){ RedisConnection redisConnection = jedisConnectionFactory.getConnection(); connection = redisConnection.getNativeConnection(); }else { RedisClusterConnection clusterCon...
[ "private", "Object", "getConnection", "(", ")", "{", "Object", "connection", ";", "if", "(", "type", "==", "RedisToolsConstant", ".", "SINGLE", ")", "{", "RedisConnection", "redisConnection", "=", "jedisConnectionFactory", ".", "getConnection", "(", ")", ";", "c...
get Redis connection @return
[ "get", "Redis", "connection" ]
57169feaccb6a56ab8821fa34e8e15954bb7b3b9
https://github.com/crossoverJie/distributed-redis-tool/blob/57169feaccb6a56ab8821fa34e8e15954bb7b3b9/src/main/java/com/crossoverjie/distributed/lock/RedisLock.java#L64-L74
train
crossoverJie/distributed-redis-tool
src/main/java/com/crossoverjie/distributed/lock/RedisLock.java
RedisLock.tryLock
public boolean tryLock(String key, String request) { //get connection Object connection = getConnection(); String result ; if (connection instanceof Jedis){ result = ((Jedis) connection).set(lockPrefix + key, request, SET_IF_NOT_EXIST, SET_WITH_EXPIRE_TIME, 10 * TIME); ...
java
public boolean tryLock(String key, String request) { //get connection Object connection = getConnection(); String result ; if (connection instanceof Jedis){ result = ((Jedis) connection).set(lockPrefix + key, request, SET_IF_NOT_EXIST, SET_WITH_EXPIRE_TIME, 10 * TIME); ...
[ "public", "boolean", "tryLock", "(", "String", "key", ",", "String", "request", ")", "{", "//get connection", "Object", "connection", "=", "getConnection", "(", ")", ";", "String", "result", ";", "if", "(", "connection", "instanceof", "Jedis", ")", "{", "res...
Non-blocking lock @param key lock business type @param request value @return true lock success false lock fail
[ "Non", "-", "blocking", "lock" ]
57169feaccb6a56ab8821fa34e8e15954bb7b3b9
https://github.com/crossoverJie/distributed-redis-tool/blob/57169feaccb6a56ab8821fa34e8e15954bb7b3b9/src/main/java/com/crossoverjie/distributed/lock/RedisLock.java#L84-L101
train
real-logic/simple-binary-encoding
sbe-tool/src/main/java/uk/co/real_logic/sbe/xml/ErrorHandler.java
ErrorHandler.error
public void error(final String msg) { errors++; if (!suppressOutput) { out.println("ERROR: " + msg); } if (stopOnError) { throw new IllegalArgumentException(msg); } }
java
public void error(final String msg) { errors++; if (!suppressOutput) { out.println("ERROR: " + msg); } if (stopOnError) { throw new IllegalArgumentException(msg); } }
[ "public", "void", "error", "(", "final", "String", "msg", ")", "{", "errors", "++", ";", "if", "(", "!", "suppressOutput", ")", "{", "out", ".", "println", "(", "\"ERROR: \"", "+", "msg", ")", ";", "}", "if", "(", "stopOnError", ")", "{", "throw", ...
Record a message signifying an error condition. @param msg signifying an error.
[ "Record", "a", "message", "signifying", "an", "error", "condition", "." ]
9a7be490c86d98f0e430e4189bc6c8c4fbef658b
https://github.com/real-logic/simple-binary-encoding/blob/9a7be490c86d98f0e430e4189bc6c8c4fbef658b/sbe-tool/src/main/java/uk/co/real_logic/sbe/xml/ErrorHandler.java#L61-L74
train
real-logic/simple-binary-encoding
sbe-tool/src/main/java/uk/co/real_logic/sbe/xml/ErrorHandler.java
ErrorHandler.warning
public void warning(final String msg) { warnings++; if (!suppressOutput) { out.println("WARNING: " + msg); } if (warningsFatal && stopOnError) { throw new IllegalArgumentException(msg); } }
java
public void warning(final String msg) { warnings++; if (!suppressOutput) { out.println("WARNING: " + msg); } if (warningsFatal && stopOnError) { throw new IllegalArgumentException(msg); } }
[ "public", "void", "warning", "(", "final", "String", "msg", ")", "{", "warnings", "++", ";", "if", "(", "!", "suppressOutput", ")", "{", "out", ".", "println", "(", "\"WARNING: \"", "+", "msg", ")", ";", "}", "if", "(", "warningsFatal", "&&", "stopOnEr...
Record a message signifying an warning condition. @param msg signifying an warning.
[ "Record", "a", "message", "signifying", "an", "warning", "condition", "." ]
9a7be490c86d98f0e430e4189bc6c8c4fbef658b
https://github.com/real-logic/simple-binary-encoding/blob/9a7be490c86d98f0e430e4189bc6c8c4fbef658b/sbe-tool/src/main/java/uk/co/real_logic/sbe/xml/ErrorHandler.java#L81-L94
train
real-logic/simple-binary-encoding
sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/cpp/CppUtil.java
CppUtil.formatByteOrderEncoding
public static String formatByteOrderEncoding(final ByteOrder byteOrder, final PrimitiveType primitiveType) { switch (primitiveType.size()) { case 2: return "SBE_" + byteOrder + "_ENCODE_16"; case 4: return "SBE_" + byteOrder + "_ENCODE_32"; ...
java
public static String formatByteOrderEncoding(final ByteOrder byteOrder, final PrimitiveType primitiveType) { switch (primitiveType.size()) { case 2: return "SBE_" + byteOrder + "_ENCODE_16"; case 4: return "SBE_" + byteOrder + "_ENCODE_32"; ...
[ "public", "static", "String", "formatByteOrderEncoding", "(", "final", "ByteOrder", "byteOrder", ",", "final", "PrimitiveType", "primitiveType", ")", "{", "switch", "(", "primitiveType", ".", "size", "(", ")", ")", "{", "case", "2", ":", "return", "\"SBE_\"", ...
Return the Cpp98 formatted byte order encoding string to use for a given byte order and primitiveType @param byteOrder of the {@link uk.co.real_logic.sbe.ir.Token} @param primitiveType of the {@link uk.co.real_logic.sbe.ir.Token} @return the string formatted as the byte ordering encoding
[ "Return", "the", "Cpp98", "formatted", "byte", "order", "encoding", "string", "to", "use", "for", "a", "given", "byte", "order", "and", "primitiveType" ]
9a7be490c86d98f0e430e4189bc6c8c4fbef658b
https://github.com/real-logic/simple-binary-encoding/blob/9a7be490c86d98f0e430e4189bc6c8c4fbef658b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/cpp/CppUtil.java#L125-L141
train
real-logic/simple-binary-encoding
sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/golang/GolangUtil.java
GolangUtil.formatPropertyName
public static String formatPropertyName(final String value) { String formattedValue = toUpperFirstChar(value); if (ValidationUtil.isGolangKeyword(formattedValue)) { final String keywordAppendToken = System.getProperty(SbeTool.KEYWORD_APPEND_TOKEN); if (null == keywor...
java
public static String formatPropertyName(final String value) { String formattedValue = toUpperFirstChar(value); if (ValidationUtil.isGolangKeyword(formattedValue)) { final String keywordAppendToken = System.getProperty(SbeTool.KEYWORD_APPEND_TOKEN); if (null == keywor...
[ "public", "static", "String", "formatPropertyName", "(", "final", "String", "value", ")", "{", "String", "formattedValue", "=", "toUpperFirstChar", "(", "value", ")", ";", "if", "(", "ValidationUtil", ".", "isGolangKeyword", "(", "formattedValue", ")", ")", "{",...
Format a String as a property name. @param value to be formatted. @return the string formatted as a property name.
[ "Format", "a", "String", "as", "a", "property", "name", "." ]
9a7be490c86d98f0e430e4189bc6c8c4fbef658b
https://github.com/real-logic/simple-binary-encoding/blob/9a7be490c86d98f0e430e4189bc6c8c4fbef658b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/golang/GolangUtil.java#L115-L133
train
real-logic/simple-binary-encoding
sbe-tool/src/main/java/uk/co/real_logic/sbe/PrimitiveValue.java
PrimitiveValue.parse
public static PrimitiveValue parse( final String value, final int length, final String characterEncoding) { if (value.length() > length) { throw new IllegalStateException("value.length=" + value.length() + " greater than length=" + length); } byte[] bytes = value...
java
public static PrimitiveValue parse( final String value, final int length, final String characterEncoding) { if (value.length() > length) { throw new IllegalStateException("value.length=" + value.length() + " greater than length=" + length); } byte[] bytes = value...
[ "public", "static", "PrimitiveValue", "parse", "(", "final", "String", "value", ",", "final", "int", "length", ",", "final", "String", "characterEncoding", ")", "{", "if", "(", "value", ".", "length", "(", ")", ">", "length", ")", "{", "throw", "new", "I...
Parse constant value string and set representation based on type, length, and characterEncoding @param value expressed as a String @param length of the type @param characterEncoding of the String @return a new {@link PrimitiveValue} for the value. @throws IllegalArgumentException if parsing malf...
[ "Parse", "constant", "value", "string", "and", "set", "representation", "based", "on", "type", "length", "and", "characterEncoding" ]
9a7be490c86d98f0e430e4189bc6c8c4fbef658b
https://github.com/real-logic/simple-binary-encoding/blob/9a7be490c86d98f0e430e4189bc6c8c4fbef658b/sbe-tool/src/main/java/uk/co/real_logic/sbe/PrimitiveValue.java#L271-L286
train
real-logic/simple-binary-encoding
sbe-tool/src/main/java/uk/co/real_logic/sbe/PrimitiveValue.java
PrimitiveValue.byteArrayValue
public byte[] byteArrayValue(final PrimitiveType type) { if (representation == Representation.BYTE_ARRAY) { return byteArrayValue; } else if (representation == Representation.LONG && size == 1 && type == PrimitiveType.CHAR) { byteArrayValueForLong[0] =...
java
public byte[] byteArrayValue(final PrimitiveType type) { if (representation == Representation.BYTE_ARRAY) { return byteArrayValue; } else if (representation == Representation.LONG && size == 1 && type == PrimitiveType.CHAR) { byteArrayValueForLong[0] =...
[ "public", "byte", "[", "]", "byteArrayValue", "(", "final", "PrimitiveType", "type", ")", "{", "if", "(", "representation", "==", "Representation", ".", "BYTE_ARRAY", ")", "{", "return", "byteArrayValue", ";", "}", "else", "if", "(", "representation", "==", ...
Return byte array value for this PrimitiveValue given a particular type @param type of this value @return value expressed as a byte array @throws IllegalStateException if not a byte array value representation
[ "Return", "byte", "array", "value", "for", "this", "PrimitiveValue", "given", "a", "particular", "type" ]
9a7be490c86d98f0e430e4189bc6c8c4fbef658b
https://github.com/real-logic/simple-binary-encoding/blob/9a7be490c86d98f0e430e4189bc6c8c4fbef658b/sbe-tool/src/main/java/uk/co/real_logic/sbe/PrimitiveValue.java#L346-L359
train
real-logic/simple-binary-encoding
sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/java/JavaUtil.java
JavaUtil.append
public static void append(final StringBuilder builder, final String indent, final String line) { builder.append(indent).append(line).append('\n'); }
java
public static void append(final StringBuilder builder, final String indent, final String line) { builder.append(indent).append(line).append('\n'); }
[ "public", "static", "void", "append", "(", "final", "StringBuilder", "builder", ",", "final", "String", "indent", ",", "final", "String", "line", ")", "{", "builder", ".", "append", "(", "indent", ")", ".", "append", "(", "line", ")", ".", "append", "(",...
Shortcut to append a line of generated code @param builder string builder to which to append the line @param indent current text indentation @param line line to be appended
[ "Shortcut", "to", "append", "a", "line", "of", "generated", "code" ]
9a7be490c86d98f0e430e4189bc6c8c4fbef658b
https://github.com/real-logic/simple-binary-encoding/blob/9a7be490c86d98f0e430e4189bc6c8c4fbef658b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/java/JavaUtil.java#L178-L181
train
real-logic/simple-binary-encoding
sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/java/JavaUtil.java
JavaUtil.generateTypeJavadoc
public static String generateTypeJavadoc(final String indent, final Token typeToken) { final String description = typeToken.description(); if (null == description || description.isEmpty()) { return ""; } return indent + "/**\n" + indent + ...
java
public static String generateTypeJavadoc(final String indent, final Token typeToken) { final String description = typeToken.description(); if (null == description || description.isEmpty()) { return ""; } return indent + "/**\n" + indent + ...
[ "public", "static", "String", "generateTypeJavadoc", "(", "final", "String", "indent", ",", "final", "Token", "typeToken", ")", "{", "final", "String", "description", "=", "typeToken", ".", "description", "(", ")", ";", "if", "(", "null", "==", "description", ...
Generate the Javadoc comment header for a type. @param indent level for the comment. @param typeToken for the type. @return a string representation of the Javadoc comment.
[ "Generate", "the", "Javadoc", "comment", "header", "for", "a", "type", "." ]
9a7be490c86d98f0e430e4189bc6c8c4fbef658b
https://github.com/real-logic/simple-binary-encoding/blob/9a7be490c86d98f0e430e4189bc6c8c4fbef658b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/java/JavaUtil.java#L259-L271
train
real-logic/simple-binary-encoding
sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/java/JavaUtil.java
JavaUtil.generateOptionEncodeJavadoc
public static String generateOptionEncodeJavadoc(final String indent, final Token optionToken) { final String description = optionToken.description(); if (null == description || description.isEmpty()) { return ""; } return indent + "/**\n" + ...
java
public static String generateOptionEncodeJavadoc(final String indent, final Token optionToken) { final String description = optionToken.description(); if (null == description || description.isEmpty()) { return ""; } return indent + "/**\n" + ...
[ "public", "static", "String", "generateOptionEncodeJavadoc", "(", "final", "String", "indent", ",", "final", "Token", "optionToken", ")", "{", "final", "String", "description", "=", "optionToken", ".", "description", "(", ")", ";", "if", "(", "null", "==", "de...
Generate the Javadoc comment header for a bitset choice option encode method. @param indent level for the comment. @param optionToken for the type. @return a string representation of the Javadoc comment.
[ "Generate", "the", "Javadoc", "comment", "header", "for", "a", "bitset", "choice", "option", "encode", "method", "." ]
9a7be490c86d98f0e430e4189bc6c8c4fbef658b
https://github.com/real-logic/simple-binary-encoding/blob/9a7be490c86d98f0e430e4189bc6c8c4fbef658b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/java/JavaUtil.java#L303-L317
train
real-logic/simple-binary-encoding
sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/java/JavaUtil.java
JavaUtil.generateFlyweightPropertyJavadoc
public static String generateFlyweightPropertyJavadoc( final String indent, final Token propertyToken, final String typeName) { final String description = propertyToken.description(); if (null == description || description.isEmpty()) { return ""; } return...
java
public static String generateFlyweightPropertyJavadoc( final String indent, final Token propertyToken, final String typeName) { final String description = propertyToken.description(); if (null == description || description.isEmpty()) { return ""; } return...
[ "public", "static", "String", "generateFlyweightPropertyJavadoc", "(", "final", "String", "indent", ",", "final", "Token", "propertyToken", ",", "final", "String", "typeName", ")", "{", "final", "String", "description", "=", "propertyToken", ".", "description", "(",...
Generate the Javadoc comment header for flyweight property. @param indent level for the comment. @param propertyToken for the property name. @param typeName for the property type. @return a string representation of the Javadoc comment.
[ "Generate", "the", "Javadoc", "comment", "header", "for", "flyweight", "property", "." ]
9a7be490c86d98f0e430e4189bc6c8c4fbef658b
https://github.com/real-logic/simple-binary-encoding/blob/9a7be490c86d98f0e430e4189bc6c8c4fbef658b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/java/JavaUtil.java#L327-L342
train
real-logic/simple-binary-encoding
sbe-tool/src/main/java/uk/co/real_logic/sbe/xml/XmlSchemaParser.java
XmlSchemaParser.findMessages
public static Map<Long, Message> findMessages( final Document document, final XPath xPath, final Map<String, Type> typeByNameMap) throws Exception { final Map<Long, Message> messageByIdMap = new HashMap<>(); final ObjectHashSet<String> distinctNames = new ObjectHashSet<>(); forEach(...
java
public static Map<Long, Message> findMessages( final Document document, final XPath xPath, final Map<String, Type> typeByNameMap) throws Exception { final Map<Long, Message> messageByIdMap = new HashMap<>(); final ObjectHashSet<String> distinctNames = new ObjectHashSet<>(); forEach(...
[ "public", "static", "Map", "<", "Long", ",", "Message", ">", "findMessages", "(", "final", "Document", "document", ",", "final", "XPath", "xPath", ",", "final", "Map", "<", "String", ",", "Type", ">", "typeByNameMap", ")", "throws", "Exception", "{", "fina...
Scan XML for all message definitions and save in map @param document for the XML parsing @param xPath for XPath expression reuse @param typeByNameMap to use for Type objects @return {@link java.util.Map} of schemaId to Message @throws Exception on parsing error.
[ "Scan", "XML", "for", "all", "message", "definitions", "and", "save", "in", "map" ]
9a7be490c86d98f0e430e4189bc6c8c4fbef658b
https://github.com/real-logic/simple-binary-encoding/blob/9a7be490c86d98f0e430e4189bc6c8c4fbef658b/sbe-tool/src/main/java/uk/co/real_logic/sbe/xml/XmlSchemaParser.java#L220-L230
train
real-logic/simple-binary-encoding
sbe-tool/src/main/java/uk/co/real_logic/sbe/xml/XmlSchemaParser.java
XmlSchemaParser.handleError
public static void handleError(final Node node, final String msg) { final ErrorHandler handler = (ErrorHandler)node.getOwnerDocument().getUserData(ERROR_HANDLER_KEY); if (handler == null) { throw new IllegalStateException("ERROR: " + formatLocationInfo(node) + msg); } ...
java
public static void handleError(final Node node, final String msg) { final ErrorHandler handler = (ErrorHandler)node.getOwnerDocument().getUserData(ERROR_HANDLER_KEY); if (handler == null) { throw new IllegalStateException("ERROR: " + formatLocationInfo(node) + msg); } ...
[ "public", "static", "void", "handleError", "(", "final", "Node", "node", ",", "final", "String", "msg", ")", "{", "final", "ErrorHandler", "handler", "=", "(", "ErrorHandler", ")", "node", ".", "getOwnerDocument", "(", ")", ".", "getUserData", "(", "ERROR_HA...
Handle an error condition as consequence of parsing. @param node that is the context of the warning. @param msg associated with the error.
[ "Handle", "an", "error", "condition", "as", "consequence", "of", "parsing", "." ]
9a7be490c86d98f0e430e4189bc6c8c4fbef658b
https://github.com/real-logic/simple-binary-encoding/blob/9a7be490c86d98f0e430e4189bc6c8c4fbef658b/sbe-tool/src/main/java/uk/co/real_logic/sbe/xml/XmlSchemaParser.java#L238-L250
train
real-logic/simple-binary-encoding
sbe-tool/src/main/java/uk/co/real_logic/sbe/xml/XmlSchemaParser.java
XmlSchemaParser.handleWarning
public static void handleWarning(final Node node, final String msg) { final ErrorHandler handler = (ErrorHandler)node.getOwnerDocument().getUserData(ERROR_HANDLER_KEY); if (handler == null) { throw new IllegalStateException("WARNING: " + formatLocationInfo(node) + msg); ...
java
public static void handleWarning(final Node node, final String msg) { final ErrorHandler handler = (ErrorHandler)node.getOwnerDocument().getUserData(ERROR_HANDLER_KEY); if (handler == null) { throw new IllegalStateException("WARNING: " + formatLocationInfo(node) + msg); ...
[ "public", "static", "void", "handleWarning", "(", "final", "Node", "node", ",", "final", "String", "msg", ")", "{", "final", "ErrorHandler", "handler", "=", "(", "ErrorHandler", ")", "node", ".", "getOwnerDocument", "(", ")", ".", "getUserData", "(", "ERROR_...
Handle a warning condition as a consequence of parsing. @param node as the context for the warning. @param msg associated with the warning.
[ "Handle", "a", "warning", "condition", "as", "a", "consequence", "of", "parsing", "." ]
9a7be490c86d98f0e430e4189bc6c8c4fbef658b
https://github.com/real-logic/simple-binary-encoding/blob/9a7be490c86d98f0e430e4189bc6c8c4fbef658b/sbe-tool/src/main/java/uk/co/real_logic/sbe/xml/XmlSchemaParser.java#L258-L270
train
real-logic/simple-binary-encoding
sbe-tool/src/main/java/uk/co/real_logic/sbe/xml/XmlSchemaParser.java
XmlSchemaParser.getAttributeValue
public static String getAttributeValue(final Node elementNode, final String attrName) { final Node attrNode = elementNode.getAttributes().getNamedItemNS(null, attrName); if (attrNode == null || "".equals(attrNode.getNodeValue())) { throw new IllegalStateException( ...
java
public static String getAttributeValue(final Node elementNode, final String attrName) { final Node attrNode = elementNode.getAttributes().getNamedItemNS(null, attrName); if (attrNode == null || "".equals(attrNode.getNodeValue())) { throw new IllegalStateException( ...
[ "public", "static", "String", "getAttributeValue", "(", "final", "Node", "elementNode", ",", "final", "String", "attrName", ")", "{", "final", "Node", "attrNode", "=", "elementNode", ".", "getAttributes", "(", ")", ".", "getNamedItemNS", "(", "null", ",", "att...
Helper function that throws an exception when the attribute is not set. @param elementNode that should have the attribute @param attrName that is to be looked up @return value of the attribute @throws IllegalArgumentException if the attribute is not present
[ "Helper", "function", "that", "throws", "an", "exception", "when", "the", "attribute", "is", "not", "set", "." ]
9a7be490c86d98f0e430e4189bc6c8c4fbef658b
https://github.com/real-logic/simple-binary-encoding/blob/9a7be490c86d98f0e430e4189bc6c8c4fbef658b/sbe-tool/src/main/java/uk/co/real_logic/sbe/xml/XmlSchemaParser.java#L280-L291
train
real-logic/simple-binary-encoding
sbe-tool/src/main/java/uk/co/real_logic/sbe/xml/XmlSchemaParser.java
XmlSchemaParser.getAttributeValue
public static String getAttributeValue(final Node elementNode, final String attrName, final String defValue) { final Node attrNode = elementNode.getAttributes().getNamedItemNS(null, attrName); if (attrNode == null) { return defValue; } return attrNode.getNodeVal...
java
public static String getAttributeValue(final Node elementNode, final String attrName, final String defValue) { final Node attrNode = elementNode.getAttributes().getNamedItemNS(null, attrName); if (attrNode == null) { return defValue; } return attrNode.getNodeVal...
[ "public", "static", "String", "getAttributeValue", "(", "final", "Node", "elementNode", ",", "final", "String", "attrName", ",", "final", "String", "defValue", ")", "{", "final", "Node", "attrNode", "=", "elementNode", ".", "getAttributes", "(", ")", ".", "get...
Helper function that uses a default value when value not set. @param elementNode that should have the attribute @param attrName that is to be looked up @param defValue String to return if not set @return value of the attribute or defValue
[ "Helper", "function", "that", "uses", "a", "default", "value", "when", "value", "not", "set", "." ]
9a7be490c86d98f0e430e4189bc6c8c4fbef658b
https://github.com/real-logic/simple-binary-encoding/blob/9a7be490c86d98f0e430e4189bc6c8c4fbef658b/sbe-tool/src/main/java/uk/co/real_logic/sbe/xml/XmlSchemaParser.java#L301-L311
train
real-logic/simple-binary-encoding
sbe-tool/src/main/java/uk/co/real_logic/sbe/xml/XmlSchemaParser.java
XmlSchemaParser.checkForValidName
public static void checkForValidName(final Node node, final String name) { if (!ValidationUtil.isSbeCppName(name)) { handleWarning(node, "name is not valid for C++: " + name); } if (!ValidationUtil.isSbeJavaName(name)) { handleWarning(node, "name is n...
java
public static void checkForValidName(final Node node, final String name) { if (!ValidationUtil.isSbeCppName(name)) { handleWarning(node, "name is not valid for C++: " + name); } if (!ValidationUtil.isSbeJavaName(name)) { handleWarning(node, "name is n...
[ "public", "static", "void", "checkForValidName", "(", "final", "Node", "node", ",", "final", "String", "name", ")", "{", "if", "(", "!", "ValidationUtil", ".", "isSbeCppName", "(", "name", ")", ")", "{", "handleWarning", "(", "node", ",", "\"name is not vali...
Check name against validity for C++ and Java naming. Warning if not valid. @param node to have the name checked. @param name of the node to be checked.
[ "Check", "name", "against", "validity", "for", "C", "++", "and", "Java", "naming", ".", "Warning", "if", "not", "valid", "." ]
9a7be490c86d98f0e430e4189bc6c8c4fbef658b
https://github.com/real-logic/simple-binary-encoding/blob/9a7be490c86d98f0e430e4189bc6c8c4fbef658b/sbe-tool/src/main/java/uk/co/real_logic/sbe/xml/XmlSchemaParser.java#L363-L384
train
real-logic/simple-binary-encoding
sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/golang/GolangGenerator.java
GolangGenerator.generateFieldEncodeDecode
private int generateFieldEncodeDecode( final List<Token> tokens, final char varName, final int currentOffset, final StringBuilder encode, final StringBuilder decode, final StringBuilder rc, final StringBuilder init) { final Token signalToken = tokens.g...
java
private int generateFieldEncodeDecode( final List<Token> tokens, final char varName, final int currentOffset, final StringBuilder encode, final StringBuilder decode, final StringBuilder rc, final StringBuilder init) { final Token signalToken = tokens.g...
[ "private", "int", "generateFieldEncodeDecode", "(", "final", "List", "<", "Token", ">", "tokens", ",", "final", "char", "varName", ",", "final", "int", "currentOffset", ",", "final", "StringBuilder", "encode", ",", "final", "StringBuilder", "decode", ",", "final...
Returns how many extra tokens to skip over
[ "Returns", "how", "many", "extra", "tokens", "to", "skip", "over" ]
9a7be490c86d98f0e430e4189bc6c8c4fbef658b
https://github.com/real-logic/simple-binary-encoding/blob/9a7be490c86d98f0e430e4189bc6c8c4fbef658b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/golang/GolangGenerator.java#L980-L1072
train
real-logic/simple-binary-encoding
sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/golang/GolangGenerator.java
GolangGenerator.generateGroupProperties
private void generateGroupProperties( final StringBuilder sb, final List<Token> tokens, final String prefix) { for (int i = 0, size = tokens.size(); i < size; i++) { final Token token = tokens.get(i); if (token.signal() == Signal.BEGIN_GROUP) ...
java
private void generateGroupProperties( final StringBuilder sb, final List<Token> tokens, final String prefix) { for (int i = 0, size = tokens.size(); i < size; i++) { final Token token = tokens.get(i); if (token.signal() == Signal.BEGIN_GROUP) ...
[ "private", "void", "generateGroupProperties", "(", "final", "StringBuilder", "sb", ",", "final", "List", "<", "Token", ">", "tokens", ",", "final", "String", "prefix", ")", "{", "for", "(", "int", "i", "=", "0", ",", "size", "=", "tokens", ".", "size", ...
Recursively traverse groups to create the group properties
[ "Recursively", "traverse", "groups", "to", "create", "the", "group", "properties" ]
9a7be490c86d98f0e430e4189bc6c8c4fbef658b
https://github.com/real-logic/simple-binary-encoding/blob/9a7be490c86d98f0e430e4189bc6c8c4fbef658b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/golang/GolangGenerator.java#L1284-L1308
train
real-logic/simple-binary-encoding
sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/golang/GolangGenerator.java
GolangGenerator.generateExtensibilityMethods
private void generateExtensibilityMethods( final StringBuilder sb, final String typeName, final Token token) { sb.append(String.format( "\nfunc (*%1$s) SbeBlockLength() (blockLength uint) {\n" + "\treturn %2$s\n" + "}\n" + "\nfunc (*%1$...
java
private void generateExtensibilityMethods( final StringBuilder sb, final String typeName, final Token token) { sb.append(String.format( "\nfunc (*%1$s) SbeBlockLength() (blockLength uint) {\n" + "\treturn %2$s\n" + "}\n" + "\nfunc (*%1$...
[ "private", "void", "generateExtensibilityMethods", "(", "final", "StringBuilder", "sb", ",", "final", "String", "typeName", ",", "final", "Token", "token", ")", "{", "sb", ".", "append", "(", "String", ".", "format", "(", "\"\\nfunc (*%1$s) SbeBlockLength() (blockLe...
of block length and version to check for extensions
[ "of", "block", "length", "and", "version", "to", "check", "for", "extensions" ]
9a7be490c86d98f0e430e4189bc6c8c4fbef658b
https://github.com/real-logic/simple-binary-encoding/blob/9a7be490c86d98f0e430e4189bc6c8c4fbef658b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/golang/GolangGenerator.java#L2067-L2083
train
real-logic/simple-binary-encoding
sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/c/CUtil.java
CUtil.formatScopedName
public static String formatScopedName(final CharSequence[] scope, final String value) { return String.join("_", scope).toLowerCase() + "_" + formatName(value); }
java
public static String formatScopedName(final CharSequence[] scope, final String value) { return String.join("_", scope).toLowerCase() + "_" + formatName(value); }
[ "public", "static", "String", "formatScopedName", "(", "final", "CharSequence", "[", "]", "scope", ",", "final", "String", "value", ")", "{", "return", "String", ".", "join", "(", "\"_\"", ",", "scope", ")", ".", "toLowerCase", "(", ")", "+", "\"_\"", "+...
Format a String as a struct name prepended with a scope. @param scope to be prepended. @param value to be formatted. @return the string formatted as a struct name.
[ "Format", "a", "String", "as", "a", "struct", "name", "prepended", "with", "a", "scope", "." ]
9a7be490c86d98f0e430e4189bc6c8c4fbef658b
https://github.com/real-logic/simple-binary-encoding/blob/9a7be490c86d98f0e430e4189bc6c8c4fbef658b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/c/CUtil.java#L125-L128
train
real-logic/simple-binary-encoding
sbe-tool/src/main/java/uk/co/real_logic/sbe/SbeTool.java
SbeTool.main
public static void main(final String[] args) throws Exception { if (args.length == 0) { System.err.format("Usage: %s <filenames>...%n", SbeTool.class.getName()); System.exit(-1); } for (final String fileName : args) { final Ir ir; ...
java
public static void main(final String[] args) throws Exception { if (args.length == 0) { System.err.format("Usage: %s <filenames>...%n", SbeTool.class.getName()); System.exit(-1); } for (final String fileName : args) { final Ir ir; ...
[ "public", "static", "void", "main", "(", "final", "String", "[", "]", "args", ")", "throws", "Exception", "{", "if", "(", "args", ".", "length", "==", "0", ")", "{", "System", ".", "err", ".", "format", "(", "\"Usage: %s <filenames>...%n\"", ",", "SbeToo...
Main entry point for the SBE Tool. @param args command line arguments. A single filename is expected. @throws Exception if an error occurs during process of the message schema.
[ "Main", "entry", "point", "for", "the", "SBE", "Tool", "." ]
9a7be490c86d98f0e430e4189bc6c8c4fbef658b
https://github.com/real-logic/simple-binary-encoding/blob/9a7be490c86d98f0e430e4189bc6c8c4fbef658b/sbe-tool/src/main/java/uk/co/real_logic/sbe/SbeTool.java#L188-L242
train
real-logic/simple-binary-encoding
sbe-tool/src/main/java/uk/co/real_logic/sbe/SbeTool.java
SbeTool.validateAgainstSchema
public static void validateAgainstSchema(final String sbeSchemaFilename, final String xsdFilename) throws Exception { final ParserOptions.Builder optionsBuilder = ParserOptions.builder() .xsdFilename(System.getProperty(VALIDATION_XSD)) .xIncludeAware(Boolean.parseBoolean(Syst...
java
public static void validateAgainstSchema(final String sbeSchemaFilename, final String xsdFilename) throws Exception { final ParserOptions.Builder optionsBuilder = ParserOptions.builder() .xsdFilename(System.getProperty(VALIDATION_XSD)) .xIncludeAware(Boolean.parseBoolean(Syst...
[ "public", "static", "void", "validateAgainstSchema", "(", "final", "String", "sbeSchemaFilename", ",", "final", "String", "xsdFilename", ")", "throws", "Exception", "{", "final", "ParserOptions", ".", "Builder", "optionsBuilder", "=", "ParserOptions", ".", "builder", ...
Validate the SBE Schema against the XSD. @param sbeSchemaFilename to be validated. @param xsdFilename XSD against which to validate. @throws Exception if an error occurs while validating.
[ "Validate", "the", "SBE", "Schema", "against", "the", "XSD", "." ]
9a7be490c86d98f0e430e4189bc6c8c4fbef658b
https://github.com/real-logic/simple-binary-encoding/blob/9a7be490c86d98f0e430e4189bc6c8c4fbef658b/sbe-tool/src/main/java/uk/co/real_logic/sbe/SbeTool.java#L251-L272
train
real-logic/simple-binary-encoding
sbe-tool/src/main/java/uk/co/real_logic/sbe/SbeTool.java
SbeTool.generate
public static void generate(final Ir ir, final String outputDirName, final String targetLanguage) throws Exception { final TargetCodeGenerator targetCodeGenerator = TargetCodeGeneratorLoader.get(targetLanguage); final CodeGenerator codeGenerator = targetCodeGenerator.newInstance(ir, outputDi...
java
public static void generate(final Ir ir, final String outputDirName, final String targetLanguage) throws Exception { final TargetCodeGenerator targetCodeGenerator = TargetCodeGeneratorLoader.get(targetLanguage); final CodeGenerator codeGenerator = targetCodeGenerator.newInstance(ir, outputDi...
[ "public", "static", "void", "generate", "(", "final", "Ir", "ir", ",", "final", "String", "outputDirName", ",", "final", "String", "targetLanguage", ")", "throws", "Exception", "{", "final", "TargetCodeGenerator", "targetCodeGenerator", "=", "TargetCodeGeneratorLoader...
Generate SBE encoding and decoding stubs for a target language. @param ir for the parsed specification. @param outputDirName directory into which code will be generated. @param targetLanguage for the generated code. @throws Exception if an error occurs while generating the code.
[ "Generate", "SBE", "encoding", "and", "decoding", "stubs", "for", "a", "target", "language", "." ]
9a7be490c86d98f0e430e4189bc6c8c4fbef658b
https://github.com/real-logic/simple-binary-encoding/blob/9a7be490c86d98f0e430e4189bc6c8c4fbef658b/sbe-tool/src/main/java/uk/co/real_logic/sbe/SbeTool.java#L312-L319
train
real-logic/simple-binary-encoding
sbe-tool/src/main/java/uk/co/real_logic/sbe/xml/CompositeType.java
CompositeType.makeDataFieldCompositeType
public void makeDataFieldCompositeType() { final EncodedDataType edt = (EncodedDataType)containedTypeByNameMap.get("varData"); if (edt != null) { edt.variableLength(true); } }
java
public void makeDataFieldCompositeType() { final EncodedDataType edt = (EncodedDataType)containedTypeByNameMap.get("varData"); if (edt != null) { edt.variableLength(true); } }
[ "public", "void", "makeDataFieldCompositeType", "(", ")", "{", "final", "EncodedDataType", "edt", "=", "(", "EncodedDataType", ")", "containedTypeByNameMap", ".", "get", "(", "\"varData\"", ")", ";", "if", "(", "edt", "!=", "null", ")", "{", "edt", ".", "var...
Make this composite type, if it has a varData member, variable length by making the EncodedDataType with the name "varData" be variable length.
[ "Make", "this", "composite", "type", "if", "it", "has", "a", "varData", "member", "variable", "length", "by", "making", "the", "EncodedDataType", "with", "the", "name", "varData", "be", "variable", "length", "." ]
9a7be490c86d98f0e430e4189bc6c8c4fbef658b
https://github.com/real-logic/simple-binary-encoding/blob/9a7be490c86d98f0e430e4189bc6c8c4fbef658b/sbe-tool/src/main/java/uk/co/real_logic/sbe/xml/CompositeType.java#L146-L153
train
real-logic/simple-binary-encoding
sbe-tool/src/main/java/uk/co/real_logic/sbe/xml/CompositeType.java
CompositeType.checkForWellFormedGroupSizeEncoding
public void checkForWellFormedGroupSizeEncoding(final Node node) { final EncodedDataType blockLengthType = (EncodedDataType)containedTypeByNameMap.get("blockLength"); final EncodedDataType numInGroupType = (EncodedDataType)containedTypeByNameMap.get("numInGroup"); if (blockLengthType == nul...
java
public void checkForWellFormedGroupSizeEncoding(final Node node) { final EncodedDataType blockLengthType = (EncodedDataType)containedTypeByNameMap.get("blockLength"); final EncodedDataType numInGroupType = (EncodedDataType)containedTypeByNameMap.get("numInGroup"); if (blockLengthType == nul...
[ "public", "void", "checkForWellFormedGroupSizeEncoding", "(", "final", "Node", "node", ")", "{", "final", "EncodedDataType", "blockLengthType", "=", "(", "EncodedDataType", ")", "containedTypeByNameMap", ".", "get", "(", "\"blockLength\"", ")", ";", "final", "EncodedD...
Check the composite for being a well formed group encodedLength encoding. This means that there are the fields "blockLength" and "numInGroup" present. @param node of the XML for this composite
[ "Check", "the", "composite", "for", "being", "a", "well", "formed", "group", "encodedLength", "encoding", ".", "This", "means", "that", "there", "are", "the", "fields", "blockLength", "and", "numInGroup", "present", "." ]
9a7be490c86d98f0e430e4189bc6c8c4fbef658b
https://github.com/real-logic/simple-binary-encoding/blob/9a7be490c86d98f0e430e4189bc6c8c4fbef658b/sbe-tool/src/main/java/uk/co/real_logic/sbe/xml/CompositeType.java#L161-L227
train
real-logic/simple-binary-encoding
sbe-tool/src/main/java/uk/co/real_logic/sbe/xml/CompositeType.java
CompositeType.checkForWellFormedVariableLengthDataEncoding
public void checkForWellFormedVariableLengthDataEncoding(final Node node) { final EncodedDataType lengthType = (EncodedDataType)containedTypeByNameMap.get("length"); if (lengthType == null) { XmlSchemaParser.handleError(node, "composite for variable length data encoding must hav...
java
public void checkForWellFormedVariableLengthDataEncoding(final Node node) { final EncodedDataType lengthType = (EncodedDataType)containedTypeByNameMap.get("length"); if (lengthType == null) { XmlSchemaParser.handleError(node, "composite for variable length data encoding must hav...
[ "public", "void", "checkForWellFormedVariableLengthDataEncoding", "(", "final", "Node", "node", ")", "{", "final", "EncodedDataType", "lengthType", "=", "(", "EncodedDataType", ")", "containedTypeByNameMap", ".", "get", "(", "\"length\"", ")", ";", "if", "(", "lengt...
Check the composite for being a well formed variable length data encoding. This means that there are the fields "length" and "varData" present. @param node of the XML for this composite
[ "Check", "the", "composite", "for", "being", "a", "well", "formed", "variable", "length", "data", "encoding", ".", "This", "means", "that", "there", "are", "the", "fields", "length", "and", "varData", "present", "." ]
9a7be490c86d98f0e430e4189bc6c8c4fbef658b
https://github.com/real-logic/simple-binary-encoding/blob/9a7be490c86d98f0e430e4189bc6c8c4fbef658b/sbe-tool/src/main/java/uk/co/real_logic/sbe/xml/CompositeType.java#L235-L268
train
real-logic/simple-binary-encoding
sbe-tool/src/main/java/uk/co/real_logic/sbe/xml/CompositeType.java
CompositeType.checkForWellFormedMessageHeader
public void checkForWellFormedMessageHeader(final Node node) { final boolean shouldGenerateInterfaces = Boolean.getBoolean(JAVA_GENERATE_INTERFACES); final EncodedDataType blockLengthType = (EncodedDataType)containedTypeByNameMap.get("blockLength"); final EncodedDataType templateIdType = (E...
java
public void checkForWellFormedMessageHeader(final Node node) { final boolean shouldGenerateInterfaces = Boolean.getBoolean(JAVA_GENERATE_INTERFACES); final EncodedDataType blockLengthType = (EncodedDataType)containedTypeByNameMap.get("blockLength"); final EncodedDataType templateIdType = (E...
[ "public", "void", "checkForWellFormedMessageHeader", "(", "final", "Node", "node", ")", "{", "final", "boolean", "shouldGenerateInterfaces", "=", "Boolean", ".", "getBoolean", "(", "JAVA_GENERATE_INTERFACES", ")", ";", "final", "EncodedDataType", "blockLengthType", "=",...
Check the composite for being a well formed message headerStructure encoding. This means that there are the fields "blockLength", "templateId" and "version" present. @param node of the XML for this composite
[ "Check", "the", "composite", "for", "being", "a", "well", "formed", "message", "headerStructure", "encoding", ".", "This", "means", "that", "there", "are", "the", "fields", "blockLength", "templateId", "and", "version", "present", "." ]
9a7be490c86d98f0e430e4189bc6c8c4fbef658b
https://github.com/real-logic/simple-binary-encoding/blob/9a7be490c86d98f0e430e4189bc6c8c4fbef658b/sbe-tool/src/main/java/uk/co/real_logic/sbe/xml/CompositeType.java#L304-L326
train
real-logic/simple-binary-encoding
sbe-tool/src/main/java/uk/co/real_logic/sbe/xml/CompositeType.java
CompositeType.checkForValidOffsets
public void checkForValidOffsets(final Node node) { int offset = 0; for (final Type edt : containedTypeByNameMap.values()) { final int offsetAttribute = edt.offsetAttribute(); if (-1 != offsetAttribute) { if (offsetAttribute < offset) ...
java
public void checkForValidOffsets(final Node node) { int offset = 0; for (final Type edt : containedTypeByNameMap.values()) { final int offsetAttribute = edt.offsetAttribute(); if (-1 != offsetAttribute) { if (offsetAttribute < offset) ...
[ "public", "void", "checkForValidOffsets", "(", "final", "Node", "node", ")", "{", "int", "offset", "=", "0", ";", "for", "(", "final", "Type", "edt", ":", "containedTypeByNameMap", ".", "values", "(", ")", ")", "{", "final", "int", "offsetAttribute", "=", ...
Check the composite for any specified offsets and validate they are correctly specified. @param node of the XML for this composite
[ "Check", "the", "composite", "for", "any", "specified", "offsets", "and", "validate", "they", "are", "correctly", "specified", "." ]
9a7be490c86d98f0e430e4189bc6c8c4fbef658b
https://github.com/real-logic/simple-binary-encoding/blob/9a7be490c86d98f0e430e4189bc6c8c4fbef658b/sbe-tool/src/main/java/uk/co/real_logic/sbe/xml/CompositeType.java#L374-L396
train
real-logic/simple-binary-encoding
sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/Generators.java
Generators.findFirst
public static Token findFirst(final String name, final List<Token> tokens, final int index) { for (int i = index, size = tokens.size(); i < size; i++) { final Token token = tokens.get(i); if (token.name().equals(name)) { return token; }...
java
public static Token findFirst(final String name, final List<Token> tokens, final int index) { for (int i = index, size = tokens.size(); i < size; i++) { final Token token = tokens.get(i); if (token.name().equals(name)) { return token; }...
[ "public", "static", "Token", "findFirst", "(", "final", "String", "name", ",", "final", "List", "<", "Token", ">", "tokens", ",", "final", "int", "index", ")", "{", "for", "(", "int", "i", "=", "index", ",", "size", "=", "tokens", ".", "size", "(", ...
Find the first token with a given name from an index inclusive. @param name to search for. @param tokens to search. @param index from which to search. @return first found {@link Token} or throw a {@link IllegalStateException} if not found.
[ "Find", "the", "first", "token", "with", "a", "given", "name", "from", "an", "index", "inclusive", "." ]
9a7be490c86d98f0e430e4189bc6c8c4fbef658b
https://github.com/real-logic/simple-binary-encoding/blob/9a7be490c86d98f0e430e4189bc6c8c4fbef658b/sbe-tool/src/main/java/uk/co/real_logic/sbe/generation/Generators.java#L91-L103
train
real-logic/simple-binary-encoding
sbe-tool/src/main/java/uk/co/real_logic/sbe/otf/OtfHeaderDecoder.java
OtfHeaderDecoder.getTemplateId
public int getTemplateId(final DirectBuffer buffer, final int bufferOffset) { return Types.getInt(buffer, bufferOffset + templateIdOffset, templateIdType, templateIdByteOrder); }
java
public int getTemplateId(final DirectBuffer buffer, final int bufferOffset) { return Types.getInt(buffer, bufferOffset + templateIdOffset, templateIdType, templateIdByteOrder); }
[ "public", "int", "getTemplateId", "(", "final", "DirectBuffer", "buffer", ",", "final", "int", "bufferOffset", ")", "{", "return", "Types", ".", "getInt", "(", "buffer", ",", "bufferOffset", "+", "templateIdOffset", ",", "templateIdType", ",", "templateIdByteOrder...
Get the template id from the message header. @param buffer from which to read the value. @param bufferOffset in the buffer at which the message header begins. @return the value of the template id.
[ "Get", "the", "template", "id", "from", "the", "message", "header", "." ]
9a7be490c86d98f0e430e4189bc6c8c4fbef658b
https://github.com/real-logic/simple-binary-encoding/blob/9a7be490c86d98f0e430e4189bc6c8c4fbef658b/sbe-tool/src/main/java/uk/co/real_logic/sbe/otf/OtfHeaderDecoder.java#L106-L109
train
real-logic/simple-binary-encoding
sbe-tool/src/main/java/uk/co/real_logic/sbe/otf/OtfHeaderDecoder.java
OtfHeaderDecoder.getSchemaId
public int getSchemaId(final DirectBuffer buffer, final int bufferOffset) { return Types.getInt(buffer, bufferOffset + schemaIdOffset, schemaIdType, schemaIdByteOrder); }
java
public int getSchemaId(final DirectBuffer buffer, final int bufferOffset) { return Types.getInt(buffer, bufferOffset + schemaIdOffset, schemaIdType, schemaIdByteOrder); }
[ "public", "int", "getSchemaId", "(", "final", "DirectBuffer", "buffer", ",", "final", "int", "bufferOffset", ")", "{", "return", "Types", ".", "getInt", "(", "buffer", ",", "bufferOffset", "+", "schemaIdOffset", ",", "schemaIdType", ",", "schemaIdByteOrder", ")"...
Get the schema id number from the message header. @param buffer from which to read the value. @param bufferOffset in the buffer at which the message header begins. @return the value of the schema id number.
[ "Get", "the", "schema", "id", "number", "from", "the", "message", "header", "." ]
9a7be490c86d98f0e430e4189bc6c8c4fbef658b
https://github.com/real-logic/simple-binary-encoding/blob/9a7be490c86d98f0e430e4189bc6c8c4fbef658b/sbe-tool/src/main/java/uk/co/real_logic/sbe/otf/OtfHeaderDecoder.java#L118-L121
train
real-logic/simple-binary-encoding
sbe-tool/src/main/java/uk/co/real_logic/sbe/otf/OtfHeaderDecoder.java
OtfHeaderDecoder.getSchemaVersion
public int getSchemaVersion(final DirectBuffer buffer, final int bufferOffset) { return Types.getInt(buffer, bufferOffset + schemaVersionOffset, schemaVersionType, schemaVersionByteOrder); }
java
public int getSchemaVersion(final DirectBuffer buffer, final int bufferOffset) { return Types.getInt(buffer, bufferOffset + schemaVersionOffset, schemaVersionType, schemaVersionByteOrder); }
[ "public", "int", "getSchemaVersion", "(", "final", "DirectBuffer", "buffer", ",", "final", "int", "bufferOffset", ")", "{", "return", "Types", ".", "getInt", "(", "buffer", ",", "bufferOffset", "+", "schemaVersionOffset", ",", "schemaVersionType", ",", "schemaVers...
Get the schema version number from the message header. @param buffer from which to read the value. @param bufferOffset in the buffer at which the message header begins. @return the value of the schema version number.
[ "Get", "the", "schema", "version", "number", "from", "the", "message", "header", "." ]
9a7be490c86d98f0e430e4189bc6c8c4fbef658b
https://github.com/real-logic/simple-binary-encoding/blob/9a7be490c86d98f0e430e4189bc6c8c4fbef658b/sbe-tool/src/main/java/uk/co/real_logic/sbe/otf/OtfHeaderDecoder.java#L130-L133
train
real-logic/simple-binary-encoding
sbe-tool/src/main/java/uk/co/real_logic/sbe/otf/OtfHeaderDecoder.java
OtfHeaderDecoder.getBlockLength
public int getBlockLength(final DirectBuffer buffer, final int bufferOffset) { return Types.getInt(buffer, bufferOffset + blockLengthOffset, blockLengthType, blockLengthByteOrder); }
java
public int getBlockLength(final DirectBuffer buffer, final int bufferOffset) { return Types.getInt(buffer, bufferOffset + blockLengthOffset, blockLengthType, blockLengthByteOrder); }
[ "public", "int", "getBlockLength", "(", "final", "DirectBuffer", "buffer", ",", "final", "int", "bufferOffset", ")", "{", "return", "Types", ".", "getInt", "(", "buffer", ",", "bufferOffset", "+", "blockLengthOffset", ",", "blockLengthType", ",", "blockLengthByteO...
Get the block length of the root block in the message. @param buffer from which to read the value. @param bufferOffset in the buffer at which the message header begins. @return the length of the root block in the coming message.
[ "Get", "the", "block", "length", "of", "the", "root", "block", "in", "the", "message", "." ]
9a7be490c86d98f0e430e4189bc6c8c4fbef658b
https://github.com/real-logic/simple-binary-encoding/blob/9a7be490c86d98f0e430e4189bc6c8c4fbef658b/sbe-tool/src/main/java/uk/co/real_logic/sbe/otf/OtfHeaderDecoder.java#L142-L145
train
yanzhenjie/Album
album/src/main/java/com/yanzhenjie/album/Album.java
Album.initialize
public static void initialize(AlbumConfig albumConfig) { if (sAlbumConfig == null) sAlbumConfig = albumConfig; else Log.w("Album", new IllegalStateException("Illegal operation, only allowed to configure once.")); }
java
public static void initialize(AlbumConfig albumConfig) { if (sAlbumConfig == null) sAlbumConfig = albumConfig; else Log.w("Album", new IllegalStateException("Illegal operation, only allowed to configure once.")); }
[ "public", "static", "void", "initialize", "(", "AlbumConfig", "albumConfig", ")", "{", "if", "(", "sAlbumConfig", "==", "null", ")", "sAlbumConfig", "=", "albumConfig", ";", "else", "Log", ".", "w", "(", "\"Album\"", ",", "new", "IllegalStateException", "(", ...
Initialize Album. @param albumConfig {@link AlbumConfig}.
[ "Initialize", "Album", "." ]
b17506440d32909d42aba41f6a388041a25c8363
https://github.com/yanzhenjie/Album/blob/b17506440d32909d42aba41f6a388041a25c8363/album/src/main/java/com/yanzhenjie/album/Album.java#L106-L109
train
yanzhenjie/Album
album/src/main/java/com/yanzhenjie/album/Album.java
Album.getAlbumConfig
public static AlbumConfig getAlbumConfig() { if (sAlbumConfig == null) { sAlbumConfig = AlbumConfig.newBuilder(null).build(); } return sAlbumConfig; }
java
public static AlbumConfig getAlbumConfig() { if (sAlbumConfig == null) { sAlbumConfig = AlbumConfig.newBuilder(null).build(); } return sAlbumConfig; }
[ "public", "static", "AlbumConfig", "getAlbumConfig", "(", ")", "{", "if", "(", "sAlbumConfig", "==", "null", ")", "{", "sAlbumConfig", "=", "AlbumConfig", ".", "newBuilder", "(", "null", ")", ".", "build", "(", ")", ";", "}", "return", "sAlbumConfig", ";",...
Get the album configuration.
[ "Get", "the", "album", "configuration", "." ]
b17506440d32909d42aba41f6a388041a25c8363
https://github.com/yanzhenjie/Album/blob/b17506440d32909d42aba41f6a388041a25c8363/album/src/main/java/com/yanzhenjie/album/Album.java#L114-L119
train
yanzhenjie/Album
album/src/main/java/com/yanzhenjie/album/Album.java
Album.camera
public static Camera<ImageCameraWrapper, VideoCameraWrapper> camera(android.support.v4.app.Fragment fragment) { return new AlbumCamera(fragment.getContext()); }
java
public static Camera<ImageCameraWrapper, VideoCameraWrapper> camera(android.support.v4.app.Fragment fragment) { return new AlbumCamera(fragment.getContext()); }
[ "public", "static", "Camera", "<", "ImageCameraWrapper", ",", "VideoCameraWrapper", ">", "camera", "(", "android", ".", "support", ".", "v4", ".", "app", ".", "Fragment", "fragment", ")", "{", "return", "new", "AlbumCamera", "(", "fragment", ".", "getContext",...
Open the camera from the activity.
[ "Open", "the", "camera", "from", "the", "activity", "." ]
b17506440d32909d42aba41f6a388041a25c8363
https://github.com/yanzhenjie/Album/blob/b17506440d32909d42aba41f6a388041a25c8363/album/src/main/java/com/yanzhenjie/album/Album.java#L250-L252
train
yanzhenjie/Album
album/src/main/java/com/yanzhenjie/album/Album.java
Album.image
public static Choice<ImageMultipleWrapper, ImageSingleWrapper> image(android.support.v4.app.Fragment fragment) { return new ImageChoice(fragment.getContext()); }
java
public static Choice<ImageMultipleWrapper, ImageSingleWrapper> image(android.support.v4.app.Fragment fragment) { return new ImageChoice(fragment.getContext()); }
[ "public", "static", "Choice", "<", "ImageMultipleWrapper", ",", "ImageSingleWrapper", ">", "image", "(", "android", ".", "support", ".", "v4", ".", "app", ".", "Fragment", "fragment", ")", "{", "return", "new", "ImageChoice", "(", "fragment", ".", "getContext"...
Select images.
[ "Select", "images", "." ]
b17506440d32909d42aba41f6a388041a25c8363
https://github.com/yanzhenjie/Album/blob/b17506440d32909d42aba41f6a388041a25c8363/album/src/main/java/com/yanzhenjie/album/Album.java#L257-L259
train
yanzhenjie/Album
album/src/main/java/com/yanzhenjie/album/Album.java
Album.video
public static Choice<VideoMultipleWrapper, VideoSingleWrapper> video(android.support.v4.app.Fragment fragment) { return new VideoChoice(fragment.getContext()); }
java
public static Choice<VideoMultipleWrapper, VideoSingleWrapper> video(android.support.v4.app.Fragment fragment) { return new VideoChoice(fragment.getContext()); }
[ "public", "static", "Choice", "<", "VideoMultipleWrapper", ",", "VideoSingleWrapper", ">", "video", "(", "android", ".", "support", ".", "v4", ".", "app", ".", "Fragment", "fragment", ")", "{", "return", "new", "VideoChoice", "(", "fragment", ".", "getContext"...
Select videos.
[ "Select", "videos", "." ]
b17506440d32909d42aba41f6a388041a25c8363
https://github.com/yanzhenjie/Album/blob/b17506440d32909d42aba41f6a388041a25c8363/album/src/main/java/com/yanzhenjie/album/Album.java#L264-L266
train
yanzhenjie/Album
album/src/main/java/com/yanzhenjie/album/Album.java
Album.album
public static Choice<AlbumMultipleWrapper, AlbumSingleWrapper> album(android.support.v4.app.Fragment fragment) { return new AlbumChoice(fragment.getContext()); }
java
public static Choice<AlbumMultipleWrapper, AlbumSingleWrapper> album(android.support.v4.app.Fragment fragment) { return new AlbumChoice(fragment.getContext()); }
[ "public", "static", "Choice", "<", "AlbumMultipleWrapper", ",", "AlbumSingleWrapper", ">", "album", "(", "android", ".", "support", ".", "v4", ".", "app", ".", "Fragment", "fragment", ")", "{", "return", "new", "AlbumChoice", "(", "fragment", ".", "getContext"...
Select images and videos.
[ "Select", "images", "and", "videos", "." ]
b17506440d32909d42aba41f6a388041a25c8363
https://github.com/yanzhenjie/Album/blob/b17506440d32909d42aba41f6a388041a25c8363/album/src/main/java/com/yanzhenjie/album/Album.java#L271-L273
train
yanzhenjie/Album
album/src/main/java/com/yanzhenjie/album/app/album/data/MediaReader.java
MediaReader.getAllVideo
@WorkerThread public ArrayList<AlbumFolder> getAllVideo() { Map<String, AlbumFolder> albumFolderMap = new HashMap<>(); AlbumFolder allFileFolder = new AlbumFolder(); allFileFolder.setChecked(true); allFileFolder.setName(mContext.getString(R.string.album_all_videos)); scanVid...
java
@WorkerThread public ArrayList<AlbumFolder> getAllVideo() { Map<String, AlbumFolder> albumFolderMap = new HashMap<>(); AlbumFolder allFileFolder = new AlbumFolder(); allFileFolder.setChecked(true); allFileFolder.setName(mContext.getString(R.string.album_all_videos)); scanVid...
[ "@", "WorkerThread", "public", "ArrayList", "<", "AlbumFolder", ">", "getAllVideo", "(", ")", "{", "Map", "<", "String", ",", "AlbumFolder", ">", "albumFolderMap", "=", "new", "HashMap", "<>", "(", ")", ";", "AlbumFolder", "allFileFolder", "=", "new", "Album...
Scan the list of videos in the library.
[ "Scan", "the", "list", "of", "videos", "in", "the", "library", "." ]
b17506440d32909d42aba41f6a388041a25c8363
https://github.com/yanzhenjie/Album/blob/b17506440d32909d42aba41f6a388041a25c8363/album/src/main/java/com/yanzhenjie/album/app/album/data/MediaReader.java#L231-L250
train
yanzhenjie/Album
album/src/main/java/com/yanzhenjie/album/widget/LoadingDialog.java
LoadingDialog.setupViews
public void setupViews(Widget widget) { if (widget.getUiStyle() == Widget.STYLE_LIGHT) { int color = ContextCompat.getColor(getContext(), R.color.albumLoadingDark); mProgressBar.setColorFilter(color); } else { mProgressBar.setColorFilter(widget.getToolBarColor()); ...
java
public void setupViews(Widget widget) { if (widget.getUiStyle() == Widget.STYLE_LIGHT) { int color = ContextCompat.getColor(getContext(), R.color.albumLoadingDark); mProgressBar.setColorFilter(color); } else { mProgressBar.setColorFilter(widget.getToolBarColor()); ...
[ "public", "void", "setupViews", "(", "Widget", "widget", ")", "{", "if", "(", "widget", ".", "getUiStyle", "(", ")", "==", "Widget", ".", "STYLE_LIGHT", ")", "{", "int", "color", "=", "ContextCompat", ".", "getColor", "(", "getContext", "(", ")", ",", ...
Set some properties of the view. @param widget widget.
[ "Set", "some", "properties", "of", "the", "view", "." ]
b17506440d32909d42aba41f6a388041a25c8363
https://github.com/yanzhenjie/Album/blob/b17506440d32909d42aba41f6a388041a25c8363/album/src/main/java/com/yanzhenjie/album/widget/LoadingDialog.java#L50-L57
train
yanzhenjie/Album
album/src/main/java/com/yanzhenjie/album/api/BasicGalleryWrapper.java
BasicGalleryWrapper.currentPosition
public Returner currentPosition(@IntRange(from = 0, to = Integer.MAX_VALUE) int currentPosition) { this.mCurrentPosition = currentPosition; return (Returner) this; }
java
public Returner currentPosition(@IntRange(from = 0, to = Integer.MAX_VALUE) int currentPosition) { this.mCurrentPosition = currentPosition; return (Returner) this; }
[ "public", "Returner", "currentPosition", "(", "@", "IntRange", "(", "from", "=", "0", ",", "to", "=", "Integer", ".", "MAX_VALUE", ")", "int", "currentPosition", ")", "{", "this", ".", "mCurrentPosition", "=", "currentPosition", ";", "return", "(", "Returner...
Set the show position of List. @param currentPosition the current position.
[ "Set", "the", "show", "position", "of", "List", "." ]
b17506440d32909d42aba41f6a388041a25c8363
https://github.com/yanzhenjie/Album/blob/b17506440d32909d42aba41f6a388041a25c8363/album/src/main/java/com/yanzhenjie/album/api/BasicGalleryWrapper.java#L75-L78
train
yanzhenjie/Album
album/src/main/java/com/yanzhenjie/album/util/SystemBar.java
SystemBar.invasionStatusBar
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) public static void invasionStatusBar(Window window) { View decorView = window.getDecorView(); decorView.setSystemUiVisibility(decorView.getSystemUiVisibility() | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FL...
java
@RequiresApi(api = Build.VERSION_CODES.LOLLIPOP) public static void invasionStatusBar(Window window) { View decorView = window.getDecorView(); decorView.setSystemUiVisibility(decorView.getSystemUiVisibility() | View.SYSTEM_UI_FLAG_LAYOUT_FULLSCREEN | View.SYSTEM_UI_FL...
[ "@", "RequiresApi", "(", "api", "=", "Build", ".", "VERSION_CODES", ".", "LOLLIPOP", ")", "public", "static", "void", "invasionStatusBar", "(", "Window", "window", ")", "{", "View", "decorView", "=", "window", ".", "getDecorView", "(", ")", ";", "decorView",...
Set the content layout full the StatusBar, but do not hide StatusBar.
[ "Set", "the", "content", "layout", "full", "the", "StatusBar", "but", "do", "not", "hide", "StatusBar", "." ]
b17506440d32909d42aba41f6a388041a25c8363
https://github.com/yanzhenjie/Album/blob/b17506440d32909d42aba41f6a388041a25c8363/album/src/main/java/com/yanzhenjie/album/util/SystemBar.java#L76-L83
train
yanzhenjie/Album
album/src/main/java/com/yanzhenjie/album/util/SystemBar.java
SystemBar.setStatusBarDarkFont
public static boolean setStatusBarDarkFont(Window window, boolean darkFont) { if (setMIUIStatusBarFont(window, darkFont)) { setDefaultStatusBarFont(window, darkFont); return true; } else if (setMeizuStatusBarFont(window, darkFont)) { setDefaultStatusBarFont(window, da...
java
public static boolean setStatusBarDarkFont(Window window, boolean darkFont) { if (setMIUIStatusBarFont(window, darkFont)) { setDefaultStatusBarFont(window, darkFont); return true; } else if (setMeizuStatusBarFont(window, darkFont)) { setDefaultStatusBarFont(window, da...
[ "public", "static", "boolean", "setStatusBarDarkFont", "(", "Window", "window", ",", "boolean", "darkFont", ")", "{", "if", "(", "setMIUIStatusBarFont", "(", "window", ",", "darkFont", ")", ")", "{", "setDefaultStatusBarFont", "(", "window", ",", "darkFont", ")"...
Set the status bar to dark.
[ "Set", "the", "status", "bar", "to", "dark", "." ]
b17506440d32909d42aba41f6a388041a25c8363
https://github.com/yanzhenjie/Album/blob/b17506440d32909d42aba41f6a388041a25c8363/album/src/main/java/com/yanzhenjie/album/util/SystemBar.java#L114-L124
train
yanzhenjie/Album
album/src/main/java/com/yanzhenjie/album/widget/photoview/PhotoViewAttacher.java
PhotoViewAttacher.setImageViewScaleTypeMatrix
private static void setImageViewScaleTypeMatrix(ImageView imageView) { /** * PhotoView sets its own ScaleType to Matrix, then diverts all calls * setScaleType to this.setScaleType automatically. */ if (null != imageView && !(imageView instanceof IPhotoView)) { if (...
java
private static void setImageViewScaleTypeMatrix(ImageView imageView) { /** * PhotoView sets its own ScaleType to Matrix, then diverts all calls * setScaleType to this.setScaleType automatically. */ if (null != imageView && !(imageView instanceof IPhotoView)) { if (...
[ "private", "static", "void", "setImageViewScaleTypeMatrix", "(", "ImageView", "imageView", ")", "{", "/**\n * PhotoView sets its own ScaleType to Matrix, then diverts all calls\n * setScaleType to this.setScaleType automatically.\n */", "if", "(", "null", "!=", "i...
Sets the ImageView's ScaleType to Matrix.
[ "Sets", "the", "ImageView", "s", "ScaleType", "to", "Matrix", "." ]
b17506440d32909d42aba41f6a388041a25c8363
https://github.com/yanzhenjie/Album/blob/b17506440d32909d42aba41f6a388041a25c8363/album/src/main/java/com/yanzhenjie/album/widget/photoview/PhotoViewAttacher.java#L105-L115
train
yanzhenjie/Album
album/src/main/java/com/yanzhenjie/album/widget/photoview/PhotoViewAttacher.java
PhotoViewAttacher.updateBaseMatrix
private void updateBaseMatrix(Drawable d) { ImageView imageView = getImageView(); if (null == imageView || null == d) { return; } final float viewWidth = getImageViewWidth(imageView); final float viewHeight = getImageViewHeight(imageView); final int drawableW...
java
private void updateBaseMatrix(Drawable d) { ImageView imageView = getImageView(); if (null == imageView || null == d) { return; } final float viewWidth = getImageViewWidth(imageView); final float viewHeight = getImageViewHeight(imageView); final int drawableW...
[ "private", "void", "updateBaseMatrix", "(", "Drawable", "d", ")", "{", "ImageView", "imageView", "=", "getImageView", "(", ")", ";", "if", "(", "null", "==", "imageView", "||", "null", "==", "d", ")", "{", "return", ";", "}", "final", "float", "viewWidth...
Calculate Matrix for FIT_CENTER @param d - Drawable being displayed
[ "Calculate", "Matrix", "for", "FIT_CENTER" ]
b17506440d32909d42aba41f6a388041a25c8363
https://github.com/yanzhenjie/Album/blob/b17506440d32909d42aba41f6a388041a25c8363/album/src/main/java/com/yanzhenjie/album/widget/photoview/PhotoViewAttacher.java#L838-L900
train
yanzhenjie/Album
album/src/main/java/com/yanzhenjie/album/api/widget/Widget.java
Widget.getDefaultWidget
public static Widget getDefaultWidget(Context context) { return Widget.newDarkBuilder(context) .statusBarColor(ContextCompat.getColor(context, R.color.albumColorPrimaryDark)) .toolBarColor(ContextCompat.getColor(context, R.color.albumColorPrimary)) .navigationBarC...
java
public static Widget getDefaultWidget(Context context) { return Widget.newDarkBuilder(context) .statusBarColor(ContextCompat.getColor(context, R.color.albumColorPrimaryDark)) .toolBarColor(ContextCompat.getColor(context, R.color.albumColorPrimary)) .navigationBarC...
[ "public", "static", "Widget", "getDefaultWidget", "(", "Context", "context", ")", "{", "return", "Widget", ".", "newDarkBuilder", "(", "context", ")", ".", "statusBarColor", "(", "ContextCompat", ".", "getColor", "(", "context", ",", "R", ".", "color", ".", ...
Create default widget.
[ "Create", "default", "widget", "." ]
b17506440d32909d42aba41f6a388041a25c8363
https://github.com/yanzhenjie/Album/blob/b17506440d32909d42aba41f6a388041a25c8363/album/src/main/java/com/yanzhenjie/album/api/widget/Widget.java#L348-L365
train
yanzhenjie/Album
album/src/main/java/com/yanzhenjie/album/app/album/AlbumActivity.java
AlbumActivity.createView
private int createView() { switch (mWidget.getUiStyle()) { case Widget.STYLE_DARK: { return R.layout.album_activity_album_dark; } case Widget.STYLE_LIGHT: { return R.layout.album_activity_album_light; } default: { ...
java
private int createView() { switch (mWidget.getUiStyle()) { case Widget.STYLE_DARK: { return R.layout.album_activity_album_dark; } case Widget.STYLE_LIGHT: { return R.layout.album_activity_album_light; } default: { ...
[ "private", "int", "createView", "(", ")", "{", "switch", "(", "mWidget", ".", "getUiStyle", "(", ")", ")", "{", "case", "Widget", ".", "STYLE_DARK", ":", "{", "return", "R", ".", "layout", ".", "album_activity_album_dark", ";", "}", "case", "Widget", "."...
Use different layouts depending on the style. @return layout id.
[ "Use", "different", "layouts", "depending", "on", "the", "style", "." ]
b17506440d32909d42aba41f6a388041a25c8363
https://github.com/yanzhenjie/Album/blob/b17506440d32909d42aba41f6a388041a25c8363/album/src/main/java/com/yanzhenjie/album/app/album/AlbumActivity.java#L134-L146
train
yanzhenjie/Album
album/src/main/java/com/yanzhenjie/album/app/album/AlbumActivity.java
AlbumActivity.showFolderAlbumFiles
private void showFolderAlbumFiles(int position) { this.mCurrentFolder = position; AlbumFolder albumFolder = mAlbumFolders.get(position); mView.bindAlbumFolder(albumFolder); }
java
private void showFolderAlbumFiles(int position) { this.mCurrentFolder = position; AlbumFolder albumFolder = mAlbumFolders.get(position); mView.bindAlbumFolder(albumFolder); }
[ "private", "void", "showFolderAlbumFiles", "(", "int", "position", ")", "{", "this", ".", "mCurrentFolder", "=", "position", ";", "AlbumFolder", "albumFolder", "=", "mAlbumFolders", ".", "get", "(", "position", ")", ";", "mView", ".", "bindAlbumFolder", "(", "...
Update data source.
[ "Update", "data", "source", "." ]
b17506440d32909d42aba41f6a388041a25c8363
https://github.com/yanzhenjie/Album/blob/b17506440d32909d42aba41f6a388041a25c8363/album/src/main/java/com/yanzhenjie/album/app/album/AlbumActivity.java#L244-L248
train
yanzhenjie/Album
album/src/main/java/com/yanzhenjie/album/app/album/AlbumActivity.java
AlbumActivity.showLoadingDialog
private void showLoadingDialog() { if (mLoadingDialog == null) { mLoadingDialog = new LoadingDialog(this); mLoadingDialog.setupViews(mWidget); } if (!mLoadingDialog.isShowing()) { mLoadingDialog.show(); } }
java
private void showLoadingDialog() { if (mLoadingDialog == null) { mLoadingDialog = new LoadingDialog(this); mLoadingDialog.setupViews(mWidget); } if (!mLoadingDialog.isShowing()) { mLoadingDialog.show(); } }
[ "private", "void", "showLoadingDialog", "(", ")", "{", "if", "(", "mLoadingDialog", "==", "null", ")", "{", "mLoadingDialog", "=", "new", "LoadingDialog", "(", "this", ")", ";", "mLoadingDialog", ".", "setupViews", "(", "mWidget", ")", ";", "}", "if", "(",...
Display loading dialog.
[ "Display", "loading", "dialog", "." ]
b17506440d32909d42aba41f6a388041a25c8363
https://github.com/yanzhenjie/Album/blob/b17506440d32909d42aba41f6a388041a25c8363/album/src/main/java/com/yanzhenjie/album/app/album/AlbumActivity.java#L583-L591
train
yanzhenjie/Album
album/src/main/java/com/yanzhenjie/album/api/VideoMultipleWrapper.java
VideoMultipleWrapper.selectCount
public VideoMultipleWrapper selectCount(@IntRange(from = 1, to = Integer.MAX_VALUE) int count) { this.mLimitCount = count; return this; }
java
public VideoMultipleWrapper selectCount(@IntRange(from = 1, to = Integer.MAX_VALUE) int count) { this.mLimitCount = count; return this; }
[ "public", "VideoMultipleWrapper", "selectCount", "(", "@", "IntRange", "(", "from", "=", "1", ",", "to", "=", "Integer", ".", "MAX_VALUE", ")", "int", "count", ")", "{", "this", ".", "mLimitCount", "=", "count", ";", "return", "this", ";", "}" ]
Set the maximum number to be selected. @param count the maximum number.
[ "Set", "the", "maximum", "number", "to", "be", "selected", "." ]
b17506440d32909d42aba41f6a388041a25c8363
https://github.com/yanzhenjie/Album/blob/b17506440d32909d42aba41f6a388041a25c8363/album/src/main/java/com/yanzhenjie/album/api/VideoMultipleWrapper.java#L56-L59
train
yanzhenjie/Album
album/src/main/java/com/yanzhenjie/album/mvp/BaseActivity.java
BaseActivity.requestPermission
protected void requestPermission(String[] permissions, int code) { if (Build.VERSION.SDK_INT >= 23) { List<String> deniedPermissions = getDeniedPermissions(this, permissions); if (deniedPermissions.isEmpty()) { onPermissionGranted(code); } else { ...
java
protected void requestPermission(String[] permissions, int code) { if (Build.VERSION.SDK_INT >= 23) { List<String> deniedPermissions = getDeniedPermissions(this, permissions); if (deniedPermissions.isEmpty()) { onPermissionGranted(code); } else { ...
[ "protected", "void", "requestPermission", "(", "String", "[", "]", "permissions", ",", "int", "code", ")", "{", "if", "(", "Build", ".", "VERSION", ".", "SDK_INT", ">=", "23", ")", "{", "List", "<", "String", ">", "deniedPermissions", "=", "getDeniedPermis...
Request permission.
[ "Request", "permission", "." ]
b17506440d32909d42aba41f6a388041a25c8363
https://github.com/yanzhenjie/Album/blob/b17506440d32909d42aba41f6a388041a25c8363/album/src/main/java/com/yanzhenjie/album/mvp/BaseActivity.java#L54-L67
train
yanzhenjie/Album
album/src/main/java/com/yanzhenjie/album/app/album/data/ThumbnailBuilder.java
ThumbnailBuilder.createThumbnailForImage
@WorkerThread @Nullable public String createThumbnailForImage(String imagePath) { if (TextUtils.isEmpty(imagePath)) return null; File inFile = new File(imagePath); if (!inFile.exists()) return null; File thumbnailFile = randomPath(imagePath); if (thumbnailFile.exists())...
java
@WorkerThread @Nullable public String createThumbnailForImage(String imagePath) { if (TextUtils.isEmpty(imagePath)) return null; File inFile = new File(imagePath); if (!inFile.exists()) return null; File thumbnailFile = randomPath(imagePath); if (thumbnailFile.exists())...
[ "@", "WorkerThread", "@", "Nullable", "public", "String", "createThumbnailForImage", "(", "String", "imagePath", ")", "{", "if", "(", "TextUtils", ".", "isEmpty", "(", "imagePath", ")", ")", "return", "null", ";", "File", "inFile", "=", "new", "File", "(", ...
Create a thumbnail for the image. @param imagePath image path. @return thumbnail path.
[ "Create", "a", "thumbnail", "for", "the", "image", "." ]
b17506440d32909d42aba41f6a388041a25c8363
https://github.com/yanzhenjie/Album/blob/b17506440d32909d42aba41f6a388041a25c8363/album/src/main/java/com/yanzhenjie/album/app/album/data/ThumbnailBuilder.java#L60-L89
train
yanzhenjie/Album
album/src/main/java/com/yanzhenjie/album/app/album/data/ThumbnailBuilder.java
ThumbnailBuilder.createThumbnailForVideo
@WorkerThread @Nullable public String createThumbnailForVideo(String videoPath) { if (TextUtils.isEmpty(videoPath)) return null; File thumbnailFile = randomPath(videoPath); if (thumbnailFile.exists()) return thumbnailFile.getAbsolutePath(); try { MediaMetadataRetrie...
java
@WorkerThread @Nullable public String createThumbnailForVideo(String videoPath) { if (TextUtils.isEmpty(videoPath)) return null; File thumbnailFile = randomPath(videoPath); if (thumbnailFile.exists()) return thumbnailFile.getAbsolutePath(); try { MediaMetadataRetrie...
[ "@", "WorkerThread", "@", "Nullable", "public", "String", "createThumbnailForVideo", "(", "String", "videoPath", ")", "{", "if", "(", "TextUtils", ".", "isEmpty", "(", "videoPath", ")", ")", "return", "null", ";", "File", "thumbnailFile", "=", "randomPath", "(...
Create a thumbnail for the video. @param videoPath video path. @return thumbnail path.
[ "Create", "a", "thumbnail", "for", "the", "video", "." ]
b17506440d32909d42aba41f6a388041a25c8363
https://github.com/yanzhenjie/Album/blob/b17506440d32909d42aba41f6a388041a25c8363/album/src/main/java/com/yanzhenjie/album/app/album/data/ThumbnailBuilder.java#L97-L119
train
yanzhenjie/Album
album/src/main/java/com/yanzhenjie/album/app/album/data/ThumbnailBuilder.java
ThumbnailBuilder.readImageFromPath
@Nullable public static Bitmap readImageFromPath(String imagePath, int width, int height) { File imageFile = new File(imagePath); if (imageFile.exists()) { try { BufferedInputStream inputStream = new BufferedInputStream(new FileInputStream(imageFile)); Bit...
java
@Nullable public static Bitmap readImageFromPath(String imagePath, int width, int height) { File imageFile = new File(imagePath); if (imageFile.exists()) { try { BufferedInputStream inputStream = new BufferedInputStream(new FileInputStream(imageFile)); Bit...
[ "@", "Nullable", "public", "static", "Bitmap", "readImageFromPath", "(", "String", "imagePath", ",", "int", "width", ",", "int", "height", ")", "{", "File", "imageFile", "=", "new", "File", "(", "imagePath", ")", ";", "if", "(", "imageFile", ".", "exists",...
Deposit in the province read images, mViewWidth is high, the greater the picture clearer, but also the memory. @param imagePath pictures in the path of the memory card. @return bitmap.
[ "Deposit", "in", "the", "province", "read", "images", "mViewWidth", "is", "high", "the", "greater", "the", "picture", "clearer", "but", "also", "the", "memory", "." ]
b17506440d32909d42aba41f6a388041a25c8363
https://github.com/yanzhenjie/Album/blob/b17506440d32909d42aba41f6a388041a25c8363/album/src/main/java/com/yanzhenjie/album/app/album/data/ThumbnailBuilder.java#L132-L177
train
yanzhenjie/Album
album/src/main/java/com/yanzhenjie/album/util/AlbumUtils.java
AlbumUtils.getAlbumRootPath
@NonNull public static File getAlbumRootPath(Context context) { if (sdCardIsAvailable()) { return new File(Environment.getExternalStorageDirectory(), CACHE_DIRECTORY); } else { return new File(context.getFilesDir(), CACHE_DIRECTORY); } }
java
@NonNull public static File getAlbumRootPath(Context context) { if (sdCardIsAvailable()) { return new File(Environment.getExternalStorageDirectory(), CACHE_DIRECTORY); } else { return new File(context.getFilesDir(), CACHE_DIRECTORY); } }
[ "@", "NonNull", "public", "static", "File", "getAlbumRootPath", "(", "Context", "context", ")", "{", "if", "(", "sdCardIsAvailable", "(", ")", ")", "{", "return", "new", "File", "(", "Environment", ".", "getExternalStorageDirectory", "(", ")", ",", "CACHE_DIRE...
Get a writable root directory. @param context context. @return {@link File}.
[ "Get", "a", "writable", "root", "directory", "." ]
b17506440d32909d42aba41f6a388041a25c8363
https://github.com/yanzhenjie/Album/blob/b17506440d32909d42aba41f6a388041a25c8363/album/src/main/java/com/yanzhenjie/album/util/AlbumUtils.java#L66-L73
train
yanzhenjie/Album
album/src/main/java/com/yanzhenjie/album/util/AlbumUtils.java
AlbumUtils.sdCardIsAvailable
public static boolean sdCardIsAvailable() { if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) { return Environment.getExternalStorageDirectory().canWrite(); } else return false; }
java
public static boolean sdCardIsAvailable() { if (Environment.getExternalStorageState().equals(Environment.MEDIA_MOUNTED)) { return Environment.getExternalStorageDirectory().canWrite(); } else return false; }
[ "public", "static", "boolean", "sdCardIsAvailable", "(", ")", "{", "if", "(", "Environment", ".", "getExternalStorageState", "(", ")", ".", "equals", "(", "Environment", ".", "MEDIA_MOUNTED", ")", ")", "{", "return", "Environment", ".", "getExternalStorageDirector...
SD card is available. @return true when available, other wise is false.
[ "SD", "card", "is", "available", "." ]
b17506440d32909d42aba41f6a388041a25c8363
https://github.com/yanzhenjie/Album/blob/b17506440d32909d42aba41f6a388041a25c8363/album/src/main/java/com/yanzhenjie/album/util/AlbumUtils.java#L80-L85
train
yanzhenjie/Album
album/src/main/java/com/yanzhenjie/album/util/AlbumUtils.java
AlbumUtils.randomMediaPath
@NonNull private static String randomMediaPath(File bucket, String extension) { if (bucket.exists() && bucket.isFile()) bucket.delete(); if (!bucket.exists()) bucket.mkdirs(); String outFilePath = AlbumUtils.getNowDateTime("yyyyMMdd_HHmmssSSS") + "_" + getMD5ForString(UUID.randomUUID().toStr...
java
@NonNull private static String randomMediaPath(File bucket, String extension) { if (bucket.exists() && bucket.isFile()) bucket.delete(); if (!bucket.exists()) bucket.mkdirs(); String outFilePath = AlbumUtils.getNowDateTime("yyyyMMdd_HHmmssSSS") + "_" + getMD5ForString(UUID.randomUUID().toStr...
[ "@", "NonNull", "private", "static", "String", "randomMediaPath", "(", "File", "bucket", ",", "String", "extension", ")", "{", "if", "(", "bucket", ".", "exists", "(", ")", "&&", "bucket", ".", "isFile", "(", ")", ")", "bucket", ".", "delete", "(", ")"...
Generates a random file path using the specified suffix name in the specified directory. @param bucket specify the directory. @param extension extension. @return file path.
[ "Generates", "a", "random", "file", "path", "using", "the", "specified", "suffix", "name", "in", "the", "specified", "directory", "." ]
b17506440d32909d42aba41f6a388041a25c8363
https://github.com/yanzhenjie/Album/blob/b17506440d32909d42aba41f6a388041a25c8363/album/src/main/java/com/yanzhenjie/album/util/AlbumUtils.java#L252-L259
train
yanzhenjie/Album
album/src/main/java/com/yanzhenjie/album/util/AlbumUtils.java
AlbumUtils.getMimeType
public static String getMimeType(String url) { String extension = getExtension(url); if (!MimeTypeMap.getSingleton().hasExtension(extension)) return ""; String mimeType = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension); return TextUtils.isEmpty(mimeType) ? "" : mimeType; ...
java
public static String getMimeType(String url) { String extension = getExtension(url); if (!MimeTypeMap.getSingleton().hasExtension(extension)) return ""; String mimeType = MimeTypeMap.getSingleton().getMimeTypeFromExtension(extension); return TextUtils.isEmpty(mimeType) ? "" : mimeType; ...
[ "public", "static", "String", "getMimeType", "(", "String", "url", ")", "{", "String", "extension", "=", "getExtension", "(", "url", ")", ";", "if", "(", "!", "MimeTypeMap", ".", "getSingleton", "(", ")", ".", "hasExtension", "(", "extension", ")", ")", ...
Get the mime type of the file in the url. @param url file url. @return mime type.
[ "Get", "the", "mime", "type", "of", "the", "file", "in", "the", "url", "." ]
b17506440d32909d42aba41f6a388041a25c8363
https://github.com/yanzhenjie/Album/blob/b17506440d32909d42aba41f6a388041a25c8363/album/src/main/java/com/yanzhenjie/album/util/AlbumUtils.java#L279-L285
train
yanzhenjie/Album
album/src/main/java/com/yanzhenjie/album/util/AlbumUtils.java
AlbumUtils.getExtension
public static String getExtension(String url) { url = TextUtils.isEmpty(url) ? "" : url.toLowerCase(); String extension = MimeTypeMap.getFileExtensionFromUrl(url); return TextUtils.isEmpty(extension) ? "" : extension; }
java
public static String getExtension(String url) { url = TextUtils.isEmpty(url) ? "" : url.toLowerCase(); String extension = MimeTypeMap.getFileExtensionFromUrl(url); return TextUtils.isEmpty(extension) ? "" : extension; }
[ "public", "static", "String", "getExtension", "(", "String", "url", ")", "{", "url", "=", "TextUtils", ".", "isEmpty", "(", "url", ")", "?", "\"\"", ":", "url", ".", "toLowerCase", "(", ")", ";", "String", "extension", "=", "MimeTypeMap", ".", "getFileEx...
Get the file extension in url. @param url file url. @return extension.
[ "Get", "the", "file", "extension", "in", "url", "." ]
b17506440d32909d42aba41f6a388041a25c8363
https://github.com/yanzhenjie/Album/blob/b17506440d32909d42aba41f6a388041a25c8363/album/src/main/java/com/yanzhenjie/album/util/AlbumUtils.java#L293-L297
train
yanzhenjie/Album
album/src/main/java/com/yanzhenjie/album/util/AlbumUtils.java
AlbumUtils.convertDuration
@NonNull public static String convertDuration(@IntRange(from = 1) long duration) { duration /= 1000; int hour = (int) (duration / 3600); int minute = (int) ((duration - hour * 3600) / 60); int second = (int) (duration - hour * 3600 - minute * 60); String hourValue = ""; ...
java
@NonNull public static String convertDuration(@IntRange(from = 1) long duration) { duration /= 1000; int hour = (int) (duration / 3600); int minute = (int) ((duration - hour * 3600) / 60); int second = (int) (duration - hour * 3600 - minute * 60); String hourValue = ""; ...
[ "@", "NonNull", "public", "static", "String", "convertDuration", "(", "@", "IntRange", "(", "from", "=", "1", ")", "long", "duration", ")", "{", "duration", "/=", "1000", ";", "int", "hour", "=", "(", "int", ")", "(", "duration", "/", "3600", ")", ";...
Time conversion. @param duration ms. @return such as: {@code 00:00:00}, {@code 00:00}.
[ "Time", "conversion", "." ]
b17506440d32909d42aba41f6a388041a25c8363
https://github.com/yanzhenjie/Album/blob/b17506440d32909d42aba41f6a388041a25c8363/album/src/main/java/com/yanzhenjie/album/util/AlbumUtils.java#L391-L429
train
yanzhenjie/Album
album/src/main/java/com/yanzhenjie/album/util/AlbumUtils.java
AlbumUtils.getMD5ForString
public static String getMD5ForString(String content) { StringBuilder md5Buffer = new StringBuilder(); try { MessageDigest digest = MessageDigest.getInstance("MD5"); byte[] tempBytes = digest.digest(content.getBytes()); int digital; for (int i = 0; i < temp...
java
public static String getMD5ForString(String content) { StringBuilder md5Buffer = new StringBuilder(); try { MessageDigest digest = MessageDigest.getInstance("MD5"); byte[] tempBytes = digest.digest(content.getBytes()); int digital; for (int i = 0; i < temp...
[ "public", "static", "String", "getMD5ForString", "(", "String", "content", ")", "{", "StringBuilder", "md5Buffer", "=", "new", "StringBuilder", "(", ")", ";", "try", "{", "MessageDigest", "digest", "=", "MessageDigest", ".", "getInstance", "(", "\"MD5\"", ")", ...
Get the MD5 value of string. @param content the target string. @return the MD5 value.
[ "Get", "the", "MD5", "value", "of", "string", "." ]
b17506440d32909d42aba41f6a388041a25c8363
https://github.com/yanzhenjie/Album/blob/b17506440d32909d42aba41f6a388041a25c8363/album/src/main/java/com/yanzhenjie/album/util/AlbumUtils.java#L437-L457
train
Kickflip/kickflip-android-sdk
sdk/src/main/java/io/kickflip/sdk/av/Broadcaster.java
Broadcaster.stopRecording
@Override public void stopRecording() { super.stopRecording(); mSentBroadcastLiveEvent = false; if (mStream != null) { if (VERBOSE) Log.i(TAG, "Stopping Stream"); mKickflip.stopStream(mStream, new KickflipCallback() { @Override public v...
java
@Override public void stopRecording() { super.stopRecording(); mSentBroadcastLiveEvent = false; if (mStream != null) { if (VERBOSE) Log.i(TAG, "Stopping Stream"); mKickflip.stopStream(mStream, new KickflipCallback() { @Override public v...
[ "@", "Override", "public", "void", "stopRecording", "(", ")", "{", "super", ".", "stopRecording", "(", ")", ";", "mSentBroadcastLiveEvent", "=", "false", ";", "if", "(", "mStream", "!=", "null", ")", "{", "if", "(", "VERBOSE", ")", "Log", ".", "i", "("...
Stop broadcasting and release resources. After this call this Broadcaster can no longer be used.
[ "Stop", "broadcasting", "and", "release", "resources", ".", "After", "this", "call", "this", "Broadcaster", "can", "no", "longer", "be", "used", "." ]
af3aae5f1128d7376e67aefe11a3a1a3844be734
https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/av/Broadcaster.java#L236-L254
train
Kickflip/kickflip-android-sdk
sdk/src/main/java/io/kickflip/sdk/av/Broadcaster.java
Broadcaster.queueOrSubmitUpload
private void queueOrSubmitUpload(String key, File file) { if (mReadyToBroadcast) { submitUpload(key, file); } else { if (VERBOSE) Log.i(TAG, "queueing " + key + " until S3 Credentials available"); queueUpload(key, file); } }
java
private void queueOrSubmitUpload(String key, File file) { if (mReadyToBroadcast) { submitUpload(key, file); } else { if (VERBOSE) Log.i(TAG, "queueing " + key + " until S3 Credentials available"); queueUpload(key, file); } }
[ "private", "void", "queueOrSubmitUpload", "(", "String", "key", ",", "File", "file", ")", "{", "if", "(", "mReadyToBroadcast", ")", "{", "submitUpload", "(", "key", ",", "file", ")", ";", "}", "else", "{", "if", "(", "VERBOSE", ")", "Log", ".", "i", ...
Handle an upload, either submitting to the S3 client or queueing for submission once credentials are ready @param key destination key @param file local file
[ "Handle", "an", "upload", "either", "submitting", "to", "the", "S3", "client", "or", "queueing", "for", "submission", "once", "credentials", "are", "ready" ]
af3aae5f1128d7376e67aefe11a3a1a3844be734
https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/av/Broadcaster.java#L456-L463
train
Kickflip/kickflip-android-sdk
sdk/src/main/java/io/kickflip/sdk/av/Broadcaster.java
Broadcaster.queueUpload
private void queueUpload(String key, File file) { if (mUploadQueue == null) mUploadQueue = new ArrayDeque<>(); mUploadQueue.add(new Pair<>(key, file)); }
java
private void queueUpload(String key, File file) { if (mUploadQueue == null) mUploadQueue = new ArrayDeque<>(); mUploadQueue.add(new Pair<>(key, file)); }
[ "private", "void", "queueUpload", "(", "String", "key", ",", "File", "file", ")", "{", "if", "(", "mUploadQueue", "==", "null", ")", "mUploadQueue", "=", "new", "ArrayDeque", "<>", "(", ")", ";", "mUploadQueue", ".", "add", "(", "new", "Pair", "<>", "(...
Queue an upload for later submission to S3 @param key destination key @param file local file
[ "Queue", "an", "upload", "for", "later", "submission", "to", "S3" ]
af3aae5f1128d7376e67aefe11a3a1a3844be734
https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/av/Broadcaster.java#L471-L475
train
Kickflip/kickflip-android-sdk
sdk/src/main/java/io/kickflip/sdk/av/Broadcaster.java
Broadcaster.submitQueuedUploadsToS3
private void submitQueuedUploadsToS3() { if (mUploadQueue == null) return; for (Pair<String, File> pair : mUploadQueue) { submitUpload(pair.first, pair.second); } }
java
private void submitQueuedUploadsToS3() { if (mUploadQueue == null) return; for (Pair<String, File> pair : mUploadQueue) { submitUpload(pair.first, pair.second); } }
[ "private", "void", "submitQueuedUploadsToS3", "(", ")", "{", "if", "(", "mUploadQueue", "==", "null", ")", "return", ";", "for", "(", "Pair", "<", "String", ",", "File", ">", "pair", ":", "mUploadQueue", ")", "{", "submitUpload", "(", "pair", ".", "first...
Submit all queued uploads to the S3 client
[ "Submit", "all", "queued", "uploads", "to", "the", "S3", "client" ]
af3aae5f1128d7376e67aefe11a3a1a3844be734
https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/av/Broadcaster.java#L480-L485
train
Kickflip/kickflip-android-sdk
sdk/src/main/java/io/kickflip/sdk/av/CameraEncoder.java
CameraEncoder.applyFilter
public void applyFilter(int filter) { Filters.checkFilterArgument(filter); mDisplayRenderer.changeFilterMode(filter); synchronized (mReadyForFrameFence) { mNewFilter = filter; } }
java
public void applyFilter(int filter) { Filters.checkFilterArgument(filter); mDisplayRenderer.changeFilterMode(filter); synchronized (mReadyForFrameFence) { mNewFilter = filter; } }
[ "public", "void", "applyFilter", "(", "int", "filter", ")", "{", "Filters", ".", "checkFilterArgument", "(", "filter", ")", ";", "mDisplayRenderer", ".", "changeFilterMode", "(", "filter", ")", ";", "synchronized", "(", "mReadyForFrameFence", ")", "{", "mNewFilt...
Apply a filter to the camera input @param filter
[ "Apply", "a", "filter", "to", "the", "camera", "input" ]
af3aae5f1128d7376e67aefe11a3a1a3844be734
https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/av/CameraEncoder.java#L329-L335
train
Kickflip/kickflip-android-sdk
sdk/src/main/java/io/kickflip/sdk/av/CameraEncoder.java
CameraEncoder.handleCameraPreviewTouchEvent
public void handleCameraPreviewTouchEvent(MotionEvent ev) { if (mFullScreen != null) mFullScreen.handleTouchEvent(ev); if (mDisplayRenderer != null) mDisplayRenderer.handleTouchEvent(ev); }
java
public void handleCameraPreviewTouchEvent(MotionEvent ev) { if (mFullScreen != null) mFullScreen.handleTouchEvent(ev); if (mDisplayRenderer != null) mDisplayRenderer.handleTouchEvent(ev); }
[ "public", "void", "handleCameraPreviewTouchEvent", "(", "MotionEvent", "ev", ")", "{", "if", "(", "mFullScreen", "!=", "null", ")", "mFullScreen", ".", "handleTouchEvent", "(", "ev", ")", ";", "if", "(", "mDisplayRenderer", "!=", "null", ")", "mDisplayRenderer",...
Notify the preview and encoder programs of a touch event. Used by GLCameraEncoderView @param ev onTouchEvent event to handle
[ "Notify", "the", "preview", "and", "encoder", "programs", "of", "a", "touch", "event", ".", "Used", "by", "GLCameraEncoderView" ]
af3aae5f1128d7376e67aefe11a3a1a3844be734
https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/av/CameraEncoder.java#L344-L347
train
Kickflip/kickflip-android-sdk
sdk/src/main/java/io/kickflip/sdk/av/CameraEncoder.java
CameraEncoder.startRecording
public void startRecording() { if (mState != STATE.INITIALIZED) { Log.e(TAG, "startRecording called in invalid state. Ignoring"); return; } synchronized (mReadyForFrameFence) { mFrameNum = 0; mRecording = true; mState = STATE.RECORDING;...
java
public void startRecording() { if (mState != STATE.INITIALIZED) { Log.e(TAG, "startRecording called in invalid state. Ignoring"); return; } synchronized (mReadyForFrameFence) { mFrameNum = 0; mRecording = true; mState = STATE.RECORDING;...
[ "public", "void", "startRecording", "(", ")", "{", "if", "(", "mState", "!=", "STATE", ".", "INITIALIZED", ")", "{", "Log", ".", "e", "(", "TAG", ",", "\"startRecording called in invalid state. Ignoring\"", ")", ";", "return", ";", "}", "synchronized", "(", ...
Called from UI thread
[ "Called", "from", "UI", "thread" ]
af3aae5f1128d7376e67aefe11a3a1a3844be734
https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/av/CameraEncoder.java#L363-L373
train
Kickflip/kickflip-android-sdk
sdk/src/main/java/io/kickflip/sdk/av/CameraEncoder.java
CameraEncoder.onFrameAvailable
@Override public void onFrameAvailable(SurfaceTexture surfaceTexture) { // Pass SurfaceTexture to Encoding thread via Handler // Then Encode and display frame mHandler.sendMessage(mHandler.obtainMessage(MSG_FRAME_AVAILABLE, surfaceTexture)); }
java
@Override public void onFrameAvailable(SurfaceTexture surfaceTexture) { // Pass SurfaceTexture to Encoding thread via Handler // Then Encode and display frame mHandler.sendMessage(mHandler.obtainMessage(MSG_FRAME_AVAILABLE, surfaceTexture)); }
[ "@", "Override", "public", "void", "onFrameAvailable", "(", "SurfaceTexture", "surfaceTexture", ")", "{", "// Pass SurfaceTexture to Encoding thread via Handler", "// Then Encode and display frame", "mHandler", ".", "sendMessage", "(", "mHandler", ".", "obtainMessage", "(", "...
Called on an "arbitrary thread" @param surfaceTexture the SurfaceTexture initiating the call
[ "Called", "on", "an", "arbitrary", "thread" ]
af3aae5f1128d7376e67aefe11a3a1a3844be734
https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/av/CameraEncoder.java#L466-L471
train
Kickflip/kickflip-android-sdk
sdk/src/main/java/io/kickflip/sdk/av/CameraEncoder.java
CameraEncoder.prepareEncoder
private void prepareEncoder(EGLContext sharedContext, int width, int height, int bitRate, Muxer muxer) throws IOException { mVideoEncoder = new VideoEncoderCore(width, height, bitRate, muxer); if (mEglCore == null) { // This is the first prepare called for thi...
java
private void prepareEncoder(EGLContext sharedContext, int width, int height, int bitRate, Muxer muxer) throws IOException { mVideoEncoder = new VideoEncoderCore(width, height, bitRate, muxer); if (mEglCore == null) { // This is the first prepare called for thi...
[ "private", "void", "prepareEncoder", "(", "EGLContext", "sharedContext", ",", "int", "width", ",", "int", "height", ",", "int", "bitRate", ",", "Muxer", "muxer", ")", "throws", "IOException", "{", "mVideoEncoder", "=", "new", "VideoEncoderCore", "(", "width", ...
Called with the display EGLContext current, on Encoder thread @param sharedContext The display EGLContext to be shared with the Encoder Surface's context. @param width the desired width of the encoder's video output @param height the desired height of the encoder's video output @param bitRate the ...
[ "Called", "with", "the", "display", "EGLContext", "current", "on", "Encoder", "thread" ]
af3aae5f1128d7376e67aefe11a3a1a3844be734
https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/av/CameraEncoder.java#L692-L708
train
Kickflip/kickflip-android-sdk
sdk/src/main/java/io/kickflip/sdk/av/CameraEncoder.java
CameraEncoder.releaseEglResources
private void releaseEglResources() { mReadyForFrames = false; if (mInputWindowSurface != null) { mInputWindowSurface.release(); mInputWindowSurface = null; } if (mFullScreen != null) { mFullScreen.release(); mFullScreen = null; } ...
java
private void releaseEglResources() { mReadyForFrames = false; if (mInputWindowSurface != null) { mInputWindowSurface.release(); mInputWindowSurface = null; } if (mFullScreen != null) { mFullScreen.release(); mFullScreen = null; } ...
[ "private", "void", "releaseEglResources", "(", ")", "{", "mReadyForFrames", "=", "false", ";", "if", "(", "mInputWindowSurface", "!=", "null", ")", "{", "mInputWindowSurface", ".", "release", "(", ")", ";", "mInputWindowSurface", "=", "null", ";", "}", "if", ...
Release all recording-specific resources. The Encoder, EGLCore and FullFrameRect are tied to capture resolution, and other parameters.
[ "Release", "all", "recording", "-", "specific", "resources", ".", "The", "Encoder", "EGLCore", "and", "FullFrameRect", "are", "tied", "to", "capture", "resolution", "and", "other", "parameters", "." ]
af3aae5f1128d7376e67aefe11a3a1a3844be734
https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/av/CameraEncoder.java#L719-L735
train
Kickflip/kickflip-android-sdk
sdk/src/main/java/io/kickflip/sdk/av/CameraEncoder.java
CameraEncoder.releaseCamera
private void releaseCamera() { if (mDisplayView != null) releaseDisplayView(); if (mCamera != null) { if (VERBOSE) Log.d(TAG, "releasing camera"); mCamera.stopPreview(); mCamera.release(); mCamera = null; } }
java
private void releaseCamera() { if (mDisplayView != null) releaseDisplayView(); if (mCamera != null) { if (VERBOSE) Log.d(TAG, "releasing camera"); mCamera.stopPreview(); mCamera.release(); mCamera = null; } }
[ "private", "void", "releaseCamera", "(", ")", "{", "if", "(", "mDisplayView", "!=", "null", ")", "releaseDisplayView", "(", ")", ";", "if", "(", "mCamera", "!=", "null", ")", "{", "if", "(", "VERBOSE", ")", "Log", ".", "d", "(", "TAG", ",", "\"releas...
Stops camera preview, and releases the camera to the system.
[ "Stops", "camera", "preview", "and", "releases", "the", "camera", "to", "the", "system", "." ]
af3aae5f1128d7376e67aefe11a3a1a3844be734
https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/av/CameraEncoder.java#L846-L855
train
Kickflip/kickflip-android-sdk
sdk/src/main/java/io/kickflip/sdk/av/CameraEncoder.java
CameraEncoder.configureDisplayView
private void configureDisplayView() { if (mDisplayView instanceof GLCameraEncoderView) ((GLCameraEncoderView) mDisplayView).setCameraEncoder(this); else if (mDisplayView instanceof GLCameraView) ((GLCameraView) mDisplayView).setCamera(mCamera); }
java
private void configureDisplayView() { if (mDisplayView instanceof GLCameraEncoderView) ((GLCameraEncoderView) mDisplayView).setCameraEncoder(this); else if (mDisplayView instanceof GLCameraView) ((GLCameraView) mDisplayView).setCamera(mCamera); }
[ "private", "void", "configureDisplayView", "(", ")", "{", "if", "(", "mDisplayView", "instanceof", "GLCameraEncoderView", ")", "(", "(", "GLCameraEncoderView", ")", "mDisplayView", ")", ".", "setCameraEncoder", "(", "this", ")", ";", "else", "if", "(", "mDisplay...
Communicate camera-ready state to our display view. This method allows us to handle custom subclasses
[ "Communicate", "camera", "-", "ready", "state", "to", "our", "display", "view", ".", "This", "method", "allows", "us", "to", "handle", "custom", "subclasses" ]
af3aae5f1128d7376e67aefe11a3a1a3844be734
https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/av/CameraEncoder.java#L861-L866
train
Kickflip/kickflip-android-sdk
sdk/src/main/java/io/kickflip/sdk/av/CameraEncoder.java
CameraEncoder.releaseDisplayView
private void releaseDisplayView() { if (mDisplayView instanceof GLCameraEncoderView) { ((GLCameraEncoderView) mDisplayView).releaseCamera(); } else if (mDisplayView instanceof GLCameraView) ((GLCameraView) mDisplayView).releaseCamera(); }
java
private void releaseDisplayView() { if (mDisplayView instanceof GLCameraEncoderView) { ((GLCameraEncoderView) mDisplayView).releaseCamera(); } else if (mDisplayView instanceof GLCameraView) ((GLCameraView) mDisplayView).releaseCamera(); }
[ "private", "void", "releaseDisplayView", "(", ")", "{", "if", "(", "mDisplayView", "instanceof", "GLCameraEncoderView", ")", "{", "(", "(", "GLCameraEncoderView", ")", "mDisplayView", ")", ".", "releaseCamera", "(", ")", ";", "}", "else", "if", "(", "mDisplayV...
Communicate camera-released state to our display view.
[ "Communicate", "camera", "-", "released", "state", "to", "our", "display", "view", "." ]
af3aae5f1128d7376e67aefe11a3a1a3844be734
https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/av/CameraEncoder.java#L871-L876
train
Kickflip/kickflip-android-sdk
sdk/src/main/java/io/kickflip/sdk/av/GlUtil.java
GlUtil.createProgram
public static int createProgram(String vertexSource, String fragmentSource) { int vertexShader = loadShader(GLES20.GL_VERTEX_SHADER, vertexSource); if (vertexShader == 0) { return 0; } int pixelShader = loadShader(GLES20.GL_FRAGMENT_SHADER, fragmentSource); if (pixelS...
java
public static int createProgram(String vertexSource, String fragmentSource) { int vertexShader = loadShader(GLES20.GL_VERTEX_SHADER, vertexSource); if (vertexShader == 0) { return 0; } int pixelShader = loadShader(GLES20.GL_FRAGMENT_SHADER, fragmentSource); if (pixelS...
[ "public", "static", "int", "createProgram", "(", "String", "vertexSource", ",", "String", "fragmentSource", ")", "{", "int", "vertexShader", "=", "loadShader", "(", "GLES20", ".", "GL_VERTEX_SHADER", ",", "vertexSource", ")", ";", "if", "(", "vertexShader", "=="...
Creates a new program from the supplied vertex and fragment shaders. @return A handle to the program, or 0 on failure.
[ "Creates", "a", "new", "program", "from", "the", "supplied", "vertex", "and", "fragment", "shaders", "." ]
af3aae5f1128d7376e67aefe11a3a1a3844be734
https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/av/GlUtil.java#L50-L79
train
Kickflip/kickflip-android-sdk
sdk/src/main/java/io/kickflip/sdk/av/GlUtil.java
GlUtil.loadShader
public static int loadShader(int shaderType, String source) { int shader = GLES20.glCreateShader(shaderType); checkGlError("glCreateShader type=" + shaderType); GLES20.glShaderSource(shader, source); GLES20.glCompileShader(shader); int[] compiled = new int[1]; GLES20.glGe...
java
public static int loadShader(int shaderType, String source) { int shader = GLES20.glCreateShader(shaderType); checkGlError("glCreateShader type=" + shaderType); GLES20.glShaderSource(shader, source); GLES20.glCompileShader(shader); int[] compiled = new int[1]; GLES20.glGe...
[ "public", "static", "int", "loadShader", "(", "int", "shaderType", ",", "String", "source", ")", "{", "int", "shader", "=", "GLES20", ".", "glCreateShader", "(", "shaderType", ")", ";", "checkGlError", "(", "\"glCreateShader type=\"", "+", "shaderType", ")", "...
Compiles the provided shader source. @return A handle to the shader, or 0 on failure.
[ "Compiles", "the", "provided", "shader", "source", "." ]
af3aae5f1128d7376e67aefe11a3a1a3844be734
https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/av/GlUtil.java#L86-L100
train
Kickflip/kickflip-android-sdk
sdk/src/main/java/io/kickflip/sdk/av/GlUtil.java
GlUtil.checkGlError
public static void checkGlError(String op) { int error = GLES20.glGetError(); if (error != GLES20.GL_NO_ERROR) { String msg = op + ": glError 0x" + Integer.toHexString(error); Log.e(TAG, msg); throw new RuntimeException(msg); } }
java
public static void checkGlError(String op) { int error = GLES20.glGetError(); if (error != GLES20.GL_NO_ERROR) { String msg = op + ": glError 0x" + Integer.toHexString(error); Log.e(TAG, msg); throw new RuntimeException(msg); } }
[ "public", "static", "void", "checkGlError", "(", "String", "op", ")", "{", "int", "error", "=", "GLES20", ".", "glGetError", "(", ")", ";", "if", "(", "error", "!=", "GLES20", ".", "GL_NO_ERROR", ")", "{", "String", "msg", "=", "op", "+", "\": glError ...
Checks to see if a GLES error has been raised.
[ "Checks", "to", "see", "if", "a", "GLES", "error", "has", "been", "raised", "." ]
af3aae5f1128d7376e67aefe11a3a1a3844be734
https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/av/GlUtil.java#L105-L112
train
Kickflip/kickflip-android-sdk
sdk/src/main/java/io/kickflip/sdk/av/GlUtil.java
GlUtil.createFloatBuffer
public static FloatBuffer createFloatBuffer(float[] coords) { // Allocate a direct ByteBuffer, using 4 bytes per float, and copy coords into it. ByteBuffer bb = ByteBuffer.allocateDirect(coords.length * SIZEOF_FLOAT); bb.order(ByteOrder.nativeOrder()); FloatBuffer fb = bb.asFloatBuffer()...
java
public static FloatBuffer createFloatBuffer(float[] coords) { // Allocate a direct ByteBuffer, using 4 bytes per float, and copy coords into it. ByteBuffer bb = ByteBuffer.allocateDirect(coords.length * SIZEOF_FLOAT); bb.order(ByteOrder.nativeOrder()); FloatBuffer fb = bb.asFloatBuffer()...
[ "public", "static", "FloatBuffer", "createFloatBuffer", "(", "float", "[", "]", "coords", ")", "{", "// Allocate a direct ByteBuffer, using 4 bytes per float, and copy coords into it.", "ByteBuffer", "bb", "=", "ByteBuffer", ".", "allocateDirect", "(", "coords", ".", "lengt...
Allocates a direct float buffer, and populates it with the float array data.
[ "Allocates", "a", "direct", "float", "buffer", "and", "populates", "it", "with", "the", "float", "array", "data", "." ]
af3aae5f1128d7376e67aefe11a3a1a3844be734
https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/av/GlUtil.java#L129-L137
train
Kickflip/kickflip-android-sdk
sdk/src/main/java/io/kickflip/sdk/av/GlUtil.java
GlUtil.logVersionInfo
public static void logVersionInfo() { Log.i(TAG, "vendor : " + GLES20.glGetString(GLES20.GL_VENDOR)); Log.i(TAG, "renderer: " + GLES20.glGetString(GLES20.GL_RENDERER)); Log.i(TAG, "version : " + GLES20.glGetString(GLES20.GL_VERSION)); if (false) { int[] values = new int[1];...
java
public static void logVersionInfo() { Log.i(TAG, "vendor : " + GLES20.glGetString(GLES20.GL_VENDOR)); Log.i(TAG, "renderer: " + GLES20.glGetString(GLES20.GL_RENDERER)); Log.i(TAG, "version : " + GLES20.glGetString(GLES20.GL_VERSION)); if (false) { int[] values = new int[1];...
[ "public", "static", "void", "logVersionInfo", "(", ")", "{", "Log", ".", "i", "(", "TAG", ",", "\"vendor : \"", "+", "GLES20", ".", "glGetString", "(", "GLES20", ".", "GL_VENDOR", ")", ")", ";", "Log", ".", "i", "(", "TAG", ",", "\"renderer: \"", "+",...
Writes GL version info to the log.
[ "Writes", "GL", "version", "info", "to", "the", "log", "." ]
af3aae5f1128d7376e67aefe11a3a1a3844be734
https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/av/GlUtil.java#L142-L157
train
Kickflip/kickflip-android-sdk
sdk/src/main/java/io/kickflip/sdk/av/EglCore.java
EglCore.getConfig
private EGLConfig getConfig(int flags, int version) { int renderableType = EGL14.EGL_OPENGL_ES2_BIT; if (version >= 3) { renderableType |= EGLExt.EGL_OPENGL_ES3_BIT_KHR; } // The actual surface is generally RGBA or RGBX, so situationally omitting alpha // doesn't rea...
java
private EGLConfig getConfig(int flags, int version) { int renderableType = EGL14.EGL_OPENGL_ES2_BIT; if (version >= 3) { renderableType |= EGLExt.EGL_OPENGL_ES3_BIT_KHR; } // The actual surface is generally RGBA or RGBX, so situationally omitting alpha // doesn't rea...
[ "private", "EGLConfig", "getConfig", "(", "int", "flags", ",", "int", "version", ")", "{", "int", "renderableType", "=", "EGL14", ".", "EGL_OPENGL_ES2_BIT", ";", "if", "(", "version", ">=", "3", ")", "{", "renderableType", "|=", "EGLExt", ".", "EGL_OPENGL_ES...
Finds a suitable EGLConfig. @param flags Bit flags from constructor. @param version Must be 2 or 3.
[ "Finds", "a", "suitable", "EGLConfig", "." ]
af3aae5f1128d7376e67aefe11a3a1a3844be734
https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/av/EglCore.java#L143-L175
train
Kickflip/kickflip-android-sdk
sdk/src/main/java/io/kickflip/sdk/av/EglCore.java
EglCore.release
public void release() { if (mEGLDisplay != EGL14.EGL_NO_DISPLAY) { // Android is unusual in that it uses a reference-counted EGLDisplay. So for // every eglInitialize() we need an eglTerminate(). EGL14.eglMakeCurrent(mEGLDisplay, EGL14.EGL_NO_SURFACE, EGL14.EGL_NO_SURFACE, E...
java
public void release() { if (mEGLDisplay != EGL14.EGL_NO_DISPLAY) { // Android is unusual in that it uses a reference-counted EGLDisplay. So for // every eglInitialize() we need an eglTerminate(). EGL14.eglMakeCurrent(mEGLDisplay, EGL14.EGL_NO_SURFACE, EGL14.EGL_NO_SURFACE, E...
[ "public", "void", "release", "(", ")", "{", "if", "(", "mEGLDisplay", "!=", "EGL14", ".", "EGL_NO_DISPLAY", ")", "{", "// Android is unusual in that it uses a reference-counted EGLDisplay. So for", "// every eglInitialize() we need an eglTerminate().", "EGL14", ".", "eglMakeCu...
Discard all resources held by this class, notably the EGL context.
[ "Discard", "all", "resources", "held", "by", "this", "class", "notably", "the", "EGL", "context", "." ]
af3aae5f1128d7376e67aefe11a3a1a3844be734
https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/av/EglCore.java#L180-L193
train
Kickflip/kickflip-android-sdk
sdk/src/main/java/io/kickflip/sdk/av/EglCore.java
EglCore.createOffscreenSurface
public EGLSurface createOffscreenSurface(int width, int height) { int[] surfaceAttribs = { EGL14.EGL_WIDTH, width, EGL14.EGL_HEIGHT, height, EGL14.EGL_NONE }; EGLSurface eglSurface = EGL14.eglCreatePbufferSurface(mEGLDisplay, mEGLConfig, ...
java
public EGLSurface createOffscreenSurface(int width, int height) { int[] surfaceAttribs = { EGL14.EGL_WIDTH, width, EGL14.EGL_HEIGHT, height, EGL14.EGL_NONE }; EGLSurface eglSurface = EGL14.eglCreatePbufferSurface(mEGLDisplay, mEGLConfig, ...
[ "public", "EGLSurface", "createOffscreenSurface", "(", "int", "width", ",", "int", "height", ")", "{", "int", "[", "]", "surfaceAttribs", "=", "{", "EGL14", ".", "EGL_WIDTH", ",", "width", ",", "EGL14", ".", "EGL_HEIGHT", ",", "height", ",", "EGL14", ".", ...
Creates an EGL surface associated with an offscreen buffer.
[ "Creates", "an", "EGL", "surface", "associated", "with", "an", "offscreen", "buffer", "." ]
af3aae5f1128d7376e67aefe11a3a1a3844be734
https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/av/EglCore.java#L245-L258
train
Kickflip/kickflip-android-sdk
sdk/src/main/java/io/kickflip/sdk/av/EglCore.java
EglCore.makeCurrent
public void makeCurrent(EGLSurface eglSurface) { if (mEGLDisplay == EGL14.EGL_NO_DISPLAY) { // called makeCurrent() before create? Log.d(TAG, "NOTE: makeCurrent w/o display"); } if (!EGL14.eglMakeCurrent(mEGLDisplay, eglSurface, eglSurface, mEGLContext)) { thr...
java
public void makeCurrent(EGLSurface eglSurface) { if (mEGLDisplay == EGL14.EGL_NO_DISPLAY) { // called makeCurrent() before create? Log.d(TAG, "NOTE: makeCurrent w/o display"); } if (!EGL14.eglMakeCurrent(mEGLDisplay, eglSurface, eglSurface, mEGLContext)) { thr...
[ "public", "void", "makeCurrent", "(", "EGLSurface", "eglSurface", ")", "{", "if", "(", "mEGLDisplay", "==", "EGL14", ".", "EGL_NO_DISPLAY", ")", "{", "// called makeCurrent() before create?", "Log", ".", "d", "(", "TAG", ",", "\"NOTE: makeCurrent w/o display\"", ")"...
Makes our EGL context current, using the supplied surface for both "draw" and "read".
[ "Makes", "our", "EGL", "context", "current", "using", "the", "supplied", "surface", "for", "both", "draw", "and", "read", "." ]
af3aae5f1128d7376e67aefe11a3a1a3844be734
https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/av/EglCore.java#L263-L271
train
Kickflip/kickflip-android-sdk
sdk/src/main/java/io/kickflip/sdk/av/EglCore.java
EglCore.makeCurrent
public void makeCurrent(EGLSurface drawSurface, EGLSurface readSurface) { if (mEGLDisplay == EGL14.EGL_NO_DISPLAY) { // called makeCurrent() before create? Log.d(TAG, "NOTE: makeCurrent w/o display"); } if (!EGL14.eglMakeCurrent(mEGLDisplay, drawSurface, readSurface, mEGL...
java
public void makeCurrent(EGLSurface drawSurface, EGLSurface readSurface) { if (mEGLDisplay == EGL14.EGL_NO_DISPLAY) { // called makeCurrent() before create? Log.d(TAG, "NOTE: makeCurrent w/o display"); } if (!EGL14.eglMakeCurrent(mEGLDisplay, drawSurface, readSurface, mEGL...
[ "public", "void", "makeCurrent", "(", "EGLSurface", "drawSurface", ",", "EGLSurface", "readSurface", ")", "{", "if", "(", "mEGLDisplay", "==", "EGL14", ".", "EGL_NO_DISPLAY", ")", "{", "// called makeCurrent() before create?", "Log", ".", "d", "(", "TAG", ",", "...
Makes our EGL context current, using the supplied "draw" and "read" surfaces.
[ "Makes", "our", "EGL", "context", "current", "using", "the", "supplied", "draw", "and", "read", "surfaces", "." ]
af3aae5f1128d7376e67aefe11a3a1a3844be734
https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/av/EglCore.java#L276-L284
train
Kickflip/kickflip-android-sdk
sdk/src/main/java/io/kickflip/sdk/av/EglCore.java
EglCore.makeNothingCurrent
public void makeNothingCurrent() { if (!EGL14.eglMakeCurrent(mEGLDisplay, EGL14.EGL_NO_SURFACE, EGL14.EGL_NO_SURFACE, EGL14.EGL_NO_CONTEXT)) { throw new RuntimeException("eglMakeCurrent failed"); } }
java
public void makeNothingCurrent() { if (!EGL14.eglMakeCurrent(mEGLDisplay, EGL14.EGL_NO_SURFACE, EGL14.EGL_NO_SURFACE, EGL14.EGL_NO_CONTEXT)) { throw new RuntimeException("eglMakeCurrent failed"); } }
[ "public", "void", "makeNothingCurrent", "(", ")", "{", "if", "(", "!", "EGL14", ".", "eglMakeCurrent", "(", "mEGLDisplay", ",", "EGL14", ".", "EGL_NO_SURFACE", ",", "EGL14", ".", "EGL_NO_SURFACE", ",", "EGL14", ".", "EGL_NO_CONTEXT", ")", ")", "{", "throw", ...
Makes no context current.
[ "Makes", "no", "context", "current", "." ]
af3aae5f1128d7376e67aefe11a3a1a3844be734
https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/av/EglCore.java#L289-L294
train
Kickflip/kickflip-android-sdk
sdk/src/main/java/io/kickflip/sdk/av/EglCore.java
EglCore.isCurrent
public boolean isCurrent(EGLSurface eglSurface) { return mEGLContext.equals(EGL14.eglGetCurrentContext()) && eglSurface.equals(EGL14.eglGetCurrentSurface(EGL14.EGL_DRAW)); }
java
public boolean isCurrent(EGLSurface eglSurface) { return mEGLContext.equals(EGL14.eglGetCurrentContext()) && eglSurface.equals(EGL14.eglGetCurrentSurface(EGL14.EGL_DRAW)); }
[ "public", "boolean", "isCurrent", "(", "EGLSurface", "eglSurface", ")", "{", "return", "mEGLContext", ".", "equals", "(", "EGL14", ".", "eglGetCurrentContext", "(", ")", ")", "&&", "eglSurface", ".", "equals", "(", "EGL14", ".", "eglGetCurrentSurface", "(", "E...
Returns true if our context and the specified surface are current.
[ "Returns", "true", "if", "our", "context", "and", "the", "specified", "surface", "are", "current", "." ]
af3aae5f1128d7376e67aefe11a3a1a3844be734
https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/av/EglCore.java#L315-L318
train
Kickflip/kickflip-android-sdk
sdk/src/main/java/io/kickflip/sdk/av/EglCore.java
EglCore.querySurface
public int querySurface(EGLSurface eglSurface, int what) { int[] value = new int[1]; EGL14.eglQuerySurface(mEGLDisplay, eglSurface, what, value, 0); return value[0]; }
java
public int querySurface(EGLSurface eglSurface, int what) { int[] value = new int[1]; EGL14.eglQuerySurface(mEGLDisplay, eglSurface, what, value, 0); return value[0]; }
[ "public", "int", "querySurface", "(", "EGLSurface", "eglSurface", ",", "int", "what", ")", "{", "int", "[", "]", "value", "=", "new", "int", "[", "1", "]", ";", "EGL14", ".", "eglQuerySurface", "(", "mEGLDisplay", ",", "eglSurface", ",", "what", ",", "...
Performs a simple surface query.
[ "Performs", "a", "simple", "surface", "query", "." ]
af3aae5f1128d7376e67aefe11a3a1a3844be734
https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/av/EglCore.java#L323-L327
train
Kickflip/kickflip-android-sdk
sdk/src/main/java/io/kickflip/sdk/av/EglCore.java
EglCore.logCurrent
public static void logCurrent(String msg) { EGLDisplay display; EGLContext context; EGLSurface surface; display = EGL14.eglGetCurrentDisplay(); context = EGL14.eglGetCurrentContext(); surface = EGL14.eglGetCurrentSurface(EGL14.EGL_DRAW); Log.i(TAG, "Current EGL (...
java
public static void logCurrent(String msg) { EGLDisplay display; EGLContext context; EGLSurface surface; display = EGL14.eglGetCurrentDisplay(); context = EGL14.eglGetCurrentContext(); surface = EGL14.eglGetCurrentSurface(EGL14.EGL_DRAW); Log.i(TAG, "Current EGL (...
[ "public", "static", "void", "logCurrent", "(", "String", "msg", ")", "{", "EGLDisplay", "display", ";", "EGLContext", "context", ";", "EGLSurface", "surface", ";", "display", "=", "EGL14", ".", "eglGetCurrentDisplay", "(", ")", ";", "context", "=", "EGL14", ...
Writes the current display, context, and surface to the log.
[ "Writes", "the", "current", "display", "context", "and", "surface", "to", "the", "log", "." ]
af3aae5f1128d7376e67aefe11a3a1a3844be734
https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/av/EglCore.java#L339-L349
train
Kickflip/kickflip-android-sdk
sdk/src/main/java/io/kickflip/sdk/av/EglCore.java
EglCore.checkEglError
private void checkEglError(String msg) { int error; if ((error = EGL14.eglGetError()) != EGL14.EGL_SUCCESS) { throw new RuntimeException(msg + ": EGL error: 0x" + Integer.toHexString(error)); } }
java
private void checkEglError(String msg) { int error; if ((error = EGL14.eglGetError()) != EGL14.EGL_SUCCESS) { throw new RuntimeException(msg + ": EGL error: 0x" + Integer.toHexString(error)); } }
[ "private", "void", "checkEglError", "(", "String", "msg", ")", "{", "int", "error", ";", "if", "(", "(", "error", "=", "EGL14", ".", "eglGetError", "(", ")", ")", "!=", "EGL14", ".", "EGL_SUCCESS", ")", "{", "throw", "new", "RuntimeException", "(", "ms...
Checks for EGL errors.
[ "Checks", "for", "EGL", "errors", "." ]
af3aae5f1128d7376e67aefe11a3a1a3844be734
https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/av/EglCore.java#L354-L359
train
Kickflip/kickflip-android-sdk
sdk/src/main/java/io/kickflip/sdk/av/MicrophoneEncoder.java
MicrophoneEncoder.getJitterFreePTS
private long getJitterFreePTS(long bufferPts, long bufferSamplesNum) { long correctedPts = 0; long bufferDuration = (1000000 * bufferSamplesNum) / (mEncoderCore.mSampleRate); bufferPts -= bufferDuration; // accounts for the delay of acquiring the audio buffer if (totalSamplesNum == 0) { ...
java
private long getJitterFreePTS(long bufferPts, long bufferSamplesNum) { long correctedPts = 0; long bufferDuration = (1000000 * bufferSamplesNum) / (mEncoderCore.mSampleRate); bufferPts -= bufferDuration; // accounts for the delay of acquiring the audio buffer if (totalSamplesNum == 0) { ...
[ "private", "long", "getJitterFreePTS", "(", "long", "bufferPts", ",", "long", "bufferSamplesNum", ")", "{", "long", "correctedPts", "=", "0", ";", "long", "bufferDuration", "=", "(", "1000000", "*", "bufferSamplesNum", ")", "/", "(", "mEncoderCore", ".", "mSam...
Ensures that each audio pts differs by a constant amount from the previous one. @param bufferPts presentation timestamp in us @param bufferSamplesNum the number of samples of the buffer's frame @return
[ "Ensures", "that", "each", "audio", "pts", "differs", "by", "a", "constant", "amount", "from", "the", "previous", "one", "." ]
af3aae5f1128d7376e67aefe11a3a1a3844be734
https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/av/MicrophoneEncoder.java#L207-L225
train
Kickflip/kickflip-android-sdk
sdk/src/main/java/io/kickflip/sdk/av/FullFrameRect.java
FullFrameRect.adjustForVerticalVideo
public void adjustForVerticalVideo(SCREEN_ROTATION orientation, boolean scaleToFit) { synchronized (mDrawLock) { mCorrectVerticalVideo = true; mScaleToFit = scaleToFit; requestedOrientation = orientation; Matrix.setIdentityM(IDENTITY_MATRIX, 0); switch...
java
public void adjustForVerticalVideo(SCREEN_ROTATION orientation, boolean scaleToFit) { synchronized (mDrawLock) { mCorrectVerticalVideo = true; mScaleToFit = scaleToFit; requestedOrientation = orientation; Matrix.setIdentityM(IDENTITY_MATRIX, 0); switch...
[ "public", "void", "adjustForVerticalVideo", "(", "SCREEN_ROTATION", "orientation", ",", "boolean", "scaleToFit", ")", "{", "synchronized", "(", "mDrawLock", ")", "{", "mCorrectVerticalVideo", "=", "true", ";", "mScaleToFit", "=", "scaleToFit", ";", "requestedOrientati...
Adjust the MVP Matrix to rotate and crop the texture to make vertical video appear upright
[ "Adjust", "the", "MVP", "Matrix", "to", "rotate", "and", "crop", "the", "texture", "to", "make", "vertical", "video", "appear", "upright" ]
af3aae5f1128d7376e67aefe11a3a1a3844be734
https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/av/FullFrameRect.java#L70-L100
train
Kickflip/kickflip-android-sdk
sdk/src/main/java/io/kickflip/sdk/av/FullFrameRect.java
FullFrameRect.drawFrame
public void drawFrame(int textureId, float[] texMatrix) { // Use the identity matrix for MVP so our 2x2 FULL_RECTANGLE covers the viewport. synchronized (mDrawLock) { if (mCorrectVerticalVideo && !mScaleToFit && (requestedOrientation == SCREEN_ROTATION.VERTICAL || requestedOrientation == SCR...
java
public void drawFrame(int textureId, float[] texMatrix) { // Use the identity matrix for MVP so our 2x2 FULL_RECTANGLE covers the viewport. synchronized (mDrawLock) { if (mCorrectVerticalVideo && !mScaleToFit && (requestedOrientation == SCREEN_ROTATION.VERTICAL || requestedOrientation == SCR...
[ "public", "void", "drawFrame", "(", "int", "textureId", ",", "float", "[", "]", "texMatrix", ")", "{", "// Use the identity matrix for MVP so our 2x2 FULL_RECTANGLE covers the viewport.", "synchronized", "(", "mDrawLock", ")", "{", "if", "(", "mCorrectVerticalVideo", "&&"...
Draws a viewport-filling rect, texturing it with the specified texture object.
[ "Draws", "a", "viewport", "-", "filling", "rect", "texturing", "it", "with", "the", "specified", "texture", "object", "." ]
af3aae5f1128d7376e67aefe11a3a1a3844be734
https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/av/FullFrameRect.java#L137-L148
train
Kickflip/kickflip-android-sdk
sdk/src/main/java/io/kickflip/sdk/fragment/GlassBroadcastFragment.java
GlassBroadcastFragment.stopBroadcasting
public void stopBroadcasting() { if (mBroadcaster.isRecording()) { mBroadcaster.stopRecording(); mBroadcaster.release(); } else { Log.e(TAG, "stopBroadcasting called but mBroadcaster not broadcasting"); } }
java
public void stopBroadcasting() { if (mBroadcaster.isRecording()) { mBroadcaster.stopRecording(); mBroadcaster.release(); } else { Log.e(TAG, "stopBroadcasting called but mBroadcaster not broadcasting"); } }
[ "public", "void", "stopBroadcasting", "(", ")", "{", "if", "(", "mBroadcaster", ".", "isRecording", "(", ")", ")", "{", "mBroadcaster", ".", "stopRecording", "(", ")", ";", "mBroadcaster", ".", "release", "(", ")", ";", "}", "else", "{", "Log", ".", "e...
Force this fragment to stop broadcasting. Useful if your application wants to stop broadcasting when a user leaves the Activity hosting this fragment
[ "Force", "this", "fragment", "to", "stop", "broadcasting", ".", "Useful", "if", "your", "application", "wants", "to", "stop", "broadcasting", "when", "a", "user", "leaves", "the", "Activity", "hosting", "this", "fragment" ]
af3aae5f1128d7376e67aefe11a3a1a3844be734
https://github.com/Kickflip/kickflip-android-sdk/blob/af3aae5f1128d7376e67aefe11a3a1a3844be734/sdk/src/main/java/io/kickflip/sdk/fragment/GlassBroadcastFragment.java#L242-L249
train