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
Red5/red5-io
src/main/java/org/red5/io/utils/XMLUtils.java
XMLUtils.docToString1
public static String docToString1(Document dom) { StringWriter sw = new StringWriter(); DOM2Writer.serializeAsXML(dom, sw); return sw.toString(); }
java
public static String docToString1(Document dom) { StringWriter sw = new StringWriter(); DOM2Writer.serializeAsXML(dom, sw); return sw.toString(); }
[ "public", "static", "String", "docToString1", "(", "Document", "dom", ")", "{", "StringWriter", "sw", "=", "new", "StringWriter", "(", ")", ";", "DOM2Writer", ".", "serializeAsXML", "(", "dom", ",", "sw", ")", ";", "return", "sw", ".", "toString", "(", "...
Convert a DOM tree into a String using Dom2Writer @return XML as String @param dom DOM object to convert
[ "Convert", "a", "DOM", "tree", "into", "a", "String", "using", "Dom2Writer" ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/utils/XMLUtils.java#L97-L101
train
Red5/red5-io
src/main/java/org/red5/io/utils/XMLUtils.java
XMLUtils.docToString2
public static String docToString2(Document domDoc) throws IOException { try { TransformerFactory transFact = TransformerFactory.newInstance(); Transformer trans = transFact.newTransformer(); trans.setOutputProperty(OutputKeys.INDENT, "no"); StringWriter sw = new S...
java
public static String docToString2(Document domDoc) throws IOException { try { TransformerFactory transFact = TransformerFactory.newInstance(); Transformer trans = transFact.newTransformer(); trans.setOutputProperty(OutputKeys.INDENT, "no"); StringWriter sw = new S...
[ "public", "static", "String", "docToString2", "(", "Document", "domDoc", ")", "throws", "IOException", "{", "try", "{", "TransformerFactory", "transFact", "=", "TransformerFactory", ".", "newInstance", "(", ")", ";", "Transformer", "trans", "=", "transFact", ".", ...
Convert a DOM tree into a String using transform @param domDoc DOM object @throws java.io.IOException I/O exception @return XML as String
[ "Convert", "a", "DOM", "tree", "into", "a", "String", "using", "transform" ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/utils/XMLUtils.java#L112-L124
train
Red5/red5-io
src/main/java/org/red5/io/utils/ConversionUtils.java
ConversionUtils.convert
@SuppressWarnings({ "unchecked", "rawtypes" }) public static Object convert(Object source, Class<?> target) throws ConversionException { if (target == null) { throw new ConversionException("Unable to perform conversion, target was null"); } if (source == null) { ...
java
@SuppressWarnings({ "unchecked", "rawtypes" }) public static Object convert(Object source, Class<?> target) throws ConversionException { if (target == null) { throw new ConversionException("Unable to perform conversion, target was null"); } if (source == null) { ...
[ "@", "SuppressWarnings", "(", "{", "\"unchecked\"", ",", "\"rawtypes\"", "}", ")", "public", "static", "Object", "convert", "(", "Object", "source", ",", "Class", "<", "?", ">", "target", ")", "throws", "ConversionException", "{", "if", "(", "target", "==", ...
Convert source to given class @param source Source object @param target Target class @return Converted object @throws ConversionException If object can't be converted
[ "Convert", "source", "to", "given", "class" ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/utils/ConversionUtils.java#L99-L155
train
Red5/red5-io
src/main/java/org/red5/io/utils/ConversionUtils.java
ConversionUtils.convertToArray
public static Object convertToArray(Object source, Class<?> target) throws ConversionException { try { Class<?> targetType = target.getComponentType(); if (source.getClass().isArray()) { Object targetInstance = Array.newInstance(targetType, Array.getLength(source)); ...
java
public static Object convertToArray(Object source, Class<?> target) throws ConversionException { try { Class<?> targetType = target.getComponentType(); if (source.getClass().isArray()) { Object targetInstance = Array.newInstance(targetType, Array.getLength(source)); ...
[ "public", "static", "Object", "convertToArray", "(", "Object", "source", ",", "Class", "<", "?", ">", "target", ")", "throws", "ConversionException", "{", "try", "{", "Class", "<", "?", ">", "targetType", "=", "target", ".", "getComponentType", "(", ")", "...
Convert to array @param source Source object @param target Target class @return Converted object @throws ConversionException If object can't be converted
[ "Convert", "to", "array" ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/utils/ConversionUtils.java#L168-L192
train
Red5/red5-io
src/main/java/org/red5/io/utils/ConversionUtils.java
ConversionUtils.convertToWrappedPrimitive
public static Object convertToWrappedPrimitive(Object source, Class<?> wrapper) { if (source == null || wrapper == null) { return null; } if (wrapper.isInstance(source)) { return source; } if (wrapper.isAssignableFrom(source.getClass())) { ...
java
public static Object convertToWrappedPrimitive(Object source, Class<?> wrapper) { if (source == null || wrapper == null) { return null; } if (wrapper.isInstance(source)) { return source; } if (wrapper.isAssignableFrom(source.getClass())) { ...
[ "public", "static", "Object", "convertToWrappedPrimitive", "(", "Object", "source", ",", "Class", "<", "?", ">", "wrapper", ")", "{", "if", "(", "source", "==", "null", "||", "wrapper", "==", "null", ")", "{", "return", "null", ";", "}", "if", "(", "wr...
Convert to wrapped primitive @param source Source object @param wrapper Primitive wrapper type @return Converted object
[ "Convert", "to", "wrapped", "primitive" ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/utils/ConversionUtils.java#L209-L231
train
Red5/red5-io
src/main/java/org/red5/io/utils/ConversionUtils.java
ConversionUtils.convertStringToWrapper
public static Object convertStringToWrapper(String str, Class<?> wrapper) { log.trace("String: {} to wrapper: {}", str, wrapper); if (wrapper.equals(String.class)) { return str; } else if (wrapper.equals(Boolean.class)) { return Boolean.valueOf(str); } else ...
java
public static Object convertStringToWrapper(String str, Class<?> wrapper) { log.trace("String: {} to wrapper: {}", str, wrapper); if (wrapper.equals(String.class)) { return str; } else if (wrapper.equals(Boolean.class)) { return Boolean.valueOf(str); } else ...
[ "public", "static", "Object", "convertStringToWrapper", "(", "String", "str", ",", "Class", "<", "?", ">", "wrapper", ")", "{", "log", ".", "trace", "(", "\"String: {} to wrapper: {}\"", ",", "str", ",", "wrapper", ")", ";", "if", "(", "wrapper", ".", "equ...
Convert string to primitive wrapper like Boolean or Float @param str String to convert @param wrapper Primitive wrapper type @return Converted object
[ "Convert", "string", "to", "primitive", "wrapper", "like", "Boolean", "or", "Float" ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/utils/ConversionUtils.java#L242-L262
train
Red5/red5-io
src/main/java/org/red5/io/utils/ConversionUtils.java
ConversionUtils.convertNumberToWrapper
public static Object convertNumberToWrapper(Number num, Class<?> wrapper) { //XXX Paul: Using valueOf will reduce object creation if (wrapper.equals(String.class)) { return num.toString(); } else if (wrapper.equals(Boolean.class)) { return Boolean.valueOf(num.intValu...
java
public static Object convertNumberToWrapper(Number num, Class<?> wrapper) { //XXX Paul: Using valueOf will reduce object creation if (wrapper.equals(String.class)) { return num.toString(); } else if (wrapper.equals(Boolean.class)) { return Boolean.valueOf(num.intValu...
[ "public", "static", "Object", "convertNumberToWrapper", "(", "Number", "num", ",", "Class", "<", "?", ">", "wrapper", ")", "{", "//XXX Paul: Using valueOf will reduce object creation\r", "if", "(", "wrapper", ".", "equals", "(", "String", ".", "class", ")", ")", ...
Convert number to primitive wrapper like Boolean or Float @param num Number to conver @param wrapper Primitive wrapper type @return Converted object
[ "Convert", "number", "to", "primitive", "wrapper", "like", "Boolean", "or", "Float" ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/utils/ConversionUtils.java#L273-L293
train
Red5/red5-io
src/main/java/org/red5/io/utils/ConversionUtils.java
ConversionUtils.findMethodsByNameAndNumParams
public static List<Method> findMethodsByNameAndNumParams(Object object, String method, int numParam) { LinkedList<Method> list = new LinkedList<Method>(); Method[] methods = object.getClass().getMethods(); for (Method m : methods) { String methodName = m.getName(); i...
java
public static List<Method> findMethodsByNameAndNumParams(Object object, String method, int numParam) { LinkedList<Method> list = new LinkedList<Method>(); Method[] methods = object.getClass().getMethods(); for (Method m : methods) { String methodName = m.getName(); i...
[ "public", "static", "List", "<", "Method", ">", "findMethodsByNameAndNumParams", "(", "Object", "object", ",", "String", "method", ",", "int", "numParam", ")", "{", "LinkedList", "<", "Method", ">", "list", "=", "new", "LinkedList", "<", "Method", ">", "(", ...
Find method by name and number of parameters @param object Object to find method on @param method Method name @param numParam Number of parameters @return List of methods that match by name and number of parameters
[ "Find", "method", "by", "name", "and", "number", "of", "parameters" ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/utils/ConversionUtils.java#L306-L335
train
Red5/red5-io
src/main/java/org/red5/io/utils/ConversionUtils.java
ConversionUtils.convertParams
public static Object[] convertParams(Object[] source, Class<?>[] target) throws ConversionException { Object[] converted = new Object[target.length]; for (int i = 0; i < target.length; i++) { converted[i] = convert(source[i], target[i]); } return converted; }
java
public static Object[] convertParams(Object[] source, Class<?>[] target) throws ConversionException { Object[] converted = new Object[target.length]; for (int i = 0; i < target.length; i++) { converted[i] = convert(source[i], target[i]); } return converted; }
[ "public", "static", "Object", "[", "]", "convertParams", "(", "Object", "[", "]", "source", ",", "Class", "<", "?", ">", "[", "]", "target", ")", "throws", "ConversionException", "{", "Object", "[", "]", "converted", "=", "new", "Object", "[", "target", ...
Convert parameters using methods of this utility class @param source Array of source object @param target Array of target classes @return Array of converted objects @throws ConversionException If object can't be converted
[ "Convert", "parameters", "using", "methods", "of", "this", "utility", "class" ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/utils/ConversionUtils.java#L348-L354
train
Red5/red5-io
src/main/java/org/red5/io/utils/ConversionUtils.java
ConversionUtils.convertParams
public static Class<?>[] convertParams(Object[] source) { Class<?>[] converted = null; if (source != null) { converted = new Class<?>[source.length]; for (int i = 0; i < source.length; i++) { if (source[i] != null) { // if the class is no...
java
public static Class<?>[] convertParams(Object[] source) { Class<?>[] converted = null; if (source != null) { converted = new Class<?>[source.length]; for (int i = 0; i < source.length; i++) { if (source[i] != null) { // if the class is no...
[ "public", "static", "Class", "<", "?", ">", "[", "]", "convertParams", "(", "Object", "[", "]", "source", ")", "{", "Class", "<", "?", ">", "[", "]", "converted", "=", "null", ";", "if", "(", "source", "!=", "null", ")", "{", "converted", "=", "n...
Convert parameters using methods of this utility class. Special handling is afforded to classes that implement IConnection. @param source Array of source object @return Array of converted objects
[ "Convert", "parameters", "using", "methods", "of", "this", "utility", "class", ".", "Special", "handling", "is", "afforded", "to", "classes", "that", "implement", "IConnection", "." ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/utils/ConversionUtils.java#L363-L387
train
Red5/red5-io
src/main/java/org/red5/io/utils/ConversionUtils.java
ConversionUtils.convertMapToBean
public static Object convertMapToBean(Map<String, ? extends Object> source, Class<?> target) throws ConversionException { Object bean = newInstance(target); if (bean == null) { //try with just the target name as specified in Trac #352 bean = newInstance(target.getName()); ...
java
public static Object convertMapToBean(Map<String, ? extends Object> source, Class<?> target) throws ConversionException { Object bean = newInstance(target); if (bean == null) { //try with just the target name as specified in Trac #352 bean = newInstance(target.getName()); ...
[ "public", "static", "Object", "convertMapToBean", "(", "Map", "<", "String", ",", "?", "extends", "Object", ">", "source", ",", "Class", "<", "?", ">", "target", ")", "throws", "ConversionException", "{", "Object", "bean", "=", "newInstance", "(", "target", ...
Convert map to bean @param source Source map @param target Target class @return Bean of that class @throws ConversionException on failure
[ "Convert", "map", "to", "bean" ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/utils/ConversionUtils.java#L416-L431
train
Red5/red5-io
src/main/java/org/red5/io/utils/ConversionUtils.java
ConversionUtils.convertArrayToSet
public static Set<?> convertArrayToSet(Object[] source) { Set<Object> set = new HashSet<Object>(); for (Object element : source) { set.add(element); } return set; }
java
public static Set<?> convertArrayToSet(Object[] source) { Set<Object> set = new HashSet<Object>(); for (Object element : source) { set.add(element); } return set; }
[ "public", "static", "Set", "<", "?", ">", "convertArrayToSet", "(", "Object", "[", "]", "source", ")", "{", "Set", "<", "Object", ">", "set", "=", "new", "HashSet", "<", "Object", ">", "(", ")", ";", "for", "(", "Object", "element", ":", "source", ...
Convert array to set, removing duplicates @param source Source array @return Set
[ "Convert", "array", "to", "set", "removing", "duplicates" ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/utils/ConversionUtils.java#L451-L457
train
Red5/red5-io
src/main/java/org/red5/io/mp3/impl/MP3Reader.java
MP3Reader.createFileMeta
private ITag createFileMeta() { log.debug("createFileMeta"); // create tag for onMetaData event IoBuffer in = IoBuffer.allocate(1024); in.setAutoExpand(true); Output out = new Output(in); out.writeString("onMetaData"); Map<Object, Object> props = new HashMa...
java
private ITag createFileMeta() { log.debug("createFileMeta"); // create tag for onMetaData event IoBuffer in = IoBuffer.allocate(1024); in.setAutoExpand(true); Output out = new Output(in); out.writeString("onMetaData"); Map<Object, Object> props = new HashMa...
[ "private", "ITag", "createFileMeta", "(", ")", "{", "log", ".", "debug", "(", "\"createFileMeta\"", ")", ";", "// create tag for onMetaData event\r", "IoBuffer", "in", "=", "IoBuffer", ".", "allocate", "(", "1024", ")", ";", "in", ".", "setAutoExpand", "(", "t...
Creates file metadata object @return Tag
[ "Creates", "file", "metadata", "object" ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/mp3/impl/MP3Reader.java#L267-L337
train
Red5/red5-io
src/main/java/org/red5/io/amf/Output.java
Output.writeArbitraryObject
protected void writeArbitraryObject(Object object) { log.debug("writeObject"); // If we need to serialize class information... Class<?> objectClass = object.getClass(); if (!objectClass.isAnnotationPresent(Anonymous.class)) { // Write out start object marker for class name ...
java
protected void writeArbitraryObject(Object object) { log.debug("writeObject"); // If we need to serialize class information... Class<?> objectClass = object.getClass(); if (!objectClass.isAnnotationPresent(Anonymous.class)) { // Write out start object marker for class name ...
[ "protected", "void", "writeArbitraryObject", "(", "Object", "object", ")", "{", "log", ".", "debug", "(", "\"writeObject\"", ")", ";", "// If we need to serialize class information...", "Class", "<", "?", ">", "objectClass", "=", "object", ".", "getClass", "(", ")...
Writes an arbitrary object to the output. @param object Object to write
[ "Writes", "an", "arbitrary", "object", "to", "the", "output", "." ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/amf/Output.java#L435-L470
train
Red5/red5-io
src/main/java/org/red5/io/amf/Output.java
Output.encodeString
protected static byte[] encodeString(String string) { Element element = getStringCache().get(string); byte[] encoded = (element == null ? null : (byte[]) element.getObjectValue()); if (encoded == null) { ByteBuffer buf = AMF.CHARSET.encode(string); encoded = new byte[buf....
java
protected static byte[] encodeString(String string) { Element element = getStringCache().get(string); byte[] encoded = (element == null ? null : (byte[]) element.getObjectValue()); if (encoded == null) { ByteBuffer buf = AMF.CHARSET.encode(string); encoded = new byte[buf....
[ "protected", "static", "byte", "[", "]", "encodeString", "(", "String", "string", ")", "{", "Element", "element", "=", "getStringCache", "(", ")", ".", "get", "(", "string", ")", ";", "byte", "[", "]", "encoded", "=", "(", "element", "==", "null", "?",...
Encode string. @param string string to encode @return encoded string
[ "Encode", "string", "." ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/amf/Output.java#L526-L536
train
Red5/red5-io
src/main/java/org/red5/io/amf/Output.java
Output.putString
public static void putString(IoBuffer buf, String string) { final byte[] encoded = encodeString(string); if (encoded.length < AMF.LONG_STRING_LENGTH) { // write unsigned short buf.put((byte) ((encoded.length >> 8) & 0xff)); buf.put((byte) (encoded.length & 0xff)); ...
java
public static void putString(IoBuffer buf, String string) { final byte[] encoded = encodeString(string); if (encoded.length < AMF.LONG_STRING_LENGTH) { // write unsigned short buf.put((byte) ((encoded.length >> 8) & 0xff)); buf.put((byte) (encoded.length & 0xff)); ...
[ "public", "static", "void", "putString", "(", "IoBuffer", "buf", ",", "String", "string", ")", "{", "final", "byte", "[", "]", "encoded", "=", "encodeString", "(", "string", ")", ";", "if", "(", "encoded", ".", "length", "<", "AMF", ".", "LONG_STRING_LEN...
Write out string @param buf Byte buffer to write to @param string String to write
[ "Write", "out", "string" ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/amf/Output.java#L546-L556
train
Red5/red5-io
src/main/java/org/red5/io/webm/WebmWriter.java
WebmWriter.writeHeader
public void writeHeader() throws IOException, ConverterException { if (append) { return; } try { CompoundTag ebml = TagFactory.<CompoundTag> create("EBML").add(TagFactory.<UnsignedIntegerTag> create("EBMLVersion").setValue(1)).add(TagFactory.<UnsignedIntegerTag> create("E...
java
public void writeHeader() throws IOException, ConverterException { if (append) { return; } try { CompoundTag ebml = TagFactory.<CompoundTag> create("EBML").add(TagFactory.<UnsignedIntegerTag> create("EBMLVersion").setValue(1)).add(TagFactory.<UnsignedIntegerTag> create("E...
[ "public", "void", "writeHeader", "(", ")", "throws", "IOException", ",", "ConverterException", "{", "if", "(", "append", ")", "{", "return", ";", "}", "try", "{", "CompoundTag", "ebml", "=", "TagFactory", ".", "<", "CompoundTag", ">", "create", "(", "\"EBM...
method to write webm header to the new file @throws IOException - in case of IO errors @throws ConverterException - in case of conversion errors
[ "method", "to", "write", "webm", "header", "to", "the", "new", "file" ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/webm/WebmWriter.java#L102-L116
train
Red5/red5-io
src/main/java/org/red5/io/webm/WebmWriter.java
WebmWriter.writeTag
public void writeTag(Tag tag) throws IOException { byte[] hb = tag.encode(); bytesWritten += hb.length; dataFile.write(hb); }
java
public void writeTag(Tag tag) throws IOException { byte[] hb = tag.encode(); bytesWritten += hb.length; dataFile.write(hb); }
[ "public", "void", "writeTag", "(", "Tag", "tag", ")", "throws", "IOException", "{", "byte", "[", "]", "hb", "=", "tag", ".", "encode", "(", ")", ";", "bytesWritten", "+=", "hb", ".", "length", ";", "dataFile", ".", "write", "(", "hb", ")", ";", "}"...
will write tag bytesWritten counter will be increased by the number of bytes actually written @param tag - tag to be written @throws IOException - in case of any IO errors
[ "will", "write", "tag", "bytesWritten", "counter", "will", "be", "increased", "by", "the", "number", "of", "bytes", "actually", "written" ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/webm/WebmWriter.java#L126-L130
train
Red5/red5-io
src/main/java/org/red5/io/webm/WebmWriter.java
WebmWriter.close
@Override public void close() throws IOException { if (dataFile != null) { //TODO create separate method for this if (!append) { dataFile.seek(0); try (RandomAccessFile rf = new RandomAccessFile(file, "rw")) { rf.getChannel().transf...
java
@Override public void close() throws IOException { if (dataFile != null) { //TODO create separate method for this if (!append) { dataFile.seek(0); try (RandomAccessFile rf = new RandomAccessFile(file, "rw")) { rf.getChannel().transf...
[ "@", "Override", "public", "void", "close", "(", ")", "throws", "IOException", "{", "if", "(", "dataFile", "!=", "null", ")", "{", "//TODO create separate method for this", "if", "(", "!", "append", ")", "{", "dataFile", ".", "seek", "(", "0", ")", ";", ...
Will close all opened resources and "finalize" the write process
[ "Will", "close", "all", "opened", "resources", "and", "finalize", "the", "write", "process" ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/webm/WebmWriter.java#L135-L152
train
Red5/red5-io
src/main/java/org/red5/io/m4a/impl/M4AReader.java
M4AReader.createPreStreamingTags
private void createPreStreamingTags() { log.debug("Creating pre-streaming tags"); if (audioDecoderBytes != null) { IoBuffer body = IoBuffer.allocate(audioDecoderBytes.length + 3); body.put(new byte[] { (byte) 0xaf, (byte) 0 }); //prefix if (log.isDebugEnabled()) { ...
java
private void createPreStreamingTags() { log.debug("Creating pre-streaming tags"); if (audioDecoderBytes != null) { IoBuffer body = IoBuffer.allocate(audioDecoderBytes.length + 3); body.put(new byte[] { (byte) 0xaf, (byte) 0 }); //prefix if (log.isDebugEnabled()) { ...
[ "private", "void", "createPreStreamingTags", "(", ")", "{", "log", ".", "debug", "(", "\"Creating pre-streaming tags\"", ")", ";", "if", "(", "audioDecoderBytes", "!=", "null", ")", "{", "IoBuffer", "body", "=", "IoBuffer", ".", "allocate", "(", "audioDecoderByt...
Tag sequence MetaData, Audio config, remaining audio Packet prefixes: af 00 ... 06 = Audio extra data (first audio packet) af 01 = Audio frame Audio extra data(s): af 00 = Prefix 11 90 4f 14 = AAC Main = aottype 0 12 10 = AAC LC = aottype 1 13 90 56 e5 a5 48 00 = HE-AAC SBR = aottype 2 06 = Suffix Still not absolute...
[ "Tag", "sequence", "MetaData", "Audio", "config", "remaining", "audio" ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/m4a/impl/M4AReader.java#L605-L624
train
Red5/red5-io
src/main/java/org/red5/io/m4a/impl/M4AReader.java
M4AReader.readTag
@Override public ITag readTag() { //log.debug("Read tag"); ITag tag = null; try { lock.acquire(); //empty-out the pre-streaming tags first if (!firstTags.isEmpty()) { log.debug("Returning pre-tag"); // Return first tags befo...
java
@Override public ITag readTag() { //log.debug("Read tag"); ITag tag = null; try { lock.acquire(); //empty-out the pre-streaming tags first if (!firstTags.isEmpty()) { log.debug("Returning pre-tag"); // Return first tags befo...
[ "@", "Override", "public", "ITag", "readTag", "(", ")", "{", "//log.debug(\"Read tag\");", "ITag", "tag", "=", "null", ";", "try", "{", "lock", ".", "acquire", "(", ")", ";", "//empty-out the pre-streaming tags first", "if", "(", "!", "firstTags", ".", "isEmpt...
Packages media data for return to providers.
[ "Packages", "media", "data", "for", "return", "to", "providers", "." ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/m4a/impl/M4AReader.java#L630-L689
train
Red5/red5-io
src/main/java/org/red5/io/utils/DOM2Writer.java
DOM2Writer.serializeAsXML
public static void serializeAsXML(Node node, Writer writer) { PrintWriter out = new PrintWriter(writer); print(node, out); out.flush(); }
java
public static void serializeAsXML(Node node, Writer writer) { PrintWriter out = new PrintWriter(writer); print(node, out); out.flush(); }
[ "public", "static", "void", "serializeAsXML", "(", "Node", "node", ",", "Writer", "writer", ")", "{", "PrintWriter", "out", "=", "new", "PrintWriter", "(", "writer", ")", ";", "print", "(", "node", ",", "out", ")", ";", "out", ".", "flush", "(", ")", ...
Serialize this node into the writer as XML. @param writer Writer object @param node DOM node
[ "Serialize", "this", "node", "into", "the", "writer", "as", "XML", "." ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/utils/DOM2Writer.java#L47-L51
train
Red5/red5-io
src/main/java/org/red5/io/utils/DOM2Writer.java
DOM2Writer.print
private static void print(Node node, PrintWriter out) { if (node == null) { return; } boolean hasChildren = false; int type = node.getNodeType(); NodeList children = null; switch (type) { case Node.DOCUMENT_NODE: children = node.ge...
java
private static void print(Node node, PrintWriter out) { if (node == null) { return; } boolean hasChildren = false; int type = node.getNodeType(); NodeList children = null; switch (type) { case Node.DOCUMENT_NODE: children = node.ge...
[ "private", "static", "void", "print", "(", "Node", "node", ",", "PrintWriter", "out", ")", "{", "if", "(", "node", "==", "null", ")", "{", "return", ";", "}", "boolean", "hasChildren", "=", "false", ";", "int", "type", "=", "node", ".", "getNodeType", ...
Dumps DOM node @param node Node to dump @param out Writer object
[ "Dumps", "DOM", "node" ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/utils/DOM2Writer.java#L61-L135
train
Red5/red5-io
src/main/java/org/red5/io/object/Serializer.java
Serializer.writeBasic
@SuppressWarnings("rawtypes") protected static boolean writeBasic(Output out, Object basic) { if (basic == null) { out.writeNull(); } else if (basic instanceof Boolean) { out.writeBoolean((Boolean) basic); } else if (basic instanceof Number) { out.writeNum...
java
@SuppressWarnings("rawtypes") protected static boolean writeBasic(Output out, Object basic) { if (basic == null) { out.writeNull(); } else if (basic instanceof Boolean) { out.writeBoolean((Boolean) basic); } else if (basic instanceof Number) { out.writeNum...
[ "@", "SuppressWarnings", "(", "\"rawtypes\"", ")", "protected", "static", "boolean", "writeBasic", "(", "Output", "out", ",", "Object", "basic", ")", "{", "if", "(", "basic", "==", "null", ")", "{", "out", ".", "writeNull", "(", ")", ";", "}", "else", ...
Writes a primitive out as an object @param out Output writer @param basic Primitive @return boolean true if object was successfully serialized, false otherwise
[ "Writes", "a", "primitive", "out", "as", "an", "object" ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/object/Serializer.java#L145-L163
train
Red5/red5-io
src/main/java/org/red5/io/object/Serializer.java
Serializer.writeComplex
public static boolean writeComplex(Output out, Object complex) { log.trace("writeComplex"); if (writeListType(out, complex)) { return true; } else if (writeArrayType(out, complex)) { return true; } else if (writeXMLType(out, complex)) { return true; ...
java
public static boolean writeComplex(Output out, Object complex) { log.trace("writeComplex"); if (writeListType(out, complex)) { return true; } else if (writeArrayType(out, complex)) { return true; } else if (writeXMLType(out, complex)) { return true; ...
[ "public", "static", "boolean", "writeComplex", "(", "Output", "out", ",", "Object", "complex", ")", "{", "log", ".", "trace", "(", "\"writeComplex\"", ")", ";", "if", "(", "writeListType", "(", "out", ",", "complex", ")", ")", "{", "return", "true", ";",...
Writes a complex type object out @param out Output writer @param complex Complex datatype object @return boolean true if object was successfully serialized, false otherwise
[ "Writes", "a", "complex", "type", "object", "out" ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/object/Serializer.java#L174-L189
train
Red5/red5-io
src/main/java/org/red5/io/object/Serializer.java
Serializer.writeListType
protected static boolean writeListType(Output out, Object listType) { log.trace("writeListType"); if (listType instanceof List<?>) { writeList(out, (List<?>) listType); } else { return false; } return true; }
java
protected static boolean writeListType(Output out, Object listType) { log.trace("writeListType"); if (listType instanceof List<?>) { writeList(out, (List<?>) listType); } else { return false; } return true; }
[ "protected", "static", "boolean", "writeListType", "(", "Output", "out", ",", "Object", "listType", ")", "{", "log", ".", "trace", "(", "\"writeListType\"", ")", ";", "if", "(", "listType", "instanceof", "List", "<", "?", ">", ")", "{", "writeList", "(", ...
Writes Lists out as a data type @param out Output write @param listType List type @return boolean true if object was successfully serialized, false otherwise
[ "Writes", "Lists", "out", "as", "a", "data", "type" ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/object/Serializer.java#L200-L208
train
Red5/red5-io
src/main/java/org/red5/io/object/Serializer.java
Serializer.writeList
protected static void writeList(Output out, List<?> list) { if (!list.isEmpty()) { int size = list.size(); // if its a small list, write it as an array if (size < 100) { out.writeArray(list); return; } // else we should ...
java
protected static void writeList(Output out, List<?> list) { if (!list.isEmpty()) { int size = list.size(); // if its a small list, write it as an array if (size < 100) { out.writeArray(list); return; } // else we should ...
[ "protected", "static", "void", "writeList", "(", "Output", "out", ",", "List", "<", "?", ">", "list", ")", "{", "if", "(", "!", "list", ".", "isEmpty", "(", ")", ")", "{", "int", "size", "=", "list", ".", "size", "(", ")", ";", "// if its a small l...
Writes a List out as an Object @param out Output writer @param list List to write as Object
[ "Writes", "a", "List", "out", "as", "an", "Object" ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/object/Serializer.java#L218-L242
train
Red5/red5-io
src/main/java/org/red5/io/object/Serializer.java
Serializer.writeIterator
protected static void writeIterator(Output out, Iterator<Object> it) { log.trace("writeIterator"); // Create LinkedList of collection we iterate thru and write it out later LinkedList<Object> list = new LinkedList<Object>(); while (it.hasNext()) { list.addLast(it.next()); ...
java
protected static void writeIterator(Output out, Iterator<Object> it) { log.trace("writeIterator"); // Create LinkedList of collection we iterate thru and write it out later LinkedList<Object> list = new LinkedList<Object>(); while (it.hasNext()) { list.addLast(it.next()); ...
[ "protected", "static", "void", "writeIterator", "(", "Output", "out", ",", "Iterator", "<", "Object", ">", "it", ")", "{", "log", ".", "trace", "(", "\"writeIterator\"", ")", ";", "// Create LinkedList of collection we iterate thru and write it out later", "LinkedList",...
Writes an iterator out to the output @param out Output writer @param it Iterator to write
[ "Writes", "an", "iterator", "out", "to", "the", "output" ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/object/Serializer.java#L278-L287
train
Red5/red5-io
src/main/java/org/red5/io/object/Serializer.java
Serializer.writeXMLType
protected static boolean writeXMLType(Output out, Object xml) { log.trace("writeXMLType"); // If it's a Document write it as Document if (xml instanceof Document) { writeDocument(out, (Document) xml); } else { return false; } return true; }
java
protected static boolean writeXMLType(Output out, Object xml) { log.trace("writeXMLType"); // If it's a Document write it as Document if (xml instanceof Document) { writeDocument(out, (Document) xml); } else { return false; } return true; }
[ "protected", "static", "boolean", "writeXMLType", "(", "Output", "out", ",", "Object", "xml", ")", "{", "log", ".", "trace", "(", "\"writeXMLType\"", ")", ";", "// If it's a Document write it as Document", "if", "(", "xml", "instanceof", "Document", ")", "{", "w...
Writes an xml type out to the output @param out Output writer @param xml XML @return boolean <tt>true</tt> if object was successfully written, <tt>false</tt> otherwise
[ "Writes", "an", "xml", "type", "out", "to", "the", "output" ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/object/Serializer.java#L298-L307
train
Red5/red5-io
src/main/java/org/red5/io/object/Serializer.java
Serializer.writeObjectType
@SuppressWarnings("all") protected static boolean writeObjectType(Output out, Object obj) { if (obj instanceof ObjectMap || obj instanceof BeanMap) { out.writeObject((Map) obj); } else if (obj instanceof Map) { out.writeMap((Map) obj); } else if (obj instanceof Record...
java
@SuppressWarnings("all") protected static boolean writeObjectType(Output out, Object obj) { if (obj instanceof ObjectMap || obj instanceof BeanMap) { out.writeObject((Map) obj); } else if (obj instanceof Map) { out.writeMap((Map) obj); } else if (obj instanceof Record...
[ "@", "SuppressWarnings", "(", "\"all\"", ")", "protected", "static", "boolean", "writeObjectType", "(", "Output", "out", ",", "Object", "obj", ")", "{", "if", "(", "obj", "instanceof", "ObjectMap", "||", "obj", "instanceof", "BeanMap", ")", "{", "out", ".", ...
Write typed object to the output @param out Output writer @param obj Object type to write @return <tt>true</tt> if the object has been written, otherwise <tt>false</tt>
[ "Write", "typed", "object", "to", "the", "output" ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/object/Serializer.java#L330-L342
train
Red5/red5-io
src/main/java/org/red5/io/object/Serializer.java
Serializer.writeCustomType
protected static boolean writeCustomType(Output out, Object obj) { if (out.isCustom(obj)) { // Write custom data out.writeCustom(obj); return true; } else { return false; } }
java
protected static boolean writeCustomType(Output out, Object obj) { if (out.isCustom(obj)) { // Write custom data out.writeCustom(obj); return true; } else { return false; } }
[ "protected", "static", "boolean", "writeCustomType", "(", "Output", "out", ",", "Object", "obj", ")", "{", "if", "(", "out", ".", "isCustom", "(", "obj", ")", ")", "{", "// Write custom data", "out", ".", "writeCustom", "(", "obj", ")", ";", "return", "t...
Writes a custom data to the output @param out Output writer @param obj Custom data @return <tt>true</tt> if the object has been written, otherwise <tt>false</tt>
[ "Writes", "a", "custom", "data", "to", "the", "output" ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/object/Serializer.java#L353-L361
train
Red5/red5-io
src/main/java/org/red5/io/object/Serializer.java
Serializer.serializeField
public static boolean serializeField(String keyName, Field field, Method getter) { log.trace("serializeField - keyName: {} field: {} method: {}", new Object[] { keyName, field, getter }); // if "field" is a class or is transient, skip it if ("class".equals(keyName)) { return false; ...
java
public static boolean serializeField(String keyName, Field field, Method getter) { log.trace("serializeField - keyName: {} field: {} method: {}", new Object[] { keyName, field, getter }); // if "field" is a class or is transient, skip it if ("class".equals(keyName)) { return false; ...
[ "public", "static", "boolean", "serializeField", "(", "String", "keyName", ",", "Field", "field", ",", "Method", "getter", ")", "{", "log", ".", "trace", "(", "\"serializeField - keyName: {} field: {} method: {}\"", ",", "new", "Object", "[", "]", "{", "keyName", ...
Checks whether the field should be serialized or not @param keyName key name @param field The field to be serialized @param getter Getter method for field @return <tt>true</tt> if the field should be serialized, otherwise <tt>false</tt>
[ "Checks", "whether", "the", "field", "should", "be", "serialized", "or", "not" ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/object/Serializer.java#L374-L395
train
Red5/red5-io
src/main/java/org/red5/io/object/Serializer.java
Serializer.getClassName
public static String getClassName(Class<?> objectClass) { RemoteClass annotation = objectClass.getAnnotation(RemoteClass.class); if (annotation != null) { return annotation.alias(); } String className = objectClass.getName(); if (className.startsWith("org.red5.compati...
java
public static String getClassName(Class<?> objectClass) { RemoteClass annotation = objectClass.getAnnotation(RemoteClass.class); if (annotation != null) { return annotation.alias(); } String className = objectClass.getName(); if (className.startsWith("org.red5.compati...
[ "public", "static", "String", "getClassName", "(", "Class", "<", "?", ">", "objectClass", ")", "{", "RemoteClass", "annotation", "=", "objectClass", ".", "getAnnotation", "(", "RemoteClass", ".", "class", ")", ";", "if", "(", "annotation", "!=", "null", ")",...
Handles classes by name, also provides "shortened" class aliases where appropriate. @param objectClass class @return class name for given object
[ "Handles", "classes", "by", "name", "also", "provides", "shortened", "class", "aliases", "where", "appropriate", "." ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/object/Serializer.java#L404-L423
train
Red5/red5-io
src/main/java/org/red5/io/object/BaseOutput.java
BaseOutput.storeReference
protected void storeReference(Object obj) { refMap.put(new IdentityWrapper(obj), Short.valueOf(refId++)); }
java
protected void storeReference(Object obj) { refMap.put(new IdentityWrapper(obj), Short.valueOf(refId++)); }
[ "protected", "void", "storeReference", "(", "Object", "obj", ")", "{", "refMap", ".", "put", "(", "new", "IdentityWrapper", "(", "obj", ")", ",", "Short", ".", "valueOf", "(", "refId", "++", ")", ")", ";", "}" ]
Store an object into a map @param obj Object to store
[ "Store", "an", "object", "into", "a", "map" ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/object/BaseOutput.java#L89-L91
train
Red5/red5-io
src/main/java/org/red5/codec/ScreenVideo.java
ScreenVideo.updateSize
private void updateSize(IoBuffer data) { this.widthInfo = data.getShort(); this.heightInfo = data.getShort(); // extract width and height of the frame this.width = this.widthInfo & 0xfff; this.height = this.heightInfo & 0xfff; // calculate size of blocks th...
java
private void updateSize(IoBuffer data) { this.widthInfo = data.getShort(); this.heightInfo = data.getShort(); // extract width and height of the frame this.width = this.widthInfo & 0xfff; this.height = this.heightInfo & 0xfff; // calculate size of blocks th...
[ "private", "void", "updateSize", "(", "IoBuffer", "data", ")", "{", "this", ".", "widthInfo", "=", "data", ".", "getShort", "(", ")", ";", "this", ".", "heightInfo", "=", "data", ".", "getShort", "(", ")", ";", "// extract width and height of the frame\r", "...
Update total block size @param data Byte buffer
[ "Update", "total", "block", "size" ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/codec/ScreenVideo.java#L145-L187
train
Red5/red5-io
src/main/java/org/red5/io/amf/Input.java
Input.readDataType
@Override public byte readDataType() { // prevent the handling of an empty Object if (buf.hasRemaining()) { do { // get the data type currentDataType = buf.get(); log.trace("Data type: {}", currentDataType); switch (currentDataType) { case AMF.TYPE_NULL: case AMF.TYPE_UNDEFINED: ret...
java
@Override public byte readDataType() { // prevent the handling of an empty Object if (buf.hasRemaining()) { do { // get the data type currentDataType = buf.get(); log.trace("Data type: {}", currentDataType); switch (currentDataType) { case AMF.TYPE_NULL: case AMF.TYPE_UNDEFINED: ret...
[ "@", "Override", "public", "byte", "readDataType", "(", ")", "{", "// prevent the handling of an empty Object", "if", "(", "buf", ".", "hasRemaining", "(", ")", ")", "{", "do", "{", "// get the data type", "currentDataType", "=", "buf", ".", "get", "(", ")", "...
Reads the data type. @return One of AMF class constants with type @see org.red5.io.amf.AMF
[ "Reads", "the", "data", "type", "." ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/amf/Input.java#L106-L156
train
Red5/red5-io
src/main/java/org/red5/io/amf/Input.java
Input.readBoolean
@Override public Boolean readBoolean() { return (buf.get() == AMF.VALUE_TRUE) ? Boolean.TRUE : Boolean.FALSE; }
java
@Override public Boolean readBoolean() { return (buf.get() == AMF.VALUE_TRUE) ? Boolean.TRUE : Boolean.FALSE; }
[ "@", "Override", "public", "Boolean", "readBoolean", "(", ")", "{", "return", "(", "buf", ".", "get", "(", ")", "==", "AMF", ".", "VALUE_TRUE", ")", "?", "Boolean", ".", "TRUE", ":", "Boolean", ".", "FALSE", ";", "}" ]
Reads a boolean. @return boolean
[ "Reads", "a", "boolean", "." ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/amf/Input.java#L173-L176
train
Red5/red5-io
src/main/java/org/red5/io/amf/Input.java
Input.readNumber
@Override public Number readNumber() { int remaining = buf.remaining(); log.debug("readNumber from {} bytes", remaining); // look to see if big enough for double if (remaining >= 8) { double d = buf.getDouble(); log.debug("Number: {}", d); return d; } if (log.isDebugEnabled()) { log.debug( ...
java
@Override public Number readNumber() { int remaining = buf.remaining(); log.debug("readNumber from {} bytes", remaining); // look to see if big enough for double if (remaining >= 8) { double d = buf.getDouble(); log.debug("Number: {}", d); return d; } if (log.isDebugEnabled()) { log.debug( ...
[ "@", "Override", "public", "Number", "readNumber", "(", ")", "{", "int", "remaining", "=", "buf", ".", "remaining", "(", ")", ";", "log", ".", "debug", "(", "\"readNumber from {} bytes\"", ",", "remaining", ")", ";", "// look to see if big enough for double", "i...
Reads a Number. In ActionScript 1 and 2 Number type represents all numbers, both floats and integers. @return Number
[ "Reads", "a", "Number", ".", "In", "ActionScript", "1", "and", "2", "Number", "type", "represents", "all", "numbers", "both", "floats", "and", "integers", "." ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/amf/Input.java#L184-L201
train
Red5/red5-io
src/main/java/org/red5/io/amf/Input.java
Input.getString
@Override public String getString() { log.trace("getString - currentDataType: {}", currentDataType); byte lastDataType = currentDataType; // temporarily set to string for reading if (currentDataType != AMF.TYPE_STRING) { currentDataType = AMF.TYPE_STRING; } String result = readString(); // set data ty...
java
@Override public String getString() { log.trace("getString - currentDataType: {}", currentDataType); byte lastDataType = currentDataType; // temporarily set to string for reading if (currentDataType != AMF.TYPE_STRING) { currentDataType = AMF.TYPE_STRING; } String result = readString(); // set data ty...
[ "@", "Override", "public", "String", "getString", "(", ")", "{", "log", ".", "trace", "(", "\"getString - currentDataType: {}\"", ",", "currentDataType", ")", ";", "byte", "lastDataType", "=", "currentDataType", ";", "// temporarily set to string for reading", "if", "...
Reads string from buffer @return String
[ "Reads", "string", "from", "buffer" ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/amf/Input.java#L208-L220
train
Red5/red5-io
src/main/java/org/red5/io/amf/Input.java
Input.bufferToString
private final String bufferToString(byte[] str) { String string = null; if (str != null) { string = AMF.CHARSET.decode(ByteBuffer.wrap(str)).toString(); log.debug("String: {}", string); } else { log.warn("ByteBuffer was null attempting to read String"); } return string; }
java
private final String bufferToString(byte[] str) { String string = null; if (str != null) { string = AMF.CHARSET.decode(ByteBuffer.wrap(str)).toString(); log.debug("String: {}", string); } else { log.warn("ByteBuffer was null attempting to read String"); } return string; }
[ "private", "final", "String", "bufferToString", "(", "byte", "[", "]", "str", ")", "{", "String", "string", "=", "null", ";", "if", "(", "str", "!=", "null", ")", "{", "string", "=", "AMF", ".", "CHARSET", ".", "decode", "(", "ByteBuffer", ".", "wrap...
Converts the bytes into a string. @param str string bytes @return decoded String
[ "Converts", "the", "bytes", "into", "a", "string", "." ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/amf/Input.java#L260-L269
train
Red5/red5-io
src/main/java/org/red5/io/amf/Input.java
Input.readKeyValues
@Override public Map<String, Object> readKeyValues() { Map<String, Object> result = new HashMap<String, Object>(); readKeyValues(result); return result; }
java
@Override public Map<String, Object> readKeyValues() { Map<String, Object> result = new HashMap<String, Object>(); readKeyValues(result); return result; }
[ "@", "Override", "public", "Map", "<", "String", ",", "Object", ">", "readKeyValues", "(", ")", "{", "Map", "<", "String", ",", "Object", ">", "result", "=", "new", "HashMap", "<", "String", ",", "Object", ">", "(", ")", ";", "readKeyValues", "(", "r...
Read key - value pairs. This is required for the RecordSet deserializer.
[ "Read", "key", "-", "value", "pairs", ".", "This", "is", "required", "for", "the", "RecordSet", "deserializer", "." ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/amf/Input.java#L327-L332
train
Red5/red5-io
src/main/java/org/red5/io/amf/Input.java
Input.readKeyValues
protected void readKeyValues(Map<String, Object> result) { while (hasMoreProperties()) { String name = readPropertyName(); log.debug("property: {}", name); Object property = Deserializer.deserialize(this, Object.class); log.debug("val: {}", property); result.put(name, property); if (hasMorePropertie...
java
protected void readKeyValues(Map<String, Object> result) { while (hasMoreProperties()) { String name = readPropertyName(); log.debug("property: {}", name); Object property = Deserializer.deserialize(this, Object.class); log.debug("val: {}", property); result.put(name, property); if (hasMorePropertie...
[ "protected", "void", "readKeyValues", "(", "Map", "<", "String", ",", "Object", ">", "result", ")", "{", "while", "(", "hasMoreProperties", "(", ")", ")", "{", "String", "name", "=", "readPropertyName", "(", ")", ";", "log", ".", "debug", "(", "\"propert...
Read key - value pairs into Map object @param result Map to put resulting pair to
[ "Read", "key", "-", "value", "pairs", "into", "Map", "object" ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/amf/Input.java#L340-L353
train
Red5/red5-io
src/main/java/org/red5/io/amf/Input.java
Input.newInstance
@SuppressWarnings("all") protected Object newInstance(String className) { log.debug("Loading class: {}", className); Object instance = null; Class<?> clazz = null; if ("".equals(className) || className == null) return instance; try { // check for special DS class aliases if (className.length() == 3)...
java
@SuppressWarnings("all") protected Object newInstance(String className) { log.debug("Loading class: {}", className); Object instance = null; Class<?> clazz = null; if ("".equals(className) || className == null) return instance; try { // check for special DS class aliases if (className.length() == 3)...
[ "@", "SuppressWarnings", "(", "\"all\"", ")", "protected", "Object", "newInstance", "(", "String", "className", ")", "{", "log", ".", "debug", "(", "\"Loading class: {}\"", ",", "className", ")", ";", "Object", "instance", "=", "null", ";", "Class", "<", "?"...
Creates a new instance of the className parameter and returns as an Object @param className Class name as String @return Object New object instance (for given class)
[ "Creates", "a", "new", "instance", "of", "the", "className", "parameter", "and", "returns", "as", "an", "Object" ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/amf/Input.java#L393-L433
train
Red5/red5-io
src/main/java/org/red5/io/amf/Input.java
Input.readBean
@SuppressWarnings({ "unchecked", "rawtypes" }) protected Object readBean(Object bean) { log.debug("readBean: {}", bean); storeReference(bean); Class theClass = bean.getClass(); while (hasMoreProperties()) { String name = readPropertyName(); Type type = getPropertyType(bean, name); log.debug("property:...
java
@SuppressWarnings({ "unchecked", "rawtypes" }) protected Object readBean(Object bean) { log.debug("readBean: {}", bean); storeReference(bean); Class theClass = bean.getClass(); while (hasMoreProperties()) { String name = readPropertyName(); Type type = getPropertyType(bean, name); log.debug("property:...
[ "@", "SuppressWarnings", "(", "{", "\"unchecked\"", ",", "\"rawtypes\"", "}", ")", "protected", "Object", "readBean", "(", "Object", "bean", ")", "{", "log", ".", "debug", "(", "\"readBean: {}\"", ",", "bean", ")", ";", "storeReference", "(", "bean", ")", ...
Reads the input as a bean and returns an object @param bean Input as bean @return Decoded object
[ "Reads", "the", "input", "as", "a", "bean", "and", "returns", "an", "object" ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/amf/Input.java#L442-L482
train
Red5/red5-io
src/main/java/org/red5/io/amf/Input.java
Input.readSimpleObject
protected Map<String, Object> readSimpleObject() { log.debug("readSimpleObject"); Map<String, Object> result = new ObjectMap<>(); readKeyValues(result); storeReference(result); return result; }
java
protected Map<String, Object> readSimpleObject() { log.debug("readSimpleObject"); Map<String, Object> result = new ObjectMap<>(); readKeyValues(result); storeReference(result); return result; }
[ "protected", "Map", "<", "String", ",", "Object", ">", "readSimpleObject", "(", ")", "{", "log", ".", "debug", "(", "\"readSimpleObject\"", ")", ";", "Map", "<", "String", ",", "Object", ">", "result", "=", "new", "ObjectMap", "<>", "(", ")", ";", "rea...
Reads the input as a map and returns a Map @return Read map
[ "Reads", "the", "input", "as", "a", "map", "and", "returns", "a", "Map" ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/amf/Input.java#L489-L495
train
Red5/red5-io
src/main/java/org/red5/io/amf/Input.java
Input.readObject
@Override public Object readObject() { String className; if (currentDataType == AMF.TYPE_CLASS_OBJECT) { className = getString(); log.debug("readObject: {}", className); if (className != null) { log.debug("read class object"); Object result = null; Object instance; if (className.equals("Re...
java
@Override public Object readObject() { String className; if (currentDataType == AMF.TYPE_CLASS_OBJECT) { className = getString(); log.debug("readObject: {}", className); if (className != null) { log.debug("read class object"); Object result = null; Object instance; if (className.equals("Re...
[ "@", "Override", "public", "Object", "readObject", "(", ")", "{", "String", "className", ";", "if", "(", "currentDataType", "==", "AMF", ".", "TYPE_CLASS_OBJECT", ")", "{", "className", "=", "getString", "(", ")", ";", "log", ".", "debug", "(", "\"readObje...
Reads start object @return Read object
[ "Reads", "start", "object" ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/amf/Input.java#L502-L535
train
Red5/red5-io
src/main/java/org/red5/io/amf/Input.java
Input.hasMoreProperties
public boolean hasMoreProperties() { if (buf.remaining() >= 3) { byte[] threeBytes = new byte[3]; int pos = buf.position(); buf.get(threeBytes); if (Arrays.equals(AMF.END_OF_OBJECT_SEQUENCE, threeBytes)) { log.trace("End of object"); return false; } buf.position(pos); return true; } /...
java
public boolean hasMoreProperties() { if (buf.remaining() >= 3) { byte[] threeBytes = new byte[3]; int pos = buf.position(); buf.get(threeBytes); if (Arrays.equals(AMF.END_OF_OBJECT_SEQUENCE, threeBytes)) { log.trace("End of object"); return false; } buf.position(pos); return true; } /...
[ "public", "boolean", "hasMoreProperties", "(", ")", "{", "if", "(", "buf", ".", "remaining", "(", ")", ">=", "3", ")", "{", "byte", "[", "]", "threeBytes", "=", "new", "byte", "[", "3", "]", ";", "int", "pos", "=", "buf", ".", "position", "(", ")...
Returns a boolean stating whether there are more properties @return boolean <code>true</code> if there are more properties to read, <code>false</code> otherwise
[ "Returns", "a", "boolean", "stating", "whether", "there", "are", "more", "properties" ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/amf/Input.java#L543-L557
train
Red5/red5-io
src/main/java/org/red5/io/flv/meta/MetaService.java
MetaService.mergeMeta
@SuppressWarnings({ "unchecked" }) public static IMeta mergeMeta(IMetaData<?, ?> metaData1, IMetaData<?, ?> metaData2) { //walk the entries and merge them //1. higher number values trump lower ones //2. true considered higher than false //3. strings are not replaced Map<Strin...
java
@SuppressWarnings({ "unchecked" }) public static IMeta mergeMeta(IMetaData<?, ?> metaData1, IMetaData<?, ?> metaData2) { //walk the entries and merge them //1. higher number values trump lower ones //2. true considered higher than false //3. strings are not replaced Map<Strin...
[ "@", "SuppressWarnings", "(", "{", "\"unchecked\"", "}", ")", "public", "static", "IMeta", "mergeMeta", "(", "IMetaData", "<", "?", ",", "?", ">", "metaData1", ",", "IMetaData", "<", "?", ",", "?", ">", "metaData2", ")", "{", "//walk the entries and merge th...
Merges the two Meta objects @param metaData1 First metadata object @param metaData2 Second metadata object @return Merged metadata
[ "Merges", "the", "two", "Meta", "objects" ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/flv/meta/MetaService.java#L150-L200
train
Red5/red5-io
src/main/java/org/red5/io/matroska/dtd/Tag.java
Tag.readData
public void readData(InputStream inputStream) throws IOException { if (inputStream == null) { return; } data = ParserUtils.parseBinary(inputStream, (int) size.getValue()); }
java
public void readData(InputStream inputStream) throws IOException { if (inputStream == null) { return; } data = ParserUtils.parseBinary(inputStream, (int) size.getValue()); }
[ "public", "void", "readData", "(", "InputStream", "inputStream", ")", "throws", "IOException", "{", "if", "(", "inputStream", "==", "null", ")", "{", "return", ";", "}", "data", "=", "ParserUtils", ".", "parseBinary", "(", "inputStream", ",", "(", "int", "...
method to read tag data from inputStream given @throws IOException - in case of any IO errors
[ "method", "to", "read", "tag", "data", "from", "inputStream", "given" ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/matroska/dtd/Tag.java#L112-L118
train
Red5/red5-io
src/main/java/org/red5/compatibility/flex/messaging/messages/AbstractMessage.java
AbstractMessage.addParameters
protected void addParameters(StringBuilder result) { result.append("ts="); result.append(timestamp); result.append(",headers="); result.append(headers); result.append(",body="); result.append(body); result.append(",messageId="); result.append(messa...
java
protected void addParameters(StringBuilder result) { result.append("ts="); result.append(timestamp); result.append(",headers="); result.append(headers); result.append(",body="); result.append(body); result.append(",messageId="); result.append(messa...
[ "protected", "void", "addParameters", "(", "StringBuilder", "result", ")", "{", "result", ".", "append", "(", "\"ts=\"", ")", ";", "result", ".", "append", "(", "timestamp", ")", ";", "result", ".", "append", "(", "\",headers=\"", ")", ";", "result", ".", ...
Add message properties to string. @param result <code>StringBuilder</code> to add properties to
[ "Add", "message", "properties", "to", "string", "." ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/compatibility/flex/messaging/messages/AbstractMessage.java#L76-L91
train
Red5/red5-io
src/main/java/org/red5/io/flv/impl/FLVWriter.java
FLVWriter.writeHeader
@Override public void writeHeader() throws IOException { // create a buffer ByteBuffer buf = ByteBuffer.allocate(HEADER_LENGTH + 4); // FLVHeader (9 bytes) + PreviousTagSize0 (4 bytes) // instance an flv header FLVHeader flvHeader = new FLVHeader(); flvHeader.setFlagAudio(aud...
java
@Override public void writeHeader() throws IOException { // create a buffer ByteBuffer buf = ByteBuffer.allocate(HEADER_LENGTH + 4); // FLVHeader (9 bytes) + PreviousTagSize0 (4 bytes) // instance an flv header FLVHeader flvHeader = new FLVHeader(); flvHeader.setFlagAudio(aud...
[ "@", "Override", "public", "void", "writeHeader", "(", ")", "throws", "IOException", "{", "// create a buffer", "ByteBuffer", "buf", "=", "ByteBuffer", ".", "allocate", "(", "HEADER_LENGTH", "+", "4", ")", ";", "// FLVHeader (9 bytes) + PreviousTagSize0 (4 bytes)", "/...
Writes the header bytes @throws IOException Any I/O exception
[ "Writes", "the", "header", "bytes" ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/flv/impl/FLVWriter.java#L357-L375
train
Red5/red5-io
src/main/java/org/red5/io/flv/impl/FLVWriter.java
FLVWriter.createOutputFile
private void createOutputFile() throws IOException { this.fileChannel = Files.newByteChannel(Paths.get(filePath), StandardOpenOption.CREATE, StandardOpenOption.WRITE, StandardOpenOption.TRUNCATE_EXISTING); }
java
private void createOutputFile() throws IOException { this.fileChannel = Files.newByteChannel(Paths.get(filePath), StandardOpenOption.CREATE, StandardOpenOption.WRITE, StandardOpenOption.TRUNCATE_EXISTING); }
[ "private", "void", "createOutputFile", "(", ")", "throws", "IOException", "{", "this", ".", "fileChannel", "=", "Files", ".", "newByteChannel", "(", "Paths", ".", "get", "(", "filePath", ")", ",", "StandardOpenOption", ".", "CREATE", ",", "StandardOpenOption", ...
Create the stream output file; the flv itself. @throws IOException
[ "Create", "the", "stream", "output", "file", ";", "the", "flv", "itself", "." ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/flv/impl/FLVWriter.java#L693-L695
train
Red5/red5-io
src/main/java/org/red5/io/flv/impl/FLVWriter.java
FLVWriter.createDataFile
private void createDataFile() throws IOException { // temporary data file for storage of stream data Path path = Paths.get(filePath + ".ser"); if (Files.deleteIfExists(path)) { log.debug("Previous flv data file existed and was removed"); } this.dataChannel = Files.new...
java
private void createDataFile() throws IOException { // temporary data file for storage of stream data Path path = Paths.get(filePath + ".ser"); if (Files.deleteIfExists(path)) { log.debug("Previous flv data file existed and was removed"); } this.dataChannel = Files.new...
[ "private", "void", "createDataFile", "(", ")", "throws", "IOException", "{", "// temporary data file for storage of stream data", "Path", "path", "=", "Paths", ".", "get", "(", "filePath", "+", "\".ser\"", ")", ";", "if", "(", "Files", ".", "deleteIfExists", "(", ...
Create the stream data file. @throws IOException
[ "Create", "the", "stream", "data", "file", "." ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/flv/impl/FLVWriter.java#L702-L709
train
Red5/red5-io
src/main/java/org/red5/io/flv/impl/FLVWriter.java
FLVWriter.createRepairDataFile
private void createRepairDataFile() throws IOException { // temporary data file for storage of stream data Path path = Paths.get(filePath + ".ser"); // Create a data channel that is read-only this.dataChannel = Files.newByteChannel(path, StandardOpenOption.READ); }
java
private void createRepairDataFile() throws IOException { // temporary data file for storage of stream data Path path = Paths.get(filePath + ".ser"); // Create a data channel that is read-only this.dataChannel = Files.newByteChannel(path, StandardOpenOption.READ); }
[ "private", "void", "createRepairDataFile", "(", ")", "throws", "IOException", "{", "// temporary data file for storage of stream data", "Path", "path", "=", "Paths", ".", "get", "(", "filePath", "+", "\".ser\"", ")", ";", "// Create a data channel that is read-only", "thi...
Create the stream data file for repair. @throws IOException
[ "Create", "the", "stream", "data", "file", "for", "repair", "." ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/flv/impl/FLVWriter.java#L716-L722
train
Red5/red5-io
src/main/java/org/red5/io/flv/impl/FLVWriter.java
FLVWriter.readInfoFile
private static int[] readInfoFile(File tmpFile) { int[] info = new int[8]; try (RandomAccessFile infoFile = new RandomAccessFile(tmpFile, "r")) { // audio codec id info[0] = infoFile.readInt(); // video codec id info[1] = infoFile.readInt(); //...
java
private static int[] readInfoFile(File tmpFile) { int[] info = new int[8]; try (RandomAccessFile infoFile = new RandomAccessFile(tmpFile, "r")) { // audio codec id info[0] = infoFile.readInt(); // video codec id info[1] = infoFile.readInt(); //...
[ "private", "static", "int", "[", "]", "readInfoFile", "(", "File", "tmpFile", ")", "{", "int", "[", "]", "info", "=", "new", "int", "[", "8", "]", ";", "try", "(", "RandomAccessFile", "infoFile", "=", "new", "RandomAccessFile", "(", "tmpFile", ",", "\"...
Read flv file information from pre-finalization file. @param tmpFile @return array containing audio codec id, video codec id, and duration
[ "Read", "flv", "file", "information", "from", "pre", "-", "finalization", "file", "." ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/flv/impl/FLVWriter.java#L1005-L1028
train
Red5/red5-io
src/main/java/org/red5/io/flv/impl/FLVWriter.java
FLVWriter.updateInfoFile
private void updateInfoFile() { try (RandomAccessFile infoFile = new RandomAccessFile(filePath + ".info", "rw")) { infoFile.writeInt(audioCodecId); infoFile.writeInt(videoCodecId); infoFile.writeInt(duration); // additional props infoFile.writeInt(audi...
java
private void updateInfoFile() { try (RandomAccessFile infoFile = new RandomAccessFile(filePath + ".info", "rw")) { infoFile.writeInt(audioCodecId); infoFile.writeInt(videoCodecId); infoFile.writeInt(duration); // additional props infoFile.writeInt(audi...
[ "private", "void", "updateInfoFile", "(", ")", "{", "try", "(", "RandomAccessFile", "infoFile", "=", "new", "RandomAccessFile", "(", "filePath", "+", "\".info\"", ",", "\"rw\"", ")", ")", "{", "infoFile", ".", "writeInt", "(", "audioCodecId", ")", ";", "info...
Write or update flv file information into the pre-finalization file.
[ "Write", "or", "update", "flv", "file", "information", "into", "the", "pre", "-", "finalization", "file", "." ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/flv/impl/FLVWriter.java#L1033-L1047
train
Red5/red5-io
src/main/java/org/red5/io/flv/impl/FLVWriter.java
FLVWriter.close
@Override public void close() { log.debug("close"); // spawn a thread to finish up our flv writer work boolean locked = false; try { // try to get a lock within x time locked = lock.tryAcquire(500L, TimeUnit.MILLISECONDS); if (locked) { ...
java
@Override public void close() { log.debug("close"); // spawn a thread to finish up our flv writer work boolean locked = false; try { // try to get a lock within x time locked = lock.tryAcquire(500L, TimeUnit.MILLISECONDS); if (locked) { ...
[ "@", "Override", "public", "void", "close", "(", ")", "{", "log", ".", "debug", "(", "\"close\"", ")", ";", "// spawn a thread to finish up our flv writer work", "boolean", "locked", "=", "false", ";", "try", "{", "// try to get a lock within x time", "locked", "=",...
Ends the writing process, then merges the data file with the flv file header and metadata.
[ "Ends", "the", "writing", "process", "then", "merges", "the", "data", "file", "with", "the", "flv", "file", "header", "and", "metadata", "." ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/flv/impl/FLVWriter.java#L1052-L1073
train
Red5/red5-io
src/main/java/org/red5/io/flv/impl/FLVWriter.java
FLVWriter.repair
public static boolean repair(String path, Integer audioId, Integer videoId) throws InterruptedException { boolean result = false; FLVWriter writer = null; log.debug("Serial file path: " + path); System.out.println("Serial file path: " + path); if (path.endsWith(".ser")) { ...
java
public static boolean repair(String path, Integer audioId, Integer videoId) throws InterruptedException { boolean result = false; FLVWriter writer = null; log.debug("Serial file path: " + path); System.out.println("Serial file path: " + path); if (path.endsWith(".ser")) { ...
[ "public", "static", "boolean", "repair", "(", "String", "path", ",", "Integer", "audioId", ",", "Integer", "videoId", ")", "throws", "InterruptedException", "{", "boolean", "result", "=", "false", ";", "FLVWriter", "writer", "=", "null", ";", "log", ".", "de...
Allows repair of flv files if .info and .ser files still exist. @param path path to .ser file @param audioId audio codec id @param videoId video codec id @return true if conversion was successful @throws InterruptedException Exception on interruption
[ "Allows", "repair", "of", "flv", "files", "if", ".", "info", "and", ".", "ser", "files", "still", "exist", "." ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/flv/impl/FLVWriter.java#L1193-L1245
train
Red5/red5-io
src/main/java/org/red5/io/flv/impl/FLVWriter.java
FLVWriter.submit
private Future<?> submit(FLVFinalizer flvFinalizer) { if (executor != null && !executor.isTerminated()) { return executor.submit(flvFinalizer); } return null; }
java
private Future<?> submit(FLVFinalizer flvFinalizer) { if (executor != null && !executor.isTerminated()) { return executor.submit(flvFinalizer); } return null; }
[ "private", "Future", "<", "?", ">", "submit", "(", "FLVFinalizer", "flvFinalizer", ")", "{", "if", "(", "executor", "!=", "null", "&&", "!", "executor", ".", "isTerminated", "(", ")", ")", "{", "return", "executor", ".", "submit", "(", "flvFinalizer", ")...
Submits a finalizer internally. @param flvFinalizer @return Future representing task
[ "Submits", "a", "finalizer", "internally", "." ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/flv/impl/FLVWriter.java#L1253-L1258
train
Red5/red5-io
src/main/java/org/red5/io/flv/impl/FLVWriter.java
FLVWriter.main
public static void main(String[] args) throws InterruptedException { if (args == null || args[0] == null) { System.err.println("Provide the path to your .ser file"); } else { repair(args[0], args.length > 1 && args[1] != null ? Integer.valueOf(args[1]) : null, args.length > 2 && ...
java
public static void main(String[] args) throws InterruptedException { if (args == null || args[0] == null) { System.err.println("Provide the path to your .ser file"); } else { repair(args[0], args.length > 1 && args[1] != null ? Integer.valueOf(args[1]) : null, args.length > 2 && ...
[ "public", "static", "void", "main", "(", "String", "[", "]", "args", ")", "throws", "InterruptedException", "{", "if", "(", "args", "==", "null", "||", "args", "[", "0", "]", "==", "null", ")", "{", "System", ".", "err", ".", "println", "(", "\"Provi...
Exposed to allow repair of flv files if .info and .ser files still exist. @param args 0: path to .ser file 1: audio codec id 2: video codec id @throws InterruptedException Exception on interruption
[ "Exposed", "to", "allow", "repair", "of", "flv", "files", "if", ".", "info", "and", ".", "ser", "files", "still", "exist", "." ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/flv/impl/FLVWriter.java#L1268-L1275
train
Red5/red5-io
src/main/java/org/red5/io/object/BaseInput.java
BaseInput.storeReference
protected int storeReference(Object obj) { int newRefId = refId.getAndIncrement(); //log.trace("storeReference - ref id: {} obj: {}", newRefId, obj); refMap.put(Integer.valueOf(newRefId), obj); return newRefId; }
java
protected int storeReference(Object obj) { int newRefId = refId.getAndIncrement(); //log.trace("storeReference - ref id: {} obj: {}", newRefId, obj); refMap.put(Integer.valueOf(newRefId), obj); return newRefId; }
[ "protected", "int", "storeReference", "(", "Object", "obj", ")", "{", "int", "newRefId", "=", "refId", ".", "getAndIncrement", "(", ")", ";", "//log.trace(\"storeReference - ref id: {} obj: {}\", newRefId, obj);", "refMap", ".", "put", "(", "Integer", ".", "valueOf", ...
Store an object into a map. @param obj Object to store @return reference id
[ "Store", "an", "object", "into", "a", "map", "." ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/object/BaseInput.java#L52-L57
train
Red5/red5-io
src/main/java/org/red5/io/object/BaseInput.java
BaseInput.storeReference
protected void storeReference(int refId, Object newRef) { refMap.put(Integer.valueOf(refId), newRef); }
java
protected void storeReference(int refId, Object newRef) { refMap.put(Integer.valueOf(refId), newRef); }
[ "protected", "void", "storeReference", "(", "int", "refId", ",", "Object", "newRef", ")", "{", "refMap", ".", "put", "(", "Integer", ".", "valueOf", "(", "refId", ")", ",", "newRef", ")", ";", "}" ]
Replace a referenced object with another one. This is used by the AMF3 deserializer to handle circular references. @param refId reference id @param newRef replacement object
[ "Replace", "a", "referenced", "object", "with", "another", "one", ".", "This", "is", "used", "by", "the", "AMF3", "deserializer", "to", "handle", "circular", "references", "." ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/object/BaseInput.java#L67-L69
train
Red5/red5-io
src/main/java/org/red5/io/mp3/impl/MP3Stream.java
MP3Stream.createHeaderField
private HeaderBitField createHeaderField() throws IOException { HeaderBitField field = new HeaderBitField(); field.add(nextByte()); field.add(nextByte()); field.add(nextByte()); return field; }
java
private HeaderBitField createHeaderField() throws IOException { HeaderBitField field = new HeaderBitField(); field.add(nextByte()); field.add(nextByte()); field.add(nextByte()); return field; }
[ "private", "HeaderBitField", "createHeaderField", "(", ")", "throws", "IOException", "{", "HeaderBitField", "field", "=", "new", "HeaderBitField", "(", ")", ";", "field", ".", "add", "(", "nextByte", "(", ")", ")", ";", "field", ".", "add", "(", "nextByte", ...
Creates a bit field for the MPEG frame header. @return the bit field @throws IOException if an error occurs
[ "Creates", "a", "bit", "field", "for", "the", "MPEG", "frame", "header", "." ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/mp3/impl/MP3Stream.java#L164-L170
train
Red5/red5-io
src/main/java/org/red5/io/mp3/impl/MP3Stream.java
MP3Stream.skipStream
private static void skipStream(InputStream in, long count) throws IOException { long size = count; long skipped = 0; while (size > 0 && skipped >= 0) { skipped = in.skip(size); if (skipped != -1) { size -= skipped; } } }
java
private static void skipStream(InputStream in, long count) throws IOException { long size = count; long skipped = 0; while (size > 0 && skipped >= 0) { skipped = in.skip(size); if (skipped != -1) { size -= skipped; } } }
[ "private", "static", "void", "skipStream", "(", "InputStream", "in", ",", "long", "count", ")", "throws", "IOException", "{", "long", "size", "=", "count", ";", "long", "skipped", "=", "0", ";", "while", "(", "size", ">", "0", "&&", "skipped", ">=", "0...
Skips the given number of bytes from the specified input stream. @param in the input stream @param count the number of bytes to skip @throws IOException if an IO error occurs
[ "Skips", "the", "given", "number", "of", "bytes", "from", "the", "specified", "input", "stream", "." ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/mp3/impl/MP3Stream.java#L240-L249
train
Red5/red5-io
src/main/java/org/red5/io/mp3/impl/MP3Stream.java
MP3Stream.calculateBitRate
private static int calculateBitRate(int mpegVer, int layer, int code) { int[] arr = null; if (mpegVer == AudioFrame.MPEG_V1) { switch (layer) { case AudioFrame.LAYER_1: arr = BIT_RATE_MPEG1_L1; break; case AudioFrame.LAY...
java
private static int calculateBitRate(int mpegVer, int layer, int code) { int[] arr = null; if (mpegVer == AudioFrame.MPEG_V1) { switch (layer) { case AudioFrame.LAYER_1: arr = BIT_RATE_MPEG1_L1; break; case AudioFrame.LAY...
[ "private", "static", "int", "calculateBitRate", "(", "int", "mpegVer", ",", "int", "layer", ",", "int", "code", ")", "{", "int", "[", "]", "arr", "=", "null", ";", "if", "(", "mpegVer", "==", "AudioFrame", ".", "MPEG_V1", ")", "{", "switch", "(", "la...
Calculates the bit rate based on the given parameters. @param mpegVer the MPEG version @param layer the layer @param code the code for the bit rate @return the bit rate in bits per second
[ "Calculates", "the", "bit", "rate", "based", "on", "the", "given", "parameters", "." ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/mp3/impl/MP3Stream.java#L262-L284
train
Red5/red5-io
src/main/java/org/red5/io/mp3/impl/MP3Stream.java
MP3Stream.calculateFrameLength
private static int calculateFrameLength(int layer, int bitRate, int sampleRate, int padding) { if (layer == AudioFrame.LAYER_1) { return (12 * bitRate / sampleRate + padding) * 4; } else { return 144 * bitRate / sampleRate + padding; } }
java
private static int calculateFrameLength(int layer, int bitRate, int sampleRate, int padding) { if (layer == AudioFrame.LAYER_1) { return (12 * bitRate / sampleRate + padding) * 4; } else { return 144 * bitRate / sampleRate + padding; } }
[ "private", "static", "int", "calculateFrameLength", "(", "int", "layer", ",", "int", "bitRate", ",", "int", "sampleRate", ",", "int", "padding", ")", "{", "if", "(", "layer", "==", "AudioFrame", ".", "LAYER_1", ")", "{", "return", "(", "12", "*", "bitRat...
Calculates the length of an MPEG frame based on the given parameters. @param layer the layer @param bitRate the bit rate @param sampleRate the sample rate @param padding the padding flag @return the length of the frame in bytes
[ "Calculates", "the", "length", "of", "an", "MPEG", "frame", "based", "on", "the", "given", "parameters", "." ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/mp3/impl/MP3Stream.java#L312-L318
train
Red5/red5-io
src/main/java/org/red5/io/mp3/impl/MP3Stream.java
MP3Stream.calculateDuration
private static float calculateDuration(int layer, int sampleRate) { int sampleCount = (layer == AudioFrame.LAYER_1) ? SAMPLE_COUNT_L1 : SAMPLE_COUNT_L2; return (1000.0f / sampleRate) * sampleCount; }
java
private static float calculateDuration(int layer, int sampleRate) { int sampleCount = (layer == AudioFrame.LAYER_1) ? SAMPLE_COUNT_L1 : SAMPLE_COUNT_L2; return (1000.0f / sampleRate) * sampleCount; }
[ "private", "static", "float", "calculateDuration", "(", "int", "layer", ",", "int", "sampleRate", ")", "{", "int", "sampleCount", "=", "(", "layer", "==", "AudioFrame", ".", "LAYER_1", ")", "?", "SAMPLE_COUNT_L1", ":", "SAMPLE_COUNT_L2", ";", "return", "(", ...
Calculates the duration of a MPEG frame based on the given parameters. @param layer the layer @param sampleRate the sample rate @return the duration of this frame in milliseconds
[ "Calculates", "the", "duration", "of", "a", "MPEG", "frame", "based", "on", "the", "given", "parameters", "." ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/mp3/impl/MP3Stream.java#L329-L332
train
Red5/red5-io
src/main/java/org/red5/io/mp3/impl/MP3Stream.java
MP3Stream.createSampleRateTable
private static int[][] createSampleRateTable() { int[][] arr = new int[4][]; arr[AudioFrame.MPEG_V1] = SAMPLE_RATE_MPEG1; arr[AudioFrame.MPEG_V2] = SAMPLE_RATE_MPEG2; arr[AudioFrame.MPEG_V2_5] = SAMPLE_RATE_MPEG2_5; return arr; }
java
private static int[][] createSampleRateTable() { int[][] arr = new int[4][]; arr[AudioFrame.MPEG_V1] = SAMPLE_RATE_MPEG1; arr[AudioFrame.MPEG_V2] = SAMPLE_RATE_MPEG2; arr[AudioFrame.MPEG_V2_5] = SAMPLE_RATE_MPEG2_5; return arr; }
[ "private", "static", "int", "[", "]", "[", "]", "createSampleRateTable", "(", ")", "{", "int", "[", "]", "[", "]", "arr", "=", "new", "int", "[", "4", "]", "[", "", "]", ";", "arr", "[", "AudioFrame", ".", "MPEG_V1", "]", "=", "SAMPLE_RATE_MPEG1", ...
Creates the complete array for the sample rate mapping. @return the table for the sample rates
[ "Creates", "the", "complete", "array", "for", "the", "sample", "rate", "mapping", "." ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/mp3/impl/MP3Stream.java#L350-L356
train
Red5/red5-io
src/main/java/org/red5/io/flv/FLVHeader.java
FLVHeader.write
public void write(IoBuffer buffer) { // FLV buffer.put(signature); // version buffer.put(version); // flags buffer.put((byte) (FLV_HEADER_FLAG_HAS_AUDIO * (flagAudio ? 1 : 0) + FLV_HEADER_FLAG_HAS_VIDEO * (flagVideo ? 1 : 0))); // data offset buffer.putInt...
java
public void write(IoBuffer buffer) { // FLV buffer.put(signature); // version buffer.put(version); // flags buffer.put((byte) (FLV_HEADER_FLAG_HAS_AUDIO * (flagAudio ? 1 : 0) + FLV_HEADER_FLAG_HAS_VIDEO * (flagVideo ? 1 : 0))); // data offset buffer.putInt...
[ "public", "void", "write", "(", "IoBuffer", "buffer", ")", "{", "// FLV", "buffer", ".", "put", "(", "signature", ")", ";", "// version", "buffer", ".", "put", "(", "version", ")", ";", "// flags", "buffer", ".", "put", "(", "(", "byte", ")", "(", "F...
Writes the FLVHeader to IoBuffer. @param buffer IoBuffer to write
[ "Writes", "the", "FLVHeader", "to", "IoBuffer", "." ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/flv/FLVHeader.java#L227-L239
train
Red5/red5-io
src/main/java/org/red5/io/amf3/Input.java
Input.readDataType
@Override public byte readDataType() { log.trace("readDataType - amf3_mode: {}", amf3_mode); byte coreType = AMF3.TYPE_UNDEFINED; if (buf != null) { currentDataType = buf.get(); log.debug("Current data type: {}", currentDataType); switch (currentDat...
java
@Override public byte readDataType() { log.trace("readDataType - amf3_mode: {}", amf3_mode); byte coreType = AMF3.TYPE_UNDEFINED; if (buf != null) { currentDataType = buf.get(); log.debug("Current data type: {}", currentDataType); switch (currentDat...
[ "@", "Override", "public", "byte", "readDataType", "(", ")", "{", "log", ".", "trace", "(", "\"readDataType - amf3_mode: {}\"", ",", "amf3_mode", ")", ";", "byte", "coreType", "=", "AMF3", ".", "TYPE_UNDEFINED", ";", "if", "(", "buf", "!=", "null", ")", "{...
Reads the data type @return byte Data type
[ "Reads", "the", "data", "type" ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/amf3/Input.java#L232-L339
train
Red5/red5-io
src/main/java/org/red5/io/amf3/Input.java
Input.readNumber
@Override public Number readNumber() { if (buf.hasRemaining()) { int remaining = buf.remaining(); if (log.isTraceEnabled()) { log.trace("Remaining bytes for Number: {}", remaining); } Number v; if (currentDataType == AMF3.TY...
java
@Override public Number readNumber() { if (buf.hasRemaining()) { int remaining = buf.remaining(); if (log.isTraceEnabled()) { log.trace("Remaining bytes for Number: {}", remaining); } Number v; if (currentDataType == AMF3.TY...
[ "@", "Override", "public", "Number", "readNumber", "(", ")", "{", "if", "(", "buf", ".", "hasRemaining", "(", ")", ")", "{", "int", "remaining", "=", "buf", ".", "remaining", "(", ")", ";", "if", "(", "log", ".", "isTraceEnabled", "(", ")", ")", "{...
Reads a Number @return Number Number
[ "Reads", "a", "Number" ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/amf3/Input.java#L366-L393
train
Red5/red5-io
src/main/java/org/red5/io/amf3/Input.java
Input.readString
public String readString(int length) { log.debug("readString - length: {}", length); int limit = buf.limit(); final ByteBuffer strBuf = buf.buf(); strBuf.limit(strBuf.position() + length); final String string = AMF.CHARSET.decode(strBuf).toString(); log.debug("Strin...
java
public String readString(int length) { log.debug("readString - length: {}", length); int limit = buf.limit(); final ByteBuffer strBuf = buf.buf(); strBuf.limit(strBuf.position() + length); final String string = AMF.CHARSET.decode(strBuf).toString(); log.debug("Strin...
[ "public", "String", "readString", "(", "int", "length", ")", "{", "log", ".", "debug", "(", "\"readString - length: {}\"", ",", "length", ")", ";", "int", "limit", "=", "buf", ".", "limit", "(", ")", ";", "final", "ByteBuffer", "strBuf", "=", "buf", ".",...
Reads a string of a set length. This does not use the string reference table. @param length the length of the string @return String
[ "Reads", "a", "string", "of", "a", "set", "length", ".", "This", "does", "not", "use", "the", "string", "reference", "table", "." ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/amf3/Input.java#L445-L459
train
Red5/red5-io
src/main/java/org/red5/io/amf3/Input.java
Input.readByteArray
@Override public ByteArray readByteArray() { int type = readInteger(); if ((type & 1) == 0) { return (ByteArray) getReference(type >> 1); } type >>= 1; ByteArray result = new ByteArray(buf, type); storeReference(result); return result; ...
java
@Override public ByteArray readByteArray() { int type = readInteger(); if ((type & 1) == 0) { return (ByteArray) getReference(type >> 1); } type >>= 1; ByteArray result = new ByteArray(buf, type); storeReference(result); return result; ...
[ "@", "Override", "public", "ByteArray", "readByteArray", "(", ")", "{", "int", "type", "=", "readInteger", "(", ")", ";", "if", "(", "(", "type", "&", "1", ")", "==", "0", ")", "{", "return", "(", "ByteArray", ")", "getReference", "(", "type", ">>", ...
Read ByteArray object. @return ByteArray object
[ "Read", "ByteArray", "object", "." ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/amf3/Input.java#L871-L881
train
Red5/red5-io
src/main/java/org/red5/io/amf3/Input.java
Input.readVectorInt
@SuppressWarnings("unchecked") @Override public Vector<Integer> readVectorInt() { log.debug("readVectorInt"); int type = readInteger(); if ((type & 1) == 0) { return (Vector<Integer>) getReference(type >> 1); } int len = type >> 1; Vector<Inte...
java
@SuppressWarnings("unchecked") @Override public Vector<Integer> readVectorInt() { log.debug("readVectorInt"); int type = readInteger(); if ((type & 1) == 0) { return (Vector<Integer>) getReference(type >> 1); } int len = type >> 1; Vector<Inte...
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "@", "Override", "public", "Vector", "<", "Integer", ">", "readVectorInt", "(", ")", "{", "log", ".", "debug", "(", "\"readVectorInt\"", ")", ";", "int", "type", "=", "readInteger", "(", ")", ";", "if", ...
Read Vector&lt;Integer&gt; object. @return Vector&lt;Integer&gt; object
[ "Read", "Vector&lt", ";", "Integer&gt", ";", "object", "." ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/amf3/Input.java#L888-L905
train
Red5/red5-io
src/main/java/org/red5/io/amf3/Input.java
Input.readVectorUInt
@SuppressWarnings("unchecked") @Override public Vector<Long> readVectorUInt() { log.debug("readVectorUInt"); int type = readInteger(); if ((type & 1) == 0) { return (Vector<Long>) getReference(type >> 1); } int len = type >> 1; Vector<Long> ar...
java
@SuppressWarnings("unchecked") @Override public Vector<Long> readVectorUInt() { log.debug("readVectorUInt"); int type = readInteger(); if ((type & 1) == 0) { return (Vector<Long>) getReference(type >> 1); } int len = type >> 1; Vector<Long> ar...
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "@", "Override", "public", "Vector", "<", "Long", ">", "readVectorUInt", "(", ")", "{", "log", ".", "debug", "(", "\"readVectorUInt\"", ")", ";", "int", "type", "=", "readInteger", "(", ")", ";", "if", ...
Read Vector&lt;uint&gt; object. @return Vector&lt;Long&gt; object
[ "Read", "Vector&lt", ";", "uint&gt", ";", "object", "." ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/amf3/Input.java#L912-L933
train
Red5/red5-io
src/main/java/org/red5/io/amf3/Input.java
Input.readVectorNumber
@SuppressWarnings("unchecked") @Override public Vector<Double> readVectorNumber() { log.debug("readVectorNumber"); int type = readInteger(); log.debug("Type: {}", type); if ((type & 1) == 0) { return (Vector<Double>) getReference(type >> 1); } ...
java
@SuppressWarnings("unchecked") @Override public Vector<Double> readVectorNumber() { log.debug("readVectorNumber"); int type = readInteger(); log.debug("Type: {}", type); if ((type & 1) == 0) { return (Vector<Double>) getReference(type >> 1); } ...
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "@", "Override", "public", "Vector", "<", "Double", ">", "readVectorNumber", "(", ")", "{", "log", ".", "debug", "(", "\"readVectorNumber\"", ")", ";", "int", "type", "=", "readInteger", "(", ")", ";", "l...
Read Vector&lt;Number&gt; object. @return Vector&lt;Double&gt; object
[ "Read", "Vector&lt", ";", "Number&gt", ";", "object", "." ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/amf3/Input.java#L940-L961
train
Red5/red5-io
src/main/java/org/red5/io/amf3/Input.java
Input.readVectorObject
@SuppressWarnings("unchecked") @Override public Vector<Object> readVectorObject() { log.debug("readVectorObject"); int type = readInteger(); log.debug("Type: {}", type); if ((type & 1) == 0) { return (Vector<Object>) getReference(type >> 1); } ...
java
@SuppressWarnings("unchecked") @Override public Vector<Object> readVectorObject() { log.debug("readVectorObject"); int type = readInteger(); log.debug("Type: {}", type); if ((type & 1) == 0) { return (Vector<Object>) getReference(type >> 1); } ...
[ "@", "SuppressWarnings", "(", "\"unchecked\"", ")", "@", "Override", "public", "Vector", "<", "Object", ">", "readVectorObject", "(", ")", "{", "log", ".", "debug", "(", "\"readVectorObject\"", ")", ";", "int", "type", "=", "readInteger", "(", ")", ";", "l...
Read Vector&lt;Object&gt; object. @return Vector&lt;Object&gt; object
[ "Read", "Vector&lt", ";", "Object&gt", ";", "object", "." ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/amf3/Input.java#L968-L1024
train
Red5/red5-io
src/main/java/org/red5/io/amf3/Input.java
Input.readInteger
private int readInteger() { int b = buf.get(); if (buf.hasRemaining()) { int n = 0; int result = 0; while ((b & 0x80) != 0 && n < 3) { result <<= 7; result |= (b & 0x7f); b = buf.get(); n++; ...
java
private int readInteger() { int b = buf.get(); if (buf.hasRemaining()) { int n = 0; int result = 0; while ((b & 0x80) != 0 && n < 3) { result <<= 7; result |= (b & 0x7f); b = buf.get(); n++; ...
[ "private", "int", "readInteger", "(", ")", "{", "int", "b", "=", "buf", ".", "get", "(", ")", ";", "if", "(", "buf", ".", "hasRemaining", "(", ")", ")", "{", "int", "n", "=", "0", ";", "int", "result", "=", "0", ";", "while", "(", "(", "b", ...
Parser of AMF3 "compressed" integer data type @return a converted integer value
[ "Parser", "of", "AMF3", "compressed", "integer", "data", "type" ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/amf3/Input.java#L1048-L1075
train
Red5/red5-io
src/main/java/org/red5/io/amf3/Input.java
Input.readAMF3IntegerNew
@SuppressWarnings("unused") private int readAMF3IntegerNew() { int b = buf.get() & 0xFF; if (b < 128) { return b; } int value = (b & 0x7F) << 7; b = buf.get() & 0xFF; if (b < 128) { return (value | b); } value = (valu...
java
@SuppressWarnings("unused") private int readAMF3IntegerNew() { int b = buf.get() & 0xFF; if (b < 128) { return b; } int value = (b & 0x7F) << 7; b = buf.get() & 0xFF; if (b < 128) { return (value | b); } value = (valu...
[ "@", "SuppressWarnings", "(", "\"unused\"", ")", "private", "int", "readAMF3IntegerNew", "(", ")", "{", "int", "b", "=", "buf", ".", "get", "(", ")", "&", "0xFF", ";", "if", "(", "b", "<", "128", ")", "{", "return", "b", ";", "}", "int", "value", ...
Read UInt29 style
[ "Read", "UInt29", "style" ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/amf3/Input.java#L1078-L1097
train
Red5/red5-io
src/main/java/org/red5/io/matroska/parser/TagCrawler.java
TagCrawler.process
public void process(InputStream input) throws IOException, ConverterException { while (0 != input.available()) { Tag tag = ParserUtils.parseTag(input); TagHandler handler = getHandler(tag); if (null == handler) { skipHandler.handle(tag, input); } e...
java
public void process(InputStream input) throws IOException, ConverterException { while (0 != input.available()) { Tag tag = ParserUtils.parseTag(input); TagHandler handler = getHandler(tag); if (null == handler) { skipHandler.handle(tag, input); } e...
[ "public", "void", "process", "(", "InputStream", "input", ")", "throws", "IOException", ",", "ConverterException", "{", "while", "(", "0", "!=", "input", ".", "available", "(", ")", ")", "{", "Tag", "tag", "=", "ParserUtils", ".", "parseTag", "(", "input",...
Method to process the input stream given, will stop as soon as input stream will be empty @param input - input stream to process @throws IOException - in case of any IO errors @throws ConverterException - in case of any conversion errorss
[ "Method", "to", "process", "the", "input", "stream", "given", "will", "stop", "as", "soon", "as", "input", "stream", "will", "be", "empty" ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/matroska/parser/TagCrawler.java#L121-L131
train
Red5/red5-io
src/main/java/org/red5/io/utils/IOUtils.java
IOUtils.writeReverseInt
public final static void writeReverseInt(IoBuffer out, int value) { out.putInt((int) ((value & 0xFF) << 24 | ((value >> 8) & 0x00FF) << 16 | ((value >>> 16) & 0x000000FF) << 8 | ((value >>> 24) & 0x000000FF))); }
java
public final static void writeReverseInt(IoBuffer out, int value) { out.putInt((int) ((value & 0xFF) << 24 | ((value >> 8) & 0x00FF) << 16 | ((value >>> 16) & 0x000000FF) << 8 | ((value >>> 24) & 0x000000FF))); }
[ "public", "final", "static", "void", "writeReverseInt", "(", "IoBuffer", "out", ",", "int", "value", ")", "{", "out", ".", "putInt", "(", "(", "int", ")", "(", "(", "value", "&", "0xFF", ")", "<<", "24", "|", "(", "(", "value", ">>", "8", ")", "&...
Writes integer in reverse order @param out Data buffer to fill @param value Integer
[ "Writes", "integer", "in", "reverse", "order" ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/utils/IOUtils.java#L47-L49
train
Red5/red5-io
src/main/java/org/red5/io/utils/IOUtils.java
IOUtils.writeMediumInt
public final static void writeMediumInt(ByteBuffer out, int value) { out.put((byte) ((value >>> 16) & 0xff)); out.put((byte) ((value >>> 8) & 0xff)); out.put((byte) (value & 0xff)); }
java
public final static void writeMediumInt(ByteBuffer out, int value) { out.put((byte) ((value >>> 16) & 0xff)); out.put((byte) ((value >>> 8) & 0xff)); out.put((byte) (value & 0xff)); }
[ "public", "final", "static", "void", "writeMediumInt", "(", "ByteBuffer", "out", ",", "int", "value", ")", "{", "out", ".", "put", "(", "(", "byte", ")", "(", "(", "value", ">>>", "16", ")", "&", "0xff", ")", ")", ";", "out", ".", "put", "(", "("...
Writes medium integer @param out Output buffer @param value Integer to write
[ "Writes", "medium", "integer" ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/utils/IOUtils.java#L75-L79
train
Red5/red5-io
src/main/java/org/red5/io/utils/IOUtils.java
IOUtils.readReverseInt
public final static int readReverseInt(IoBuffer in) { int value = in.getInt(); value = ((value & 0xFF) << 24 | ((value >> 8) & 0x00FF) << 16 | ((value >>> 16) & 0x000000FF) << 8 | ((value >>> 24) & 0x000000FF)); return value; }
java
public final static int readReverseInt(IoBuffer in) { int value = in.getInt(); value = ((value & 0xFF) << 24 | ((value >> 8) & 0x00FF) << 16 | ((value >>> 16) & 0x000000FF) << 8 | ((value >>> 24) & 0x000000FF)); return value; }
[ "public", "final", "static", "int", "readReverseInt", "(", "IoBuffer", "in", ")", "{", "int", "value", "=", "in", ".", "getInt", "(", ")", ";", "value", "=", "(", "(", "value", "&", "0xFF", ")", "<<", "24", "|", "(", "(", "value", ">>", "8", ")",...
Reads reverse int @param in Source @return int
[ "Reads", "reverse", "int" ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/utils/IOUtils.java#L196-L200
train
Red5/red5-io
src/main/java/org/red5/io/utils/IOUtils.java
IOUtils.debug
public final static void debug(Logger log, String msg, IoBuffer buf) { if (log.isDebugEnabled()) { log.debug(msg); log.debug("Size: {}", buf.remaining()); log.debug("Data:\n{}", HexDump.formatHexDump(buf.getHexDump())); log.debug("\n{}\n", toString(buf)); ...
java
public final static void debug(Logger log, String msg, IoBuffer buf) { if (log.isDebugEnabled()) { log.debug(msg); log.debug("Size: {}", buf.remaining()); log.debug("Data:\n{}", HexDump.formatHexDump(buf.getHexDump())); log.debug("\n{}\n", toString(buf)); ...
[ "public", "final", "static", "void", "debug", "(", "Logger", "log", ",", "String", "msg", ",", "IoBuffer", "buf", ")", "{", "if", "(", "log", ".", "isDebugEnabled", "(", ")", ")", "{", "log", ".", "debug", "(", "msg", ")", ";", "log", ".", "debug",...
Format debug message @param log Logger @param msg Message @param buf Byte buffer to debug
[ "Format", "debug", "message" ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/utils/IOUtils.java#L212-L219
train
Red5/red5-io
src/main/java/org/red5/compatibility/flex/messaging/io/ObjectProxy.java
ObjectProxy.put
@Override public V put(T name, V value) { return item.put(name, value); }
java
@Override public V put(T name, V value) { return item.put(name, value); }
[ "@", "Override", "public", "V", "put", "(", "T", "name", ",", "V", "value", ")", "{", "return", "item", ".", "put", "(", "name", ",", "value", ")", ";", "}" ]
Change a property of the proxied object. @param name name @param value value @return old value
[ "Change", "a", "property", "of", "the", "proxied", "object", "." ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/compatibility/flex/messaging/io/ObjectProxy.java#L147-L150
train
Red5/red5-io
src/main/java/org/red5/io/matroska/ParserUtils.java
ParserUtils.parseString
public static String parseString(InputStream inputStream, final int size) throws IOException { if (0 == size) { return ""; } byte[] buffer = new byte[size]; int numberOfReadsBytes = inputStream.read(buffer, 0, size); assert numberOfReadsBytes == size; return...
java
public static String parseString(InputStream inputStream, final int size) throws IOException { if (0 == size) { return ""; } byte[] buffer = new byte[size]; int numberOfReadsBytes = inputStream.read(buffer, 0, size); assert numberOfReadsBytes == size; return...
[ "public", "static", "String", "parseString", "(", "InputStream", "inputStream", ",", "final", "int", "size", ")", "throws", "IOException", "{", "if", "(", "0", "==", "size", ")", "{", "return", "\"\"", ";", "}", "byte", "[", "]", "buffer", "=", "new", ...
method used to parse string @param inputStream - stream to get value @param size - size of the value in bytes @return - parsed value as {@link String} @throws IOException - in case of IO error
[ "method", "used", "to", "parse", "string" ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/matroska/ParserUtils.java#L77-L87
train
Red5/red5-io
src/main/java/org/red5/io/matroska/ParserUtils.java
ParserUtils.parseFloat
public static double parseFloat(InputStream inputStream, final int size) throws IOException { byte[] buffer = new byte[size]; int numberOfReadsBytes = inputStream.read(buffer, 0, size); assert numberOfReadsBytes == size; ByteBuffer byteBuffer = ByteBuffer.wrap(buffer).order(ByteOrder.BI...
java
public static double parseFloat(InputStream inputStream, final int size) throws IOException { byte[] buffer = new byte[size]; int numberOfReadsBytes = inputStream.read(buffer, 0, size); assert numberOfReadsBytes == size; ByteBuffer byteBuffer = ByteBuffer.wrap(buffer).order(ByteOrder.BI...
[ "public", "static", "double", "parseFloat", "(", "InputStream", "inputStream", ",", "final", "int", "size", ")", "throws", "IOException", "{", "byte", "[", "]", "buffer", "=", "new", "byte", "[", "size", "]", ";", "int", "numberOfReadsBytes", "=", "inputStre...
method used to parse float and double @param inputStream - stream to get value @param size - size of the value in bytes @return - parsed value as double @throws IOException - in case of IO error
[ "method", "used", "to", "parse", "float", "and", "double" ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/matroska/ParserUtils.java#L100-L111
train
Red5/red5-io
src/main/java/org/red5/io/matroska/ParserUtils.java
ParserUtils.parseBinary
public static byte[] parseBinary(InputStream inputStream, final int size) throws IOException { byte value[] = new byte[size]; int i = value.length; while (i != 0) { i -= inputStream.read(value, value.length - i, i); } return value; }
java
public static byte[] parseBinary(InputStream inputStream, final int size) throws IOException { byte value[] = new byte[size]; int i = value.length; while (i != 0) { i -= inputStream.read(value, value.length - i, i); } return value; }
[ "public", "static", "byte", "[", "]", "parseBinary", "(", "InputStream", "inputStream", ",", "final", "int", "size", ")", "throws", "IOException", "{", "byte", "value", "[", "]", "=", "new", "byte", "[", "size", "]", ";", "int", "i", "=", "value", ".",...
method to parse byte array @param inputStream - stream to get value @param size - size of the value in bytes @return - parsed value as array of bytes @throws IOException - in case of IO error
[ "method", "to", "parse", "byte", "array" ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/matroska/ParserUtils.java#L151-L159
train
Red5/red5-io
src/main/java/org/red5/io/matroska/ParserUtils.java
ParserUtils.getBytes
public static byte[] getBytes(long val, long size) { byte[] res = new byte[(int) size]; long bv = val; for (int i = (int) size - 1; i >= 0; --i) { res[i] = (byte) (bv & 0xFF); bv >>= BIT_IN_BYTE; } return res; }
java
public static byte[] getBytes(long val, long size) { byte[] res = new byte[(int) size]; long bv = val; for (int i = (int) size - 1; i >= 0; --i) { res[i] = (byte) (bv & 0xFF); bv >>= BIT_IN_BYTE; } return res; }
[ "public", "static", "byte", "[", "]", "getBytes", "(", "long", "val", ",", "long", "size", ")", "{", "byte", "[", "]", "res", "=", "new", "byte", "[", "(", "int", ")", "size", "]", ";", "long", "bv", "=", "val", ";", "for", "(", "int", "i", "...
method to encode long as byte array of given size @param val - value to encode @param size - size @return - byte array
[ "method", "to", "encode", "long", "as", "byte", "array", "of", "given", "size" ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/matroska/ParserUtils.java#L242-L250
train
Red5/red5-io
src/main/java/org/red5/io/matroska/ParserUtils.java
ParserUtils.skip
public static void skip(long size, InputStream input) throws IOException { while (size > 0) { size -= input.skip(size); } }
java
public static void skip(long size, InputStream input) throws IOException { while (size > 0) { size -= input.skip(size); } }
[ "public", "static", "void", "skip", "(", "long", "size", ",", "InputStream", "input", ")", "throws", "IOException", "{", "while", "(", "size", ">", "0", ")", "{", "size", "-=", "input", ".", "skip", "(", "size", ")", ";", "}", "}" ]
method to skip given amount of bytes in stream @param size - size to skip @param input - input stream to process @throws IOException - in case of IO error
[ "method", "to", "skip", "given", "amount", "of", "bytes", "in", "stream" ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/matroska/ParserUtils.java#L262-L266
train
Red5/red5-io
src/main/java/org/red5/io/utils/BufferUtils.java
BufferUtils.writeMediumInt
public static void writeMediumInt(IoBuffer out, int value) { byte[] bytes = new byte[3]; bytes[0] = (byte) ((value >>> 16) & 0x000000FF); bytes[1] = (byte) ((value >>> 8) & 0x000000FF); bytes[2] = (byte) (value & 0x00FF); out.put(bytes); }
java
public static void writeMediumInt(IoBuffer out, int value) { byte[] bytes = new byte[3]; bytes[0] = (byte) ((value >>> 16) & 0x000000FF); bytes[1] = (byte) ((value >>> 8) & 0x000000FF); bytes[2] = (byte) (value & 0x00FF); out.put(bytes); }
[ "public", "static", "void", "writeMediumInt", "(", "IoBuffer", "out", ",", "int", "value", ")", "{", "byte", "[", "]", "bytes", "=", "new", "byte", "[", "3", "]", ";", "bytes", "[", "0", "]", "=", "(", "byte", ")", "(", "(", "value", ">>>", "16",...
Writes a Medium Int to the output buffer @param out Container to write to @param value Integer to write
[ "Writes", "a", "Medium", "Int", "to", "the", "output", "buffer" ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/utils/BufferUtils.java#L44-L50
train
Red5/red5-io
src/main/java/org/red5/io/utils/BufferUtils.java
BufferUtils.readUnsignedMediumInt
public static int readUnsignedMediumInt(IoBuffer in) { byte[] bytes = new byte[3]; in.get(bytes); int val = 0; val += (bytes[0] & 0xFF) * 256 * 256; val += (bytes[1] & 0xFF) * 256; val += (bytes[2] & 0xFF); return val; }
java
public static int readUnsignedMediumInt(IoBuffer in) { byte[] bytes = new byte[3]; in.get(bytes); int val = 0; val += (bytes[0] & 0xFF) * 256 * 256; val += (bytes[1] & 0xFF) * 256; val += (bytes[2] & 0xFF); return val; }
[ "public", "static", "int", "readUnsignedMediumInt", "(", "IoBuffer", "in", ")", "{", "byte", "[", "]", "bytes", "=", "new", "byte", "[", "3", "]", ";", "in", ".", "get", "(", "bytes", ")", ";", "int", "val", "=", "0", ";", "val", "+=", "(", "byte...
Reads an unsigned Medium Int from the in buffer @param in Source @return int Integer value
[ "Reads", "an", "unsigned", "Medium", "Int", "from", "the", "in", "buffer" ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/utils/BufferUtils.java#L59-L67
train
Red5/red5-io
src/main/java/org/red5/io/utils/BufferUtils.java
BufferUtils.readMediumInt
public static int readMediumInt(IoBuffer in) { byte[] bytes = new byte[3]; in.get(bytes); int val = 0; val += bytes[0] * 256 * 256; val += bytes[1] * 256; val += bytes[2]; if (val < 0) { val += 256; } return val; }
java
public static int readMediumInt(IoBuffer in) { byte[] bytes = new byte[3]; in.get(bytes); int val = 0; val += bytes[0] * 256 * 256; val += bytes[1] * 256; val += bytes[2]; if (val < 0) { val += 256; } return val; }
[ "public", "static", "int", "readMediumInt", "(", "IoBuffer", "in", ")", "{", "byte", "[", "]", "bytes", "=", "new", "byte", "[", "3", "]", ";", "in", ".", "get", "(", "bytes", ")", ";", "int", "val", "=", "0", ";", "val", "+=", "bytes", "[", "0...
Reads a Medium Int to the in buffer @param in Source @return int Medium int
[ "Reads", "a", "Medium", "Int", "to", "the", "in", "buffer" ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/utils/BufferUtils.java#L76-L87
train
Red5/red5-io
src/main/java/org/red5/io/utils/BufferUtils.java
BufferUtils.put
public final static int put(IoBuffer out, IoBuffer in, int numBytesMax) { if (log.isTraceEnabled()) { log.trace("Put\nin buffer: {}\nout buffer: {}\nmax bytes: {}", new Object[] { out, in, numBytesMax }); } int numBytesRead = 0; if (in != null) { int limit = Math....
java
public final static int put(IoBuffer out, IoBuffer in, int numBytesMax) { if (log.isTraceEnabled()) { log.trace("Put\nin buffer: {}\nout buffer: {}\nmax bytes: {}", new Object[] { out, in, numBytesMax }); } int numBytesRead = 0; if (in != null) { int limit = Math....
[ "public", "final", "static", "int", "put", "(", "IoBuffer", "out", ",", "IoBuffer", "in", ",", "int", "numBytesMax", ")", "{", "if", "(", "log", ".", "isTraceEnabled", "(", ")", ")", "{", "log", ".", "trace", "(", "\"Put\\nin buffer: {}\\nout buffer: {}\\nma...
Puts an input buffer in an output buffer and returns number of bytes written. @param out Output buffer @param in Input buffer @param numBytesMax Number of bytes max @return int Number of bytes written
[ "Puts", "an", "input", "buffer", "in", "an", "output", "buffer", "and", "returns", "number", "of", "bytes", "written", "." ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/utils/BufferUtils.java#L100-L117
train
Red5/red5-io
src/main/java/org/red5/io/utils/BufferUtils.java
BufferUtils.consumeBytes
public final static byte[] consumeBytes(byte[] in, int numBytesMax) { int limit = Math.min(in.length, numBytesMax); byte[] out = new byte[limit]; System.arraycopy(in, 0, out, 0, limit); return out; }
java
public final static byte[] consumeBytes(byte[] in, int numBytesMax) { int limit = Math.min(in.length, numBytesMax); byte[] out = new byte[limit]; System.arraycopy(in, 0, out, 0, limit); return out; }
[ "public", "final", "static", "byte", "[", "]", "consumeBytes", "(", "byte", "[", "]", "in", ",", "int", "numBytesMax", ")", "{", "int", "limit", "=", "Math", ".", "min", "(", "in", ".", "length", ",", "numBytesMax", ")", ";", "byte", "[", "]", "out...
Consumes bytes from an input buffer and returns them in an output buffer. @param in Input byte array @param numBytesMax Number of bytes max @return out Output byte array
[ "Consumes", "bytes", "from", "an", "input", "buffer", "and", "returns", "them", "in", "an", "output", "buffer", "." ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/utils/BufferUtils.java#L128-L133
train
Red5/red5-io
src/main/java/org/red5/io/amf3/ByteArray.java
ByteArray.prepareIO
protected void prepareIO() { // we assume that everything in ByteArray is in AMF3 Input input = new Input(data); input.enforceAMF3(); dataInput = new DataInput(input); Output output = new Output(data); output.enforceAMF3(); dataOutput = new DataOutput(outpu...
java
protected void prepareIO() { // we assume that everything in ByteArray is in AMF3 Input input = new Input(data); input.enforceAMF3(); dataInput = new DataInput(input); Output output = new Output(data); output.enforceAMF3(); dataOutput = new DataOutput(outpu...
[ "protected", "void", "prepareIO", "(", ")", "{", "// we assume that everything in ByteArray is in AMF3\r", "Input", "input", "=", "new", "Input", "(", "data", ")", ";", "input", ".", "enforceAMF3", "(", ")", ";", "dataInput", "=", "new", "DataInput", "(", "input...
Create internal objects used for reading and writing.
[ "Create", "internal", "objects", "used", "for", "reading", "and", "writing", "." ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/amf3/ByteArray.java#L76-L84
train
Red5/red5-io
src/main/java/org/red5/io/amf3/ByteArray.java
ByteArray.compress
public void compress() { IoBuffer tmp = IoBuffer.allocate(0); tmp.setAutoExpand(true); byte[] tmpData = new byte[data.limit()]; data.position(0); data.get(tmpData); try (DeflaterOutputStream deflater = new DeflaterOutputStream(tmp.asOutputStream(), new Deflater(Defl...
java
public void compress() { IoBuffer tmp = IoBuffer.allocate(0); tmp.setAutoExpand(true); byte[] tmpData = new byte[data.limit()]; data.position(0); data.get(tmpData); try (DeflaterOutputStream deflater = new DeflaterOutputStream(tmp.asOutputStream(), new Deflater(Defl...
[ "public", "void", "compress", "(", ")", "{", "IoBuffer", "tmp", "=", "IoBuffer", ".", "allocate", "(", "0", ")", ";", "tmp", ".", "setAutoExpand", "(", "true", ")", ";", "byte", "[", "]", "tmpData", "=", "new", "byte", "[", "data", ".", "limit", "(...
Compress contents using zlib.
[ "Compress", "contents", "using", "zlib", "." ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/amf3/ByteArray.java#L135-L153
train
Red5/red5-io
src/main/java/org/red5/io/amf3/ByteArray.java
ByteArray.uncompress
public void uncompress() { data.position(0); byte[] buffer = new byte[8192]; IoBuffer tmp = IoBuffer.allocate(0); tmp.setAutoExpand(true); try (InflaterInputStream inflater = new InflaterInputStream(data.asInputStream())) { while (inflater.available() > 0) { ...
java
public void uncompress() { data.position(0); byte[] buffer = new byte[8192]; IoBuffer tmp = IoBuffer.allocate(0); tmp.setAutoExpand(true); try (InflaterInputStream inflater = new InflaterInputStream(data.asInputStream())) { while (inflater.available() > 0) { ...
[ "public", "void", "uncompress", "(", ")", "{", "data", ".", "position", "(", "0", ")", ";", "byte", "[", "]", "buffer", "=", "new", "byte", "[", "8192", "]", ";", "IoBuffer", "tmp", "=", "IoBuffer", ".", "allocate", "(", "0", ")", ";", "tmp", "."...
Decompress contents using zlib.
[ "Decompress", "contents", "using", "zlib", "." ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/amf3/ByteArray.java#L158-L180
train
Red5/red5-io
src/main/java/org/red5/io/object/Deserializer.java
Deserializer.deserialize
@SuppressWarnings({ "unchecked", "rawtypes" }) public static <T> T deserialize(Input in, Type target) { if (BLACK_LIST == null) { //log.info("Black list is not yet initialized"); try { loadBlackList(); } catch (IOException e) { throw new Ru...
java
@SuppressWarnings({ "unchecked", "rawtypes" }) public static <T> T deserialize(Input in, Type target) { if (BLACK_LIST == null) { //log.info("Black list is not yet initialized"); try { loadBlackList(); } catch (IOException e) { throw new Ru...
[ "@", "SuppressWarnings", "(", "{", "\"unchecked\"", ",", "\"rawtypes\"", "}", ")", "public", "static", "<", "T", ">", "T", "deserialize", "(", "Input", "in", ",", "Type", "target", ")", "{", "if", "(", "BLACK_LIST", "==", "null", ")", "{", "//log.info(\"...
Deserializes the input parameter and returns an Object which must then be cast to a core data type @param <T> type @param in input @param target target @return Object object
[ "Deserializes", "the", "input", "parameter", "and", "returns", "an", "Object", "which", "must", "then", "be", "cast", "to", "a", "core", "data", "type" ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/object/Deserializer.java#L71-L154
train
Red5/red5-io
src/main/java/org/red5/io/object/Deserializer.java
Deserializer.classAllowed
public static boolean classAllowed(String className) { for (String name: BLACK_LIST) { if (className.startsWith(name)) { return false; } } return true; }
java
public static boolean classAllowed(String className) { for (String name: BLACK_LIST) { if (className.startsWith(name)) { return false; } } return true; }
[ "public", "static", "boolean", "classAllowed", "(", "String", "className", ")", "{", "for", "(", "String", "name", ":", "BLACK_LIST", ")", "{", "if", "(", "className", ".", "startsWith", "(", "name", ")", ")", "{", "return", "false", ";", "}", "}", "re...
Checks to see if a given class is blacklisted or not. @param className class name/package @return true if not blacklisted and false if it is blacklisted
[ "Checks", "to", "see", "if", "a", "given", "class", "is", "blacklisted", "or", "not", "." ]
9bbbc506423c5a8f18169d46d400df56c0072a33
https://github.com/Red5/red5-io/blob/9bbbc506423c5a8f18169d46d400df56c0072a33/src/main/java/org/red5/io/object/Deserializer.java#L162-L169
train