id
int32
0
165k
repo
stringlengths
7
58
path
stringlengths
12
218
func_name
stringlengths
3
140
original_string
stringlengths
73
34.1k
language
stringclasses
1 value
code
stringlengths
73
34.1k
code_tokens
list
docstring
stringlengths
3
16k
docstring_tokens
list
sha
stringlengths
40
40
url
stringlengths
105
339
122,800
netty/netty
handler/src/main/java/io/netty/handler/ssl/CipherSuiteConverter.java
CipherSuiteConverter.toOpenSsl
static String toOpenSsl(String javaCipherSuite, boolean boringSSL) { String converted = j2o.get(javaCipherSuite); if (converted != null) { return converted; } return cacheFromJava(javaCipherSuite, boringSSL); }
java
static String toOpenSsl(String javaCipherSuite, boolean boringSSL) { String converted = j2o.get(javaCipherSuite); if (converted != null) { return converted; } return cacheFromJava(javaCipherSuite, boringSSL); }
[ "static", "String", "toOpenSsl", "(", "String", "javaCipherSuite", ",", "boolean", "boringSSL", ")", "{", "String", "converted", "=", "j2o", ".", "get", "(", "javaCipherSuite", ")", ";", "if", "(", "converted", "!=", "null", ")", "{", "return", "converted", ...
Converts the specified Java cipher suite to its corresponding OpenSSL cipher suite name. @return {@code null} if the conversion has failed
[ "Converts", "the", "specified", "Java", "cipher", "suite", "to", "its", "corresponding", "OpenSSL", "cipher", "suite", "name", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/CipherSuiteConverter.java#L153-L159
122,801
netty/netty
handler/src/main/java/io/netty/handler/ssl/CipherSuiteConverter.java
CipherSuiteConverter.toJava
static String toJava(String openSslCipherSuite, String protocol) { Map<String, String> p2j = o2j.get(openSslCipherSuite); if (p2j == null) { p2j = cacheFromOpenSsl(openSslCipherSuite); // This may happen if this method is queried when OpenSSL doesn't yet have a cipher setup. It w...
java
static String toJava(String openSslCipherSuite, String protocol) { Map<String, String> p2j = o2j.get(openSslCipherSuite); if (p2j == null) { p2j = cacheFromOpenSsl(openSslCipherSuite); // This may happen if this method is queried when OpenSSL doesn't yet have a cipher setup. It w...
[ "static", "String", "toJava", "(", "String", "openSslCipherSuite", ",", "String", "protocol", ")", "{", "Map", "<", "String", ",", "String", ">", "p2j", "=", "o2j", ".", "get", "(", "openSslCipherSuite", ")", ";", "if", "(", "p2j", "==", "null", ")", "...
Convert from OpenSSL cipher suite name convention to java cipher suite name convention. @param openSslCipherSuite An OpenSSL cipher suite name. @param protocol The cryptographic protocol (i.e. SSL, TLS, ...). @return The translated cipher suite name according to java conventions. This will not be {@code null}.
[ "Convert", "from", "OpenSSL", "cipher", "suite", "name", "convention", "to", "java", "cipher", "suite", "name", "convention", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/CipherSuiteConverter.java#L282-L303
122,802
netty/netty
common/src/main/java/io/netty/util/concurrent/SingleThreadEventExecutor.java
SingleThreadEventExecutor.delayNanos
protected long delayNanos(long currentTimeNanos) { ScheduledFutureTask<?> scheduledTask = peekScheduledTask(); if (scheduledTask == null) { return SCHEDULE_PURGE_INTERVAL; } return scheduledTask.delayNanos(currentTimeNanos); }
java
protected long delayNanos(long currentTimeNanos) { ScheduledFutureTask<?> scheduledTask = peekScheduledTask(); if (scheduledTask == null) { return SCHEDULE_PURGE_INTERVAL; } return scheduledTask.delayNanos(currentTimeNanos); }
[ "protected", "long", "delayNanos", "(", "long", "currentTimeNanos", ")", "{", "ScheduledFutureTask", "<", "?", ">", "scheduledTask", "=", "peekScheduledTask", "(", ")", ";", "if", "(", "scheduledTask", "==", "null", ")", "{", "return", "SCHEDULE_PURGE_INTERVAL", ...
Returns the amount of time left until the scheduled task with the closest dead line is executed.
[ "Returns", "the", "amount", "of", "time", "left", "until", "the", "scheduled", "task", "with", "the", "closest", "dead", "line", "is", "executed", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/concurrent/SingleThreadEventExecutor.java#L438-L445
122,803
netty/netty
common/src/main/java/io/netty/util/concurrent/SingleThreadEventExecutor.java
SingleThreadEventExecutor.confirmShutdown
protected boolean confirmShutdown() { if (!isShuttingDown()) { return false; } if (!inEventLoop()) { throw new IllegalStateException("must be invoked from an event loop"); } cancelScheduledTasks(); if (gracefulShutdownStartTime == 0) { ...
java
protected boolean confirmShutdown() { if (!isShuttingDown()) { return false; } if (!inEventLoop()) { throw new IllegalStateException("must be invoked from an event loop"); } cancelScheduledTasks(); if (gracefulShutdownStartTime == 0) { ...
[ "protected", "boolean", "confirmShutdown", "(", ")", "{", "if", "(", "!", "isShuttingDown", "(", ")", ")", "{", "return", "false", ";", "}", "if", "(", "!", "inEventLoop", "(", ")", ")", "{", "throw", "new", "IllegalStateException", "(", "\"must be invoked...
Confirm that the shutdown if the instance should be done now!
[ "Confirm", "that", "the", "shutdown", "if", "the", "instance", "should", "be", "done", "now!" ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/concurrent/SingleThreadEventExecutor.java#L678-L731
122,804
netty/netty
codec-http2/src/main/java/io/netty/handler/codec/http2/HpackEncoder.java
HpackEncoder.setMaxHeaderTableSize
public void setMaxHeaderTableSize(ByteBuf out, long maxHeaderTableSize) throws Http2Exception { if (maxHeaderTableSize < MIN_HEADER_TABLE_SIZE || maxHeaderTableSize > MAX_HEADER_TABLE_SIZE) { throw connectionError(PROTOCOL_ERROR, "Header Table Size must be >= %d and <= %d but was %d", ...
java
public void setMaxHeaderTableSize(ByteBuf out, long maxHeaderTableSize) throws Http2Exception { if (maxHeaderTableSize < MIN_HEADER_TABLE_SIZE || maxHeaderTableSize > MAX_HEADER_TABLE_SIZE) { throw connectionError(PROTOCOL_ERROR, "Header Table Size must be >= %d and <= %d but was %d", ...
[ "public", "void", "setMaxHeaderTableSize", "(", "ByteBuf", "out", ",", "long", "maxHeaderTableSize", ")", "throws", "Http2Exception", "{", "if", "(", "maxHeaderTableSize", "<", "MIN_HEADER_TABLE_SIZE", "||", "maxHeaderTableSize", ">", "MAX_HEADER_TABLE_SIZE", ")", "{", ...
Set the maximum table size.
[ "Set", "the", "maximum", "table", "size", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/HpackEncoder.java#L191-L203
122,805
netty/netty
codec-http2/src/main/java/io/netty/handler/codec/http2/HpackEncoder.java
HpackEncoder.encodeStringLiteral
private void encodeStringLiteral(ByteBuf out, CharSequence string) { int huffmanLength = hpackHuffmanEncoder.getEncodedLength(string); if (huffmanLength < string.length()) { encodeInteger(out, 0x80, 7, huffmanLength); hpackHuffmanEncoder.encode(out, string); } else { ...
java
private void encodeStringLiteral(ByteBuf out, CharSequence string) { int huffmanLength = hpackHuffmanEncoder.getEncodedLength(string); if (huffmanLength < string.length()) { encodeInteger(out, 0x80, 7, huffmanLength); hpackHuffmanEncoder.encode(out, string); } else { ...
[ "private", "void", "encodeStringLiteral", "(", "ByteBuf", "out", ",", "CharSequence", "string", ")", "{", "int", "huffmanLength", "=", "hpackHuffmanEncoder", ".", "getEncodedLength", "(", "string", ")", ";", "if", "(", "huffmanLength", "<", "string", ".", "lengt...
Encode string literal according to Section 5.2.
[ "Encode", "string", "literal", "according", "to", "Section", "5", ".", "2", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/HpackEncoder.java#L252-L269
122,806
netty/netty
codec-http2/src/main/java/io/netty/handler/codec/http2/HpackEncoder.java
HpackEncoder.encodeLiteral
private void encodeLiteral(ByteBuf out, CharSequence name, CharSequence value, IndexType indexType, int nameIndex) { boolean nameIndexValid = nameIndex != -1; switch (indexType) { case INCREMENTAL: encodeInteger(out, 0x40, 6, nameIndexValid ? na...
java
private void encodeLiteral(ByteBuf out, CharSequence name, CharSequence value, IndexType indexType, int nameIndex) { boolean nameIndexValid = nameIndex != -1; switch (indexType) { case INCREMENTAL: encodeInteger(out, 0x40, 6, nameIndexValid ? na...
[ "private", "void", "encodeLiteral", "(", "ByteBuf", "out", ",", "CharSequence", "name", ",", "CharSequence", "value", ",", "IndexType", "indexType", ",", "int", "nameIndex", ")", "{", "boolean", "nameIndexValid", "=", "nameIndex", "!=", "-", "1", ";", "switch"...
Encode literal header field according to Section 6.2.
[ "Encode", "literal", "header", "field", "according", "to", "Section", "6", ".", "2", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/HpackEncoder.java#L274-L294
122,807
netty/netty
codec-http2/src/main/java/io/netty/handler/codec/http2/HpackEncoder.java
HpackEncoder.getHeaderField
HpackHeaderField getHeaderField(int index) { HeaderEntry entry = head; while (index-- >= 0) { entry = entry.before; } return entry; }
java
HpackHeaderField getHeaderField(int index) { HeaderEntry entry = head; while (index-- >= 0) { entry = entry.before; } return entry; }
[ "HpackHeaderField", "getHeaderField", "(", "int", "index", ")", "{", "HeaderEntry", "entry", "=", "head", ";", "while", "(", "index", "--", ">=", "0", ")", "{", "entry", "=", "entry", ".", "before", ";", "}", "return", "entry", ";", "}" ]
Return the header field at the given index. Exposed for testing.
[ "Return", "the", "header", "field", "at", "the", "given", "index", ".", "Exposed", "for", "testing", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/HpackEncoder.java#L338-L344
122,808
netty/netty
codec-http2/src/main/java/io/netty/handler/codec/http2/HpackEncoder.java
HpackEncoder.getEntry
private HeaderEntry getEntry(CharSequence name, CharSequence value) { if (length() == 0 || name == null || value == null) { return null; } int h = AsciiString.hashCode(name); int i = index(h); for (HeaderEntry e = headerFields[i]; e != null; e = e.next) { ...
java
private HeaderEntry getEntry(CharSequence name, CharSequence value) { if (length() == 0 || name == null || value == null) { return null; } int h = AsciiString.hashCode(name); int i = index(h); for (HeaderEntry e = headerFields[i]; e != null; e = e.next) { ...
[ "private", "HeaderEntry", "getEntry", "(", "CharSequence", "name", ",", "CharSequence", "value", ")", "{", "if", "(", "length", "(", ")", "==", "0", "||", "name", "==", "null", "||", "value", "==", "null", ")", "{", "return", "null", ";", "}", "int", ...
Returns the header entry with the lowest index value for the header field. Returns null if header field is not in the dynamic table.
[ "Returns", "the", "header", "entry", "with", "the", "lowest", "index", "value", "for", "the", "header", "field", ".", "Returns", "null", "if", "header", "field", "is", "not", "in", "the", "dynamic", "table", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/HpackEncoder.java#L350-L363
122,809
netty/netty
codec-http2/src/main/java/io/netty/handler/codec/http2/HpackEncoder.java
HpackEncoder.getIndex
private int getIndex(CharSequence name) { if (length() == 0 || name == null) { return -1; } int h = AsciiString.hashCode(name); int i = index(h); for (HeaderEntry e = headerFields[i]; e != null; e = e.next) { if (e.hash == h && equalsConstantTime(name, e.n...
java
private int getIndex(CharSequence name) { if (length() == 0 || name == null) { return -1; } int h = AsciiString.hashCode(name); int i = index(h); for (HeaderEntry e = headerFields[i]; e != null; e = e.next) { if (e.hash == h && equalsConstantTime(name, e.n...
[ "private", "int", "getIndex", "(", "CharSequence", "name", ")", "{", "if", "(", "length", "(", ")", "==", "0", "||", "name", "==", "null", ")", "{", "return", "-", "1", ";", "}", "int", "h", "=", "AsciiString", ".", "hashCode", "(", "name", ")", ...
Returns the lowest index value for the header field name in the dynamic table. Returns -1 if the header field name is not in the dynamic table.
[ "Returns", "the", "lowest", "index", "value", "for", "the", "header", "field", "name", "in", "the", "dynamic", "table", ".", "Returns", "-", "1", "if", "the", "header", "field", "name", "is", "not", "in", "the", "dynamic", "table", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/HpackEncoder.java#L369-L381
122,810
netty/netty
codec-http2/src/main/java/io/netty/handler/codec/http2/HpackEncoder.java
HpackEncoder.add
private void add(CharSequence name, CharSequence value, long headerSize) { // Clear the table if the header field size is larger than the maxHeaderTableSize. if (headerSize > maxHeaderTableSize) { clear(); return; } // Evict oldest entries until we have enough ma...
java
private void add(CharSequence name, CharSequence value, long headerSize) { // Clear the table if the header field size is larger than the maxHeaderTableSize. if (headerSize > maxHeaderTableSize) { clear(); return; } // Evict oldest entries until we have enough ma...
[ "private", "void", "add", "(", "CharSequence", "name", ",", "CharSequence", "value", ",", "long", "headerSize", ")", "{", "// Clear the table if the header field size is larger than the maxHeaderTableSize.", "if", "(", "headerSize", ">", "maxHeaderTableSize", ")", "{", "c...
Add the header field to the dynamic table. Entries are evicted from the dynamic table until the size of the table and the new header field is less than the table's maxHeaderTableSize. If the size of the new entry is larger than the table's maxHeaderTableSize, the dynamic table will be cleared.
[ "Add", "the", "header", "field", "to", "the", "dynamic", "table", ".", "Entries", "are", "evicted", "from", "the", "dynamic", "table", "until", "the", "size", "of", "the", "table", "and", "the", "new", "header", "field", "is", "less", "than", "the", "tab...
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/HpackEncoder.java#L395-L414
122,811
netty/netty
codec-http/src/main/java/io/netty/handler/codec/http/cookie/ServerCookieEncoder.java
ServerCookieEncoder.dedup
private static List<String> dedup(List<String> encoded, Map<String, Integer> nameToLastIndex) { boolean[] isLastInstance = new boolean[encoded.size()]; for (int idx : nameToLastIndex.values()) { isLastInstance[idx] = true; } List<String> dedupd = new ArrayList<String>(nameToL...
java
private static List<String> dedup(List<String> encoded, Map<String, Integer> nameToLastIndex) { boolean[] isLastInstance = new boolean[encoded.size()]; for (int idx : nameToLastIndex.values()) { isLastInstance[idx] = true; } List<String> dedupd = new ArrayList<String>(nameToL...
[ "private", "static", "List", "<", "String", ">", "dedup", "(", "List", "<", "String", ">", "encoded", ",", "Map", "<", "String", ",", "Integer", ">", "nameToLastIndex", ")", "{", "boolean", "[", "]", "isLastInstance", "=", "new", "boolean", "[", "encoded...
Deduplicate a list of encoded cookies by keeping only the last instance with a given name. @param encoded The list of encoded cookies. @param nameToLastIndex A map from cookie name to index of last cookie instance. @return The encoded list with all but the last instance of a named cookie.
[ "Deduplicate", "a", "list", "of", "encoded", "cookies", "by", "keeping", "only", "the", "last", "instance", "with", "a", "given", "name", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/cookie/ServerCookieEncoder.java#L137-L149
122,812
netty/netty
common/src/main/java/io/netty/util/internal/logging/Log4JLogger.java
Log4JLogger.trace
@Override public void trace(String format, Object arg) { if (isTraceEnabled()) { FormattingTuple ft = MessageFormatter.format(format, arg); logger.log(FQCN, traceCapable ? Level.TRACE : Level.DEBUG, ft .getMessage(), ft.getThrowable()); } }
java
@Override public void trace(String format, Object arg) { if (isTraceEnabled()) { FormattingTuple ft = MessageFormatter.format(format, arg); logger.log(FQCN, traceCapable ? Level.TRACE : Level.DEBUG, ft .getMessage(), ft.getThrowable()); } }
[ "@", "Override", "public", "void", "trace", "(", "String", "format", ",", "Object", "arg", ")", "{", "if", "(", "isTraceEnabled", "(", ")", ")", "{", "FormattingTuple", "ft", "=", "MessageFormatter", ".", "format", "(", "format", ",", "arg", ")", ";", ...
Log a message at level TRACE according to the specified format and argument. <p> This form avoids superfluous object creation when the logger is disabled for level TRACE. </p> @param format the format string @param arg the argument
[ "Log", "a", "message", "at", "level", "TRACE", "according", "to", "the", "specified", "format", "and", "argument", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/internal/logging/Log4JLogger.java#L119-L126
122,813
netty/netty
common/src/main/java/io/netty/util/internal/logging/Log4JLogger.java
Log4JLogger.warn
@Override public void warn(String msg) { logger.log(FQCN, Level.WARN, msg, null); }
java
@Override public void warn(String msg) { logger.log(FQCN, Level.WARN, msg, null); }
[ "@", "Override", "public", "void", "warn", "(", "String", "msg", ")", "{", "logger", ".", "log", "(", "FQCN", ",", "Level", ".", "WARN", ",", "msg", ",", "null", ")", ";", "}" ]
Log a message object at the WARN level. @param msg - the message object to be logged
[ "Log", "a", "message", "object", "at", "the", "WARN", "level", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/internal/logging/Log4JLogger.java#L408-L411
122,814
netty/netty
handler/src/main/java/io/netty/handler/ssl/SslContextBuilder.java
SslContextBuilder.protocols
public SslContextBuilder protocols(String... protocols) { this.protocols = protocols == null ? null : protocols.clone(); return this; }
java
public SslContextBuilder protocols(String... protocols) { this.protocols = protocols == null ? null : protocols.clone(); return this; }
[ "public", "SslContextBuilder", "protocols", "(", "String", "...", "protocols", ")", "{", "this", ".", "protocols", "=", "protocols", "==", "null", "?", "null", ":", "protocols", ".", "clone", "(", ")", ";", "return", "this", ";", "}" ]
The TLS protocol versions to enable. @param protocols The protocols to enable, or {@code null} to enable the default protocols. @see SSLEngine#setEnabledCipherSuites(String[])
[ "The", "TLS", "protocol", "versions", "to", "enable", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/SslContextBuilder.java#L415-L418
122,815
netty/netty
codec-http2/src/main/java/io/netty/handler/codec/http2/HpackDynamicTable.java
HpackDynamicTable.length
public int length() { int length; if (head < tail) { length = hpackHeaderFields.length - tail + head; } else { length = head - tail; } return length; }
java
public int length() { int length; if (head < tail) { length = hpackHeaderFields.length - tail + head; } else { length = head - tail; } return length; }
[ "public", "int", "length", "(", ")", "{", "int", "length", ";", "if", "(", "head", "<", "tail", ")", "{", "length", "=", "hpackHeaderFields", ".", "length", "-", "tail", "+", "head", ";", "}", "else", "{", "length", "=", "head", "-", "tail", ";", ...
Return the number of header fields in the dynamic table.
[ "Return", "the", "number", "of", "header", "fields", "in", "the", "dynamic", "table", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/HpackDynamicTable.java#L56-L64
122,816
netty/netty
codec-http2/src/main/java/io/netty/handler/codec/http2/HpackDynamicTable.java
HpackDynamicTable.add
public void add(HpackHeaderField header) { int headerSize = header.size(); if (headerSize > capacity) { clear(); return; } while (capacity - size < headerSize) { remove(); } hpackHeaderFields[head++] = header; size += header.siz...
java
public void add(HpackHeaderField header) { int headerSize = header.size(); if (headerSize > capacity) { clear(); return; } while (capacity - size < headerSize) { remove(); } hpackHeaderFields[head++] = header; size += header.siz...
[ "public", "void", "add", "(", "HpackHeaderField", "header", ")", "{", "int", "headerSize", "=", "header", ".", "size", "(", ")", ";", "if", "(", "headerSize", ">", "capacity", ")", "{", "clear", "(", ")", ";", "return", ";", "}", "while", "(", "capac...
Add the header field to the dynamic table. Entries are evicted from the dynamic table until the size of the table and the new header field is less than or equal to the table's capacity. If the size of the new entry is larger than the table's capacity, the dynamic table will be cleared.
[ "Add", "the", "header", "field", "to", "the", "dynamic", "table", ".", "Entries", "are", "evicted", "from", "the", "dynamic", "table", "until", "the", "size", "of", "the", "table", "and", "the", "new", "header", "field", "is", "less", "than", "or", "equa...
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/HpackDynamicTable.java#L102-L116
122,817
netty/netty
codec-http2/src/main/java/io/netty/handler/codec/http2/HpackDynamicTable.java
HpackDynamicTable.remove
public HpackHeaderField remove() { HpackHeaderField removed = hpackHeaderFields[tail]; if (removed == null) { return null; } size -= removed.size(); hpackHeaderFields[tail++] = null; if (tail == hpackHeaderFields.length) { tail = 0; } ...
java
public HpackHeaderField remove() { HpackHeaderField removed = hpackHeaderFields[tail]; if (removed == null) { return null; } size -= removed.size(); hpackHeaderFields[tail++] = null; if (tail == hpackHeaderFields.length) { tail = 0; } ...
[ "public", "HpackHeaderField", "remove", "(", ")", "{", "HpackHeaderField", "removed", "=", "hpackHeaderFields", "[", "tail", "]", ";", "if", "(", "removed", "==", "null", ")", "{", "return", "null", ";", "}", "size", "-=", "removed", ".", "size", "(", ")...
Remove and return the oldest header field from the dynamic table.
[ "Remove", "and", "return", "the", "oldest", "header", "field", "from", "the", "dynamic", "table", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/HpackDynamicTable.java#L121-L132
122,818
netty/netty
codec-http2/src/main/java/io/netty/handler/codec/http2/HpackDynamicTable.java
HpackDynamicTable.clear
public void clear() { while (tail != head) { hpackHeaderFields[tail++] = null; if (tail == hpackHeaderFields.length) { tail = 0; } } head = 0; tail = 0; size = 0; }
java
public void clear() { while (tail != head) { hpackHeaderFields[tail++] = null; if (tail == hpackHeaderFields.length) { tail = 0; } } head = 0; tail = 0; size = 0; }
[ "public", "void", "clear", "(", ")", "{", "while", "(", "tail", "!=", "head", ")", "{", "hpackHeaderFields", "[", "tail", "++", "]", "=", "null", ";", "if", "(", "tail", "==", "hpackHeaderFields", ".", "length", ")", "{", "tail", "=", "0", ";", "}"...
Remove all entries from the dynamic table.
[ "Remove", "all", "entries", "from", "the", "dynamic", "table", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/HpackDynamicTable.java#L137-L147
122,819
netty/netty
codec-http2/src/main/java/io/netty/handler/codec/http2/HpackDynamicTable.java
HpackDynamicTable.setCapacity
public void setCapacity(long capacity) { if (capacity < MIN_HEADER_TABLE_SIZE || capacity > MAX_HEADER_TABLE_SIZE) { throw new IllegalArgumentException("capacity is invalid: " + capacity); } // initially capacity will be -1 so init won't return here if (this.capacity == capac...
java
public void setCapacity(long capacity) { if (capacity < MIN_HEADER_TABLE_SIZE || capacity > MAX_HEADER_TABLE_SIZE) { throw new IllegalArgumentException("capacity is invalid: " + capacity); } // initially capacity will be -1 so init won't return here if (this.capacity == capac...
[ "public", "void", "setCapacity", "(", "long", "capacity", ")", "{", "if", "(", "capacity", "<", "MIN_HEADER_TABLE_SIZE", "||", "capacity", ">", "MAX_HEADER_TABLE_SIZE", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"capacity is invalid: \"", "+", "cap...
Set the maximum size of the dynamic table. Entries are evicted from the dynamic table until the size of the table is less than or equal to the maximum size.
[ "Set", "the", "maximum", "size", "of", "the", "dynamic", "table", ".", "Entries", "are", "evicted", "from", "the", "dynamic", "table", "until", "the", "size", "of", "the", "table", "is", "less", "than", "or", "equal", "to", "the", "maximum", "size", "." ...
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/HpackDynamicTable.java#L153-L198
122,820
netty/netty
codec-http/src/main/java/io/netty/handler/codec/http/HttpClientUpgradeHandler.java
HttpClientUpgradeHandler.setUpgradeRequestHeaders
private void setUpgradeRequestHeaders(ChannelHandlerContext ctx, HttpRequest request) { // Set the UPGRADE header on the request. request.headers().set(HttpHeaderNames.UPGRADE, upgradeCodec.protocol()); // Add all protocol-specific headers to the request. Set<CharSequence> connectionPar...
java
private void setUpgradeRequestHeaders(ChannelHandlerContext ctx, HttpRequest request) { // Set the UPGRADE header on the request. request.headers().set(HttpHeaderNames.UPGRADE, upgradeCodec.protocol()); // Add all protocol-specific headers to the request. Set<CharSequence> connectionPar...
[ "private", "void", "setUpgradeRequestHeaders", "(", "ChannelHandlerContext", "ctx", ",", "HttpRequest", "request", ")", "{", "// Set the UPGRADE header on the request.", "request", ".", "headers", "(", ")", ".", "set", "(", "HttpHeaderNames", ".", "UPGRADE", ",", "upg...
Adds all upgrade request headers necessary for an upgrade to the supported protocols.
[ "Adds", "all", "upgrade", "request", "headers", "necessary", "for", "an", "upgrade", "to", "the", "supported", "protocols", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/HttpClientUpgradeHandler.java#L265-L281
122,821
netty/netty
example/src/main/java/io/netty/example/http/file/HttpStaticFileServerHandler.java
HttpStaticFileServerHandler.sendNotModified
private void sendNotModified(ChannelHandlerContext ctx) { FullHttpResponse response = new DefaultFullHttpResponse(HTTP_1_1, NOT_MODIFIED); setDateHeader(response); this.sendAndCleanupConnection(ctx, response); }
java
private void sendNotModified(ChannelHandlerContext ctx) { FullHttpResponse response = new DefaultFullHttpResponse(HTTP_1_1, NOT_MODIFIED); setDateHeader(response); this.sendAndCleanupConnection(ctx, response); }
[ "private", "void", "sendNotModified", "(", "ChannelHandlerContext", "ctx", ")", "{", "FullHttpResponse", "response", "=", "new", "DefaultFullHttpResponse", "(", "HTTP_1_1", ",", "NOT_MODIFIED", ")", ";", "setDateHeader", "(", "response", ")", ";", "this", ".", "se...
When file timestamp is the same as what the browser is sending up, send a "304 Not Modified" @param ctx Context
[ "When", "file", "timestamp", "is", "the", "same", "as", "what", "the", "browser", "is", "sending", "up", "send", "a", "304", "Not", "Modified" ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/example/src/main/java/io/netty/example/http/file/HttpStaticFileServerHandler.java#L338-L343
122,822
netty/netty
codec-http2/src/main/java/io/netty/handler/codec/http2/CompressorHttp2ConnectionEncoder.java
CompressorHttp2ConnectionEncoder.bindCompressorToStream
private void bindCompressorToStream(EmbeddedChannel compressor, int streamId) { if (compressor != null) { Http2Stream stream = connection().stream(streamId); if (stream != null) { stream.setProperty(propertyKey, compressor); } } }
java
private void bindCompressorToStream(EmbeddedChannel compressor, int streamId) { if (compressor != null) { Http2Stream stream = connection().stream(streamId); if (stream != null) { stream.setProperty(propertyKey, compressor); } } }
[ "private", "void", "bindCompressorToStream", "(", "EmbeddedChannel", "compressor", ",", "int", "streamId", ")", "{", "if", "(", "compressor", "!=", "null", ")", "{", "Http2Stream", "stream", "=", "connection", "(", ")", ".", "stream", "(", "streamId", ")", "...
Called after the super class has written the headers and created any associated stream objects. @param compressor The compressor associated with the stream identified by {@code streamId}. @param streamId The stream id for which the headers were written.
[ "Called", "after", "the", "super", "class", "has", "written", "the", "headers", "and", "created", "any", "associated", "stream", "objects", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/CompressorHttp2ConnectionEncoder.java#L271-L278
122,823
netty/netty
codec/src/main/java/io/netty/handler/codec/protobuf/ProtobufVarint32LengthFieldPrepender.java
ProtobufVarint32LengthFieldPrepender.writeRawVarint32
static void writeRawVarint32(ByteBuf out, int value) { while (true) { if ((value & ~0x7F) == 0) { out.writeByte(value); return; } else { out.writeByte((value & 0x7F) | 0x80); value >>>= 7; } } }
java
static void writeRawVarint32(ByteBuf out, int value) { while (true) { if ((value & ~0x7F) == 0) { out.writeByte(value); return; } else { out.writeByte((value & 0x7F) | 0x80); value >>>= 7; } } }
[ "static", "void", "writeRawVarint32", "(", "ByteBuf", "out", ",", "int", "value", ")", "{", "while", "(", "true", ")", "{", "if", "(", "(", "value", "&", "~", "0x7F", ")", "==", "0", ")", "{", "out", ".", "writeByte", "(", "value", ")", ";", "ret...
Writes protobuf varint32 to (@link ByteBuf). @param out to be written to @param value to be written
[ "Writes", "protobuf", "varint32", "to", "(" ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec/src/main/java/io/netty/handler/codec/protobuf/ProtobufVarint32LengthFieldPrepender.java#L58-L68
122,824
netty/netty
codec-mqtt/src/main/java/io/netty/handler/codec/mqtt/MqttDecoder.java
MqttDecoder.decodeFixedHeader
private static MqttFixedHeader decodeFixedHeader(ByteBuf buffer) { short b1 = buffer.readUnsignedByte(); MqttMessageType messageType = MqttMessageType.valueOf(b1 >> 4); boolean dupFlag = (b1 & 0x08) == 0x08; int qosLevel = (b1 & 0x06) >> 1; boolean retain = (b1 & 0x01) != 0; ...
java
private static MqttFixedHeader decodeFixedHeader(ByteBuf buffer) { short b1 = buffer.readUnsignedByte(); MqttMessageType messageType = MqttMessageType.valueOf(b1 >> 4); boolean dupFlag = (b1 & 0x08) == 0x08; int qosLevel = (b1 & 0x06) >> 1; boolean retain = (b1 & 0x01) != 0; ...
[ "private", "static", "MqttFixedHeader", "decodeFixedHeader", "(", "ByteBuf", "buffer", ")", "{", "short", "b1", "=", "buffer", ".", "readUnsignedByte", "(", ")", ";", "MqttMessageType", "messageType", "=", "MqttMessageType", ".", "valueOf", "(", "b1", ">>", "4",...
Decodes the fixed header. It's one byte for the flags and then variable bytes for the remaining length. @param buffer the buffer to decode from @return the fixed header
[ "Decodes", "the", "fixed", "header", ".", "It", "s", "one", "byte", "for", "the", "flags", "and", "then", "variable", "bytes", "for", "the", "remaining", "length", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-mqtt/src/main/java/io/netty/handler/codec/mqtt/MqttDecoder.java#L145-L171
122,825
netty/netty
codec-mqtt/src/main/java/io/netty/handler/codec/mqtt/MqttDecoder.java
MqttDecoder.decodePayload
private static Result<?> decodePayload( ByteBuf buffer, MqttMessageType messageType, int bytesRemainingInVariablePart, Object variableHeader) { switch (messageType) { case CONNECT: return decodeConnectionPayload(buffer, (MqttConnectVari...
java
private static Result<?> decodePayload( ByteBuf buffer, MqttMessageType messageType, int bytesRemainingInVariablePart, Object variableHeader) { switch (messageType) { case CONNECT: return decodeConnectionPayload(buffer, (MqttConnectVari...
[ "private", "static", "Result", "<", "?", ">", "decodePayload", "(", "ByteBuf", "buffer", ",", "MqttMessageType", "messageType", ",", "int", "bytesRemainingInVariablePart", ",", "Object", "variableHeader", ")", "{", "switch", "(", "messageType", ")", "{", "case", ...
Decodes the payload. @param buffer the buffer to decode from @param messageType type of the message being decoded @param bytesRemainingInVariablePart bytes remaining @param variableHeader variable header of the same message @return the payload
[ "Decodes", "the", "payload", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-mqtt/src/main/java/io/netty/handler/codec/mqtt/MqttDecoder.java#L306-L331
122,826
netty/netty
transport/src/main/java/io/netty/channel/AbstractCoalescingBufferQueue.java
AbstractCoalescingBufferQueue.add
public final void add(ByteBuf buf, ChannelFutureListener listener) { // buffers are added before promises so that we naturally 'consume' the entire buffer during removal // before we complete it's promise. bufAndListenerPairs.add(buf); if (listener != null) { bufAndListenerPa...
java
public final void add(ByteBuf buf, ChannelFutureListener listener) { // buffers are added before promises so that we naturally 'consume' the entire buffer during removal // before we complete it's promise. bufAndListenerPairs.add(buf); if (listener != null) { bufAndListenerPa...
[ "public", "final", "void", "add", "(", "ByteBuf", "buf", ",", "ChannelFutureListener", "listener", ")", "{", "// buffers are added before promises so that we naturally 'consume' the entire buffer during removal", "// before we complete it's promise.", "bufAndListenerPairs", ".", "add...
Add a buffer to the end of the queue and associate a listener with it that should be completed when all the buffers bytes have been consumed from the queue and written. @param buf to add to the tail of the queue @param listener to notify when all the bytes have been consumed and written, can be {@code null}.
[ "Add", "a", "buffer", "to", "the", "end", "of", "the", "queue", "and", "associate", "a", "listener", "with", "it", "that", "should", "be", "completed", "when", "all", "the", "buffers", "bytes", "have", "been", "consumed", "from", "the", "queue", "and", "...
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport/src/main/java/io/netty/channel/AbstractCoalescingBufferQueue.java#L93-L101
122,827
netty/netty
transport/src/main/java/io/netty/channel/AbstractCoalescingBufferQueue.java
AbstractCoalescingBufferQueue.copyTo
public final void copyTo(AbstractCoalescingBufferQueue dest) { dest.bufAndListenerPairs.addAll(bufAndListenerPairs); dest.incrementReadableBytes(readableBytes); }
java
public final void copyTo(AbstractCoalescingBufferQueue dest) { dest.bufAndListenerPairs.addAll(bufAndListenerPairs); dest.incrementReadableBytes(readableBytes); }
[ "public", "final", "void", "copyTo", "(", "AbstractCoalescingBufferQueue", "dest", ")", "{", "dest", ".", "bufAndListenerPairs", ".", "addAll", "(", "bufAndListenerPairs", ")", ";", "dest", ".", "incrementReadableBytes", "(", "readableBytes", ")", ";", "}" ]
Copy all pending entries in this queue into the destination queue. @param dest to copy pending buffers to.
[ "Copy", "all", "pending", "entries", "in", "this", "queue", "into", "the", "destination", "queue", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport/src/main/java/io/netty/channel/AbstractCoalescingBufferQueue.java#L214-L217
122,828
netty/netty
transport/src/main/java/io/netty/channel/AbstractCoalescingBufferQueue.java
AbstractCoalescingBufferQueue.writeAndRemoveAll
public final void writeAndRemoveAll(ChannelHandlerContext ctx) { decrementReadableBytes(readableBytes); Throwable pending = null; ByteBuf previousBuf = null; for (;;) { Object entry = bufAndListenerPairs.poll(); try { if (entry == null) { ...
java
public final void writeAndRemoveAll(ChannelHandlerContext ctx) { decrementReadableBytes(readableBytes); Throwable pending = null; ByteBuf previousBuf = null; for (;;) { Object entry = bufAndListenerPairs.poll(); try { if (entry == null) { ...
[ "public", "final", "void", "writeAndRemoveAll", "(", "ChannelHandlerContext", "ctx", ")", "{", "decrementReadableBytes", "(", "readableBytes", ")", ";", "Throwable", "pending", "=", "null", ";", "ByteBuf", "previousBuf", "=", "null", ";", "for", "(", ";", ";", ...
Writes all remaining elements in this queue. @param ctx The context to write all elements to.
[ "Writes", "all", "remaining", "elements", "in", "this", "queue", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/transport/src/main/java/io/netty/channel/AbstractCoalescingBufferQueue.java#L223-L260
122,829
netty/netty
resolver/src/main/java/io/netty/resolver/HostsFileParser.java
HostsFileParser.parse
public static HostsFileEntries parse(File file, Charset... charsets) throws IOException { checkNotNull(file, "file"); checkNotNull(charsets, "charsets"); if (file.exists() && file.isFile()) { for (Charset charset: charsets) { HostsFileEntries entries = parse(new Buffe...
java
public static HostsFileEntries parse(File file, Charset... charsets) throws IOException { checkNotNull(file, "file"); checkNotNull(charsets, "charsets"); if (file.exists() && file.isFile()) { for (Charset charset: charsets) { HostsFileEntries entries = parse(new Buffe...
[ "public", "static", "HostsFileEntries", "parse", "(", "File", "file", ",", "Charset", "...", "charsets", ")", "throws", "IOException", "{", "checkNotNull", "(", "file", ",", "\"file\"", ")", ";", "checkNotNull", "(", "charsets", ",", "\"charsets\"", ")", ";", ...
Parse a hosts file. @param file the file to be parsed @param charsets the {@link Charset}s to try as file encodings when parsing. @return a {@link HostsFileEntries} @throws IOException file could not be read
[ "Parse", "a", "hosts", "file", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/resolver/src/main/java/io/netty/resolver/HostsFileParser.java#L127-L140
122,830
netty/netty
resolver/src/main/java/io/netty/resolver/HostsFileParser.java
HostsFileParser.parse
public static HostsFileEntries parse(Reader reader) throws IOException { checkNotNull(reader, "reader"); BufferedReader buff = new BufferedReader(reader); try { Map<String, Inet4Address> ipv4Entries = new HashMap<String, Inet4Address>(); Map<String, Inet6Address> ipv6Entr...
java
public static HostsFileEntries parse(Reader reader) throws IOException { checkNotNull(reader, "reader"); BufferedReader buff = new BufferedReader(reader); try { Map<String, Inet4Address> ipv4Entries = new HashMap<String, Inet4Address>(); Map<String, Inet6Address> ipv6Entr...
[ "public", "static", "HostsFileEntries", "parse", "(", "Reader", "reader", ")", "throws", "IOException", "{", "checkNotNull", "(", "reader", ",", "\"reader\"", ")", ";", "BufferedReader", "buff", "=", "new", "BufferedReader", "(", "reader", ")", ";", "try", "{"...
Parse a reader of hosts file format. @param reader the file to be parsed @return a {@link HostsFileEntries} @throws IOException file could not be read
[ "Parse", "a", "reader", "of", "hosts", "file", "format", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/resolver/src/main/java/io/netty/resolver/HostsFileParser.java#L149-L219
122,831
netty/netty
handler/src/main/java/io/netty/handler/ssl/ConscryptAlpnSslEngine.java
ConscryptAlpnSslEngine.calculateOutNetBufSize
final int calculateOutNetBufSize(int plaintextBytes, int numBuffers) { // Assuming a max of one frame per component in a composite buffer. long maxOverhead = (long) Conscrypt.maxSealOverhead(getWrappedEngine()) * numBuffers; // TODO(nmittler): update this to use MAX_ENCRYPTED_PACKET_LENGTH inste...
java
final int calculateOutNetBufSize(int plaintextBytes, int numBuffers) { // Assuming a max of one frame per component in a composite buffer. long maxOverhead = (long) Conscrypt.maxSealOverhead(getWrappedEngine()) * numBuffers; // TODO(nmittler): update this to use MAX_ENCRYPTED_PACKET_LENGTH inste...
[ "final", "int", "calculateOutNetBufSize", "(", "int", "plaintextBytes", ",", "int", "numBuffers", ")", "{", "// Assuming a max of one frame per component in a composite buffer.", "long", "maxOverhead", "=", "(", "long", ")", "Conscrypt", ".", "maxSealOverhead", "(", "getW...
Calculates the maximum size of the encrypted output buffer required to wrap the given plaintext bytes. Assumes as a worst case that there is one TLS record per buffer. @param plaintextBytes the number of plaintext bytes to be wrapped. @param numBuffers the number of buffers that the plaintext bytes are spread across. ...
[ "Calculates", "the", "maximum", "size", "of", "the", "encrypted", "output", "buffer", "required", "to", "wrap", "the", "given", "plaintext", "bytes", ".", "Assumes", "as", "a", "worst", "case", "that", "there", "is", "one", "TLS", "record", "per", "buffer", ...
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/ssl/ConscryptAlpnSslEngine.java#L85-L90
122,832
netty/netty
codec-haproxy/src/main/java/io/netty/handler/codec/haproxy/HAProxyMessageDecoder.java
HAProxyMessageDecoder.findVersion
private static int findVersion(final ByteBuf buffer) { final int n = buffer.readableBytes(); // per spec, the version number is found in the 13th byte if (n < 13) { return -1; } int idx = buffer.readerIndex(); return match(BINARY_PREFIX, buffer, idx) ? buffer...
java
private static int findVersion(final ByteBuf buffer) { final int n = buffer.readableBytes(); // per spec, the version number is found in the 13th byte if (n < 13) { return -1; } int idx = buffer.readerIndex(); return match(BINARY_PREFIX, buffer, idx) ? buffer...
[ "private", "static", "int", "findVersion", "(", "final", "ByteBuf", "buffer", ")", "{", "final", "int", "n", "=", "buffer", ".", "readableBytes", "(", ")", ";", "// per spec, the version number is found in the 13th byte", "if", "(", "n", "<", "13", ")", "{", "...
Returns the proxy protocol specification version in the buffer if the version is found. Returns -1 if no version was found in the buffer.
[ "Returns", "the", "proxy", "protocol", "specification", "version", "in", "the", "buffer", "if", "the", "version", "is", "found", ".", "Returns", "-", "1", "if", "no", "version", "was", "found", "in", "the", "buffer", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-haproxy/src/main/java/io/netty/handler/codec/haproxy/HAProxyMessageDecoder.java#L163-L172
122,833
netty/netty
codec-haproxy/src/main/java/io/netty/handler/codec/haproxy/HAProxyMessageDecoder.java
HAProxyMessageDecoder.findEndOfHeader
private static int findEndOfHeader(final ByteBuf buffer) { final int n = buffer.readableBytes(); // per spec, the 15th and 16th bytes contain the address length in bytes if (n < 16) { return -1; } int offset = buffer.readerIndex() + 14; // the total header ...
java
private static int findEndOfHeader(final ByteBuf buffer) { final int n = buffer.readableBytes(); // per spec, the 15th and 16th bytes contain the address length in bytes if (n < 16) { return -1; } int offset = buffer.readerIndex() + 14; // the total header ...
[ "private", "static", "int", "findEndOfHeader", "(", "final", "ByteBuf", "buffer", ")", "{", "final", "int", "n", "=", "buffer", ".", "readableBytes", "(", ")", ";", "// per spec, the 15th and 16th bytes contain the address length in bytes", "if", "(", "n", "<", "16"...
Returns the index in the buffer of the end of header if found. Returns -1 if no end of header was found in the buffer.
[ "Returns", "the", "index", "in", "the", "buffer", "of", "the", "end", "of", "header", "if", "found", ".", "Returns", "-", "1", "if", "no", "end", "of", "header", "was", "found", "in", "the", "buffer", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-haproxy/src/main/java/io/netty/handler/codec/haproxy/HAProxyMessageDecoder.java#L178-L197
122,834
netty/netty
handler/src/main/java/io/netty/handler/traffic/GlobalChannelTrafficShapingHandler.java
GlobalChannelTrafficShapingHandler.createGlobalTrafficCounter
void createGlobalTrafficCounter(ScheduledExecutorService executor) { // Default setMaxDeviation(DEFAULT_DEVIATION, DEFAULT_SLOWDOWN, DEFAULT_ACCELERATION); if (executor == null) { throw new IllegalArgumentException("Executor must not be null"); } TrafficCounter tc = n...
java
void createGlobalTrafficCounter(ScheduledExecutorService executor) { // Default setMaxDeviation(DEFAULT_DEVIATION, DEFAULT_SLOWDOWN, DEFAULT_ACCELERATION); if (executor == null) { throw new IllegalArgumentException("Executor must not be null"); } TrafficCounter tc = n...
[ "void", "createGlobalTrafficCounter", "(", "ScheduledExecutorService", "executor", ")", "{", "// Default", "setMaxDeviation", "(", "DEFAULT_DEVIATION", ",", "DEFAULT_SLOWDOWN", ",", "DEFAULT_ACCELERATION", ")", ";", "if", "(", "executor", "==", "null", ")", "{", "thro...
Create the global TrafficCounter
[ "Create", "the", "global", "TrafficCounter" ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/traffic/GlobalChannelTrafficShapingHandler.java#L147-L156
122,835
netty/netty
handler/src/main/java/io/netty/handler/traffic/GlobalChannelTrafficShapingHandler.java
GlobalChannelTrafficShapingHandler.channelTrafficCounters
public Collection<TrafficCounter> channelTrafficCounters() { return new AbstractCollection<TrafficCounter>() { @Override public Iterator<TrafficCounter> iterator() { return new Iterator<TrafficCounter>() { final Iterator<PerChannel> iter = channelQueue...
java
public Collection<TrafficCounter> channelTrafficCounters() { return new AbstractCollection<TrafficCounter>() { @Override public Iterator<TrafficCounter> iterator() { return new Iterator<TrafficCounter>() { final Iterator<PerChannel> iter = channelQueue...
[ "public", "Collection", "<", "TrafficCounter", ">", "channelTrafficCounters", "(", ")", "{", "return", "new", "AbstractCollection", "<", "TrafficCounter", ">", "(", ")", "{", "@", "Override", "public", "Iterator", "<", "TrafficCounter", ">", "iterator", "(", ")"...
To allow for instance doAccounting to use the TrafficCounter per channel. @return the list of TrafficCounters that exists at the time of the call.
[ "To", "allow", "for", "instance", "doAccounting", "to", "use", "the", "TrafficCounter", "per", "channel", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/handler/src/main/java/io/netty/handler/traffic/GlobalChannelTrafficShapingHandler.java#L626-L651
122,836
netty/netty
codec/src/main/java/io/netty/handler/codec/compression/Bzip2BitReader.java
Bzip2BitReader.hasReadableBits
boolean hasReadableBits(int count) { if (count < 0) { throw new IllegalArgumentException("count: " + count + " (expected value greater than 0)"); } return bitCount >= count || (in.readableBytes() << 3 & Integer.MAX_VALUE) >= count - bitCount; }
java
boolean hasReadableBits(int count) { if (count < 0) { throw new IllegalArgumentException("count: " + count + " (expected value greater than 0)"); } return bitCount >= count || (in.readableBytes() << 3 & Integer.MAX_VALUE) >= count - bitCount; }
[ "boolean", "hasReadableBits", "(", "int", "count", ")", "{", "if", "(", "count", "<", "0", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"count: \"", "+", "count", "+", "\" (expected value greater than 0)\"", ")", ";", "}", "return", "bitCount", ...
Checks that the specified number of bits available for reading. @param count The number of bits to check @return {@code true} if {@code count} bits are available for reading, otherwise {@code false}
[ "Checks", "that", "the", "specified", "number", "of", "bits", "available", "for", "reading", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec/src/main/java/io/netty/handler/codec/compression/Bzip2BitReader.java#L138-L143
122,837
netty/netty
codec/src/main/java/io/netty/handler/codec/compression/Bzip2BitReader.java
Bzip2BitReader.hasReadableBytes
boolean hasReadableBytes(int count) { if (count < 0 || count > MAX_COUNT_OF_READABLE_BYTES) { throw new IllegalArgumentException("count: " + count + " (expected: 0-" + MAX_COUNT_OF_READABLE_BYTES + ')'); } return hasReadableBits(count << 3); }
java
boolean hasReadableBytes(int count) { if (count < 0 || count > MAX_COUNT_OF_READABLE_BYTES) { throw new IllegalArgumentException("count: " + count + " (expected: 0-" + MAX_COUNT_OF_READABLE_BYTES + ')'); } return hasReadableBits(count << 3); }
[ "boolean", "hasReadableBytes", "(", "int", "count", ")", "{", "if", "(", "count", "<", "0", "||", "count", ">", "MAX_COUNT_OF_READABLE_BYTES", ")", "{", "throw", "new", "IllegalArgumentException", "(", "\"count: \"", "+", "count", "+", "\" (expected: 0-\"", "+",...
Checks that the specified number of bytes available for reading. @param count The number of bytes to check @return {@code true} if {@code count} bytes are available for reading, otherwise {@code false}
[ "Checks", "that", "the", "specified", "number", "of", "bytes", "available", "for", "reading", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec/src/main/java/io/netty/handler/codec/compression/Bzip2BitReader.java#L150-L156
122,838
netty/netty
codec-smtp/src/main/java/io/netty/handler/codec/smtp/SmtpResponseDecoder.java
SmtpResponseDecoder.parseCode
private static int parseCode(ByteBuf buffer) { final int first = parseNumber(buffer.readByte()) * 100; final int second = parseNumber(buffer.readByte()) * 10; final int third = parseNumber(buffer.readByte()); return first + second + third; }
java
private static int parseCode(ByteBuf buffer) { final int first = parseNumber(buffer.readByte()) * 100; final int second = parseNumber(buffer.readByte()) * 10; final int third = parseNumber(buffer.readByte()); return first + second + third; }
[ "private", "static", "int", "parseCode", "(", "ByteBuf", "buffer", ")", "{", "final", "int", "first", "=", "parseNumber", "(", "buffer", ".", "readByte", "(", ")", ")", "*", "100", ";", "final", "int", "second", "=", "parseNumber", "(", "buffer", ".", ...
Parses the io.netty.handler.codec.smtp code without any allocation, which is three digits.
[ "Parses", "the", "io", ".", "netty", ".", "handler", ".", "codec", ".", "smtp", "code", "without", "any", "allocation", "which", "is", "three", "digits", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-smtp/src/main/java/io/netty/handler/codec/smtp/SmtpResponseDecoder.java#L107-L112
122,839
netty/netty
codec/src/main/java/io/netty/handler/codec/DelimiterBasedFrameDecoder.java
DelimiterBasedFrameDecoder.isLineBased
private static boolean isLineBased(final ByteBuf[] delimiters) { if (delimiters.length != 2) { return false; } ByteBuf a = delimiters[0]; ByteBuf b = delimiters[1]; if (a.capacity() < b.capacity()) { a = delimiters[1]; b = delimiters[0]; ...
java
private static boolean isLineBased(final ByteBuf[] delimiters) { if (delimiters.length != 2) { return false; } ByteBuf a = delimiters[0]; ByteBuf b = delimiters[1]; if (a.capacity() < b.capacity()) { a = delimiters[1]; b = delimiters[0]; ...
[ "private", "static", "boolean", "isLineBased", "(", "final", "ByteBuf", "[", "]", "delimiters", ")", "{", "if", "(", "delimiters", ".", "length", "!=", "2", ")", "{", "return", "false", ";", "}", "ByteBuf", "a", "=", "delimiters", "[", "0", "]", ";", ...
Returns true if the delimiters are "\n" and "\r\n".
[ "Returns", "true", "if", "the", "delimiters", "are", "\\", "n", "and", "\\", "r", "\\", "n", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec/src/main/java/io/netty/handler/codec/DelimiterBasedFrameDecoder.java#L194-L207
122,840
netty/netty
codec/src/main/java/io/netty/handler/codec/ReplayingDecoder.java
ReplayingDecoder.state
protected S state(S newState) { S oldState = state; state = newState; return oldState; }
java
protected S state(S newState) { S oldState = state; state = newState; return oldState; }
[ "protected", "S", "state", "(", "S", "newState", ")", "{", "S", "oldState", "=", "state", ";", "state", "=", "newState", ";", "return", "oldState", ";", "}" ]
Sets the current state of this decoder. @return the old state of this decoder
[ "Sets", "the", "current", "state", "of", "this", "decoder", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec/src/main/java/io/netty/handler/codec/ReplayingDecoder.java#L318-L322
122,841
netty/netty
codec-http/src/main/java/io/netty/handler/codec/spdy/SpdyHttpEncoder.java
SpdyHttpEncoder.isLast
private static boolean isLast(HttpMessage httpMessage) { if (httpMessage instanceof FullHttpMessage) { FullHttpMessage fullMessage = (FullHttpMessage) httpMessage; if (fullMessage.trailingHeaders().isEmpty() && !fullMessage.content().isReadable()) { return true; ...
java
private static boolean isLast(HttpMessage httpMessage) { if (httpMessage instanceof FullHttpMessage) { FullHttpMessage fullMessage = (FullHttpMessage) httpMessage; if (fullMessage.trailingHeaders().isEmpty() && !fullMessage.content().isReadable()) { return true; ...
[ "private", "static", "boolean", "isLast", "(", "HttpMessage", "httpMessage", ")", "{", "if", "(", "httpMessage", "instanceof", "FullHttpMessage", ")", "{", "FullHttpMessage", "fullMessage", "=", "(", "FullHttpMessage", ")", "httpMessage", ";", "if", "(", "fullMess...
Checks if the given HTTP message should be considered as a last SPDY frame. @param httpMessage check this HTTP message @return whether the given HTTP message should generate a <em>last</em> SPDY frame.
[ "Checks", "if", "the", "given", "HTTP", "message", "should", "be", "considered", "as", "a", "last", "SPDY", "frame", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/spdy/SpdyHttpEncoder.java#L322-L331
122,842
netty/netty
codec-http/src/main/java/io/netty/handler/codec/spdy/SpdySession.java
SpdySession.activeStreams
Map<Integer, StreamState> activeStreams() { Map<Integer, StreamState> streams = new TreeMap<Integer, StreamState>(streamComparator); streams.putAll(activeStreams); return streams; }
java
Map<Integer, StreamState> activeStreams() { Map<Integer, StreamState> streams = new TreeMap<Integer, StreamState>(streamComparator); streams.putAll(activeStreams); return streams; }
[ "Map", "<", "Integer", ",", "StreamState", ">", "activeStreams", "(", ")", "{", "Map", "<", "Integer", ",", "StreamState", ">", "streams", "=", "new", "TreeMap", "<", "Integer", ",", "StreamState", ">", "(", "streamComparator", ")", ";", "streams", ".", ...
Stream-IDs should be iterated in priority order
[ "Stream", "-", "IDs", "should", "be", "iterated", "in", "priority", "order" ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/spdy/SpdySession.java#L61-L65
122,843
netty/netty
codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshaker.java
WebSocketServerHandshaker.subprotocols
public Set<String> subprotocols() { Set<String> ret = new LinkedHashSet<String>(); Collections.addAll(ret, subprotocols); return ret; }
java
public Set<String> subprotocols() { Set<String> ret = new LinkedHashSet<String>(); Collections.addAll(ret, subprotocols); return ret; }
[ "public", "Set", "<", "String", ">", "subprotocols", "(", ")", "{", "Set", "<", "String", ">", "ret", "=", "new", "LinkedHashSet", "<", "String", ">", "(", ")", ";", "Collections", ".", "addAll", "(", "ret", ",", "subprotocols", ")", ";", "return", "...
Returns the CSV of supported sub protocols
[ "Returns", "the", "CSV", "of", "supported", "sub", "protocols" ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshaker.java#L108-L112
122,844
netty/netty
codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshaker.java
WebSocketServerHandshaker.selectSubprotocol
protected String selectSubprotocol(String requestedSubprotocols) { if (requestedSubprotocols == null || subprotocols.length == 0) { return null; } String[] requestedSubprotocolArray = requestedSubprotocols.split(","); for (String p: requestedSubprotocolArray) { S...
java
protected String selectSubprotocol(String requestedSubprotocols) { if (requestedSubprotocols == null || subprotocols.length == 0) { return null; } String[] requestedSubprotocolArray = requestedSubprotocols.split(","); for (String p: requestedSubprotocolArray) { S...
[ "protected", "String", "selectSubprotocol", "(", "String", "requestedSubprotocols", ")", "{", "if", "(", "requestedSubprotocols", "==", "null", "||", "subprotocols", ".", "length", "==", "0", ")", "{", "return", "null", ";", "}", "String", "[", "]", "requested...
Selects the first matching supported sub protocol @param requestedSubprotocols CSV of protocols to be supported. e.g. "chat, superchat" @return First matching supported sub protocol. Null if not found.
[ "Selects", "the", "first", "matching", "supported", "sub", "protocol" ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/websocketx/WebSocketServerHandshaker.java#L341-L361
122,845
netty/netty
buffer/src/main/java/io/netty/buffer/ByteBufUtil.java
ByteBufUtil.indexOf
public static int indexOf(ByteBuf needle, ByteBuf haystack) { // TODO: maybe use Boyer Moore for efficiency. int attempts = haystack.readableBytes() - needle.readableBytes() + 1; for (int i = 0; i < attempts; i++) { if (equals(needle, needle.readerIndex(), hays...
java
public static int indexOf(ByteBuf needle, ByteBuf haystack) { // TODO: maybe use Boyer Moore for efficiency. int attempts = haystack.readableBytes() - needle.readableBytes() + 1; for (int i = 0; i < attempts; i++) { if (equals(needle, needle.readerIndex(), hays...
[ "public", "static", "int", "indexOf", "(", "ByteBuf", "needle", ",", "ByteBuf", "haystack", ")", "{", "// TODO: maybe use Boyer Moore for efficiency.", "int", "attempts", "=", "haystack", ".", "readableBytes", "(", ")", "-", "needle", ".", "readableBytes", "(", ")...
Returns the reader index of needle in haystack, or -1 if needle is not in haystack.
[ "Returns", "the", "reader", "index", "of", "needle", "in", "haystack", "or", "-", "1", "if", "needle", "is", "not", "in", "haystack", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/ByteBufUtil.java#L210-L221
122,846
netty/netty
buffer/src/main/java/io/netty/buffer/ByteBufUtil.java
ByteBufUtil.writeShortBE
@SuppressWarnings("deprecation") public static ByteBuf writeShortBE(ByteBuf buf, int shortValue) { return buf.order() == ByteOrder.BIG_ENDIAN? buf.writeShort(shortValue) : buf.writeShortLE(shortValue); }
java
@SuppressWarnings("deprecation") public static ByteBuf writeShortBE(ByteBuf buf, int shortValue) { return buf.order() == ByteOrder.BIG_ENDIAN? buf.writeShort(shortValue) : buf.writeShortLE(shortValue); }
[ "@", "SuppressWarnings", "(", "\"deprecation\"", ")", "public", "static", "ByteBuf", "writeShortBE", "(", "ByteBuf", "buf", ",", "int", "shortValue", ")", "{", "return", "buf", ".", "order", "(", ")", "==", "ByteOrder", ".", "BIG_ENDIAN", "?", "buf", ".", ...
Writes a big-endian 16-bit short integer to the buffer.
[ "Writes", "a", "big", "-", "endian", "16", "-", "bit", "short", "integer", "to", "the", "buffer", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/ByteBufUtil.java#L418-L421
122,847
netty/netty
buffer/src/main/java/io/netty/buffer/ByteBufUtil.java
ByteBufUtil.setShortBE
@SuppressWarnings("deprecation") public static ByteBuf setShortBE(ByteBuf buf, int index, int shortValue) { return buf.order() == ByteOrder.BIG_ENDIAN? buf.setShort(index, shortValue) : buf.setShortLE(index, shortValue); }
java
@SuppressWarnings("deprecation") public static ByteBuf setShortBE(ByteBuf buf, int index, int shortValue) { return buf.order() == ByteOrder.BIG_ENDIAN? buf.setShort(index, shortValue) : buf.setShortLE(index, shortValue); }
[ "@", "SuppressWarnings", "(", "\"deprecation\"", ")", "public", "static", "ByteBuf", "setShortBE", "(", "ByteBuf", "buf", ",", "int", "index", ",", "int", "shortValue", ")", "{", "return", "buf", ".", "order", "(", ")", "==", "ByteOrder", ".", "BIG_ENDIAN", ...
Sets a big-endian 16-bit short integer to the buffer.
[ "Sets", "a", "big", "-", "endian", "16", "-", "bit", "short", "integer", "to", "the", "buffer", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/ByteBufUtil.java#L426-L429
122,848
netty/netty
buffer/src/main/java/io/netty/buffer/ByteBufUtil.java
ByteBufUtil.writeMediumBE
@SuppressWarnings("deprecation") public static ByteBuf writeMediumBE(ByteBuf buf, int mediumValue) { return buf.order() == ByteOrder.BIG_ENDIAN? buf.writeMedium(mediumValue) : buf.writeMediumLE(mediumValue); }
java
@SuppressWarnings("deprecation") public static ByteBuf writeMediumBE(ByteBuf buf, int mediumValue) { return buf.order() == ByteOrder.BIG_ENDIAN? buf.writeMedium(mediumValue) : buf.writeMediumLE(mediumValue); }
[ "@", "SuppressWarnings", "(", "\"deprecation\"", ")", "public", "static", "ByteBuf", "writeMediumBE", "(", "ByteBuf", "buf", ",", "int", "mediumValue", ")", "{", "return", "buf", ".", "order", "(", ")", "==", "ByteOrder", ".", "BIG_ENDIAN", "?", "buf", ".", ...
Writes a big-endian 24-bit medium integer to the buffer.
[ "Writes", "a", "big", "-", "endian", "24", "-", "bit", "medium", "integer", "to", "the", "buffer", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/ByteBufUtil.java#L434-L437
122,849
netty/netty
buffer/src/main/java/io/netty/buffer/ByteBufUtil.java
ByteBufUtil.threadLocalDirectBuffer
public static ByteBuf threadLocalDirectBuffer() { if (THREAD_LOCAL_BUFFER_SIZE <= 0) { return null; } if (PlatformDependent.hasUnsafe()) { return ThreadLocalUnsafeDirectByteBuf.newInstance(); } else { return ThreadLocalDirectByteBuf.newInstance(); ...
java
public static ByteBuf threadLocalDirectBuffer() { if (THREAD_LOCAL_BUFFER_SIZE <= 0) { return null; } if (PlatformDependent.hasUnsafe()) { return ThreadLocalUnsafeDirectByteBuf.newInstance(); } else { return ThreadLocalDirectByteBuf.newInstance(); ...
[ "public", "static", "ByteBuf", "threadLocalDirectBuffer", "(", ")", "{", "if", "(", "THREAD_LOCAL_BUFFER_SIZE", "<=", "0", ")", "{", "return", "null", ";", "}", "if", "(", "PlatformDependent", ".", "hasUnsafe", "(", ")", ")", "{", "return", "ThreadLocalUnsafeD...
Returns a cached thread-local direct buffer, if available. @return a cached thread-local direct buffer, if available. {@code null} otherwise.
[ "Returns", "a", "cached", "thread", "-", "local", "direct", "buffer", "if", "available", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/buffer/src/main/java/io/netty/buffer/ByteBufUtil.java#L805-L815
122,850
netty/netty
common/src/main/java/io/netty/util/internal/PlatformDependent.java
PlatformDependent.throwException
public static void throwException(Throwable t) { if (hasUnsafe()) { PlatformDependent0.throwException(t); } else { PlatformDependent.<RuntimeException>throwException0(t); } }
java
public static void throwException(Throwable t) { if (hasUnsafe()) { PlatformDependent0.throwException(t); } else { PlatformDependent.<RuntimeException>throwException0(t); } }
[ "public", "static", "void", "throwException", "(", "Throwable", "t", ")", "{", "if", "(", "hasUnsafe", "(", ")", ")", "{", "PlatformDependent0", ".", "throwException", "(", "t", ")", ";", "}", "else", "{", "PlatformDependent", ".", "<", "RuntimeException", ...
Raises an exception bypassing compiler checks for checked exceptions.
[ "Raises", "an", "exception", "bypassing", "compiler", "checks", "for", "checked", "exceptions", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/internal/PlatformDependent.java#L339-L345
122,851
netty/netty
common/src/main/java/io/netty/util/internal/PlatformDependent.java
PlatformDependent.isZero
public static boolean isZero(byte[] bytes, int startPos, int length) { return !hasUnsafe() || !unalignedAccess() ? isZeroSafe(bytes, startPos, length) : PlatformDependent0.isZero(bytes, startPos, length); }
java
public static boolean isZero(byte[] bytes, int startPos, int length) { return !hasUnsafe() || !unalignedAccess() ? isZeroSafe(bytes, startPos, length) : PlatformDependent0.isZero(bytes, startPos, length); }
[ "public", "static", "boolean", "isZero", "(", "byte", "[", "]", "bytes", ",", "int", "startPos", ",", "int", "length", ")", "{", "return", "!", "hasUnsafe", "(", ")", "||", "!", "unalignedAccess", "(", ")", "?", "isZeroSafe", "(", "bytes", ",", "startP...
Determine if a subsection of an array is zero. @param bytes The byte array. @param startPos The starting index (inclusive) in {@code bytes}. @param length The amount of bytes to check for zero. @return {@code false} if {@code bytes[startPos:startsPos+length)} contains a value other than zero.
[ "Determine", "if", "a", "subsection", "of", "an", "array", "is", "zero", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/internal/PlatformDependent.java#L709-L713
122,852
netty/netty
common/src/main/java/io/netty/util/internal/PlatformDependent.java
PlatformDependent.hashCodeAscii
public static int hashCodeAscii(byte[] bytes, int startPos, int length) { return !hasUnsafe() || !unalignedAccess() ? hashCodeAsciiSafe(bytes, startPos, length) : PlatformDependent0.hashCodeAscii(bytes, startPos, length); }
java
public static int hashCodeAscii(byte[] bytes, int startPos, int length) { return !hasUnsafe() || !unalignedAccess() ? hashCodeAsciiSafe(bytes, startPos, length) : PlatformDependent0.hashCodeAscii(bytes, startPos, length); }
[ "public", "static", "int", "hashCodeAscii", "(", "byte", "[", "]", "bytes", ",", "int", "startPos", ",", "int", "length", ")", "{", "return", "!", "hasUnsafe", "(", ")", "||", "!", "unalignedAccess", "(", ")", "?", "hashCodeAsciiSafe", "(", "bytes", ",",...
Calculate a hash code of a byte array assuming ASCII character encoding. The resulting hash code will be case insensitive. @param bytes The array which contains the data to hash. @param startPos What index to start generating a hash code in {@code bytes} @param length The amount of bytes that should be accounted for in...
[ "Calculate", "a", "hash", "code", "of", "a", "byte", "array", "assuming", "ASCII", "character", "encoding", ".", "The", "resulting", "hash", "code", "will", "be", "case", "insensitive", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/internal/PlatformDependent.java#L751-L755
122,853
netty/netty
common/src/main/java/io/netty/util/internal/PlatformDependent.java
PlatformDependent.hashCodeAsciiSafe
static int hashCodeAsciiSafe(byte[] bytes, int startPos, int length) { int hash = HASH_CODE_ASCII_SEED; final int remainingBytes = length & 7; final int end = startPos + remainingBytes; for (int i = startPos - 8 + length; i >= end; i -= 8) { hash = PlatformDependent0.hashCode...
java
static int hashCodeAsciiSafe(byte[] bytes, int startPos, int length) { int hash = HASH_CODE_ASCII_SEED; final int remainingBytes = length & 7; final int end = startPos + remainingBytes; for (int i = startPos - 8 + length; i >= end; i -= 8) { hash = PlatformDependent0.hashCode...
[ "static", "int", "hashCodeAsciiSafe", "(", "byte", "[", "]", "bytes", ",", "int", "startPos", ",", "int", "length", ")", "{", "int", "hash", "=", "HASH_CODE_ASCII_SEED", ";", "final", "int", "remainingBytes", "=", "length", "&", "7", ";", "final", "int", ...
Package private for testing purposes only!
[ "Package", "private", "for", "testing", "purposes", "only!" ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/internal/PlatformDependent.java#L1237-L1267
122,854
netty/netty
common/src/main/java/io/netty/util/ConstantPool.java
ConstantPool.getOrCreate
private T getOrCreate(String name) { T constant = constants.get(name); if (constant == null) { final T tempConstant = newConstant(nextId(), name); constant = constants.putIfAbsent(name, tempConstant); if (constant == null) { return tempConstant; ...
java
private T getOrCreate(String name) { T constant = constants.get(name); if (constant == null) { final T tempConstant = newConstant(nextId(), name); constant = constants.putIfAbsent(name, tempConstant); if (constant == null) { return tempConstant; ...
[ "private", "T", "getOrCreate", "(", "String", "name", ")", "{", "T", "constant", "=", "constants", ".", "get", "(", "name", ")", ";", "if", "(", "constant", "==", "null", ")", "{", "final", "T", "tempConstant", "=", "newConstant", "(", "nextId", "(", ...
Get existing constant by name or creates new one if not exists. Threadsafe @param name the name of the {@link Constant}
[ "Get", "existing", "constant", "by", "name", "or", "creates", "new", "one", "if", "not", "exists", ".", "Threadsafe" ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/ConstantPool.java#L68-L79
122,855
netty/netty
common/src/main/java/io/netty/util/ConstantPool.java
ConstantPool.createOrThrow
private T createOrThrow(String name) { T constant = constants.get(name); if (constant == null) { final T tempConstant = newConstant(nextId(), name); constant = constants.putIfAbsent(name, tempConstant); if (constant == null) { return tempConstant; ...
java
private T createOrThrow(String name) { T constant = constants.get(name); if (constant == null) { final T tempConstant = newConstant(nextId(), name); constant = constants.putIfAbsent(name, tempConstant); if (constant == null) { return tempConstant; ...
[ "private", "T", "createOrThrow", "(", "String", "name", ")", "{", "T", "constant", "=", "constants", ".", "get", "(", "name", ")", ";", "if", "(", "constant", "==", "null", ")", "{", "final", "T", "tempConstant", "=", "newConstant", "(", "nextId", "(",...
Creates constant by name or throws exception. Threadsafe @param name the name of the {@link Constant}
[ "Creates", "constant", "by", "name", "or", "throws", "exception", ".", "Threadsafe" ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/common/src/main/java/io/netty/util/ConstantPool.java#L103-L114
122,856
netty/netty
codec/src/main/java/io/netty/handler/codec/compression/SnappyFrameDecoder.java
SnappyFrameDecoder.mapChunkType
private static ChunkType mapChunkType(byte type) { if (type == 0) { return ChunkType.COMPRESSED_DATA; } else if (type == 1) { return ChunkType.UNCOMPRESSED_DATA; } else if (type == (byte) 0xff) { return ChunkType.STREAM_IDENTIFIER; } else if ((type & 0...
java
private static ChunkType mapChunkType(byte type) { if (type == 0) { return ChunkType.COMPRESSED_DATA; } else if (type == 1) { return ChunkType.UNCOMPRESSED_DATA; } else if (type == (byte) 0xff) { return ChunkType.STREAM_IDENTIFIER; } else if ((type & 0...
[ "private", "static", "ChunkType", "mapChunkType", "(", "byte", "type", ")", "{", "if", "(", "type", "==", "0", ")", "{", "return", "ChunkType", ".", "COMPRESSED_DATA", ";", "}", "else", "if", "(", "type", "==", "1", ")", "{", "return", "ChunkType", "."...
Decodes the chunk type from the type tag byte. @param type The tag byte extracted from the stream @return The appropriate {@link ChunkType}, defaulting to {@link ChunkType#RESERVED_UNSKIPPABLE}
[ "Decodes", "the", "chunk", "type", "from", "the", "type", "tag", "byte", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec/src/main/java/io/netty/handler/codec/compression/SnappyFrameDecoder.java#L214-L226
122,857
netty/netty
codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostMultipartRequestDecoder.java
HttpPostMultipartRequestDecoder.setMultipart
private void setMultipart(String contentType) { String[] dataBoundary = HttpPostRequestDecoder.getMultipartDataBoundary(contentType); if (dataBoundary != null) { multipartDataBoundary = dataBoundary[0]; if (dataBoundary.length > 1 && dataBoundary[1] != null) { cha...
java
private void setMultipart(String contentType) { String[] dataBoundary = HttpPostRequestDecoder.getMultipartDataBoundary(contentType); if (dataBoundary != null) { multipartDataBoundary = dataBoundary[0]; if (dataBoundary.length > 1 && dataBoundary[1] != null) { cha...
[ "private", "void", "setMultipart", "(", "String", "contentType", ")", "{", "String", "[", "]", "dataBoundary", "=", "HttpPostRequestDecoder", ".", "getMultipartDataBoundary", "(", "contentType", ")", ";", "if", "(", "dataBoundary", "!=", "null", ")", "{", "multi...
Set from the request ContentType the multipartDataBoundary and the possible charset.
[ "Set", "from", "the", "request", "ContentType", "the", "multipartDataBoundary", "and", "the", "possible", "charset", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostMultipartRequestDecoder.java#L195-L206
122,858
netty/netty
codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostMultipartRequestDecoder.java
HttpPostMultipartRequestDecoder.parseBodyMultipart
private void parseBodyMultipart() { if (undecodedChunk == null || undecodedChunk.readableBytes() == 0) { // nothing to decode return; } InterfaceHttpData data = decodeMultipart(currentStatus); while (data != null) { addHttpData(data); if (c...
java
private void parseBodyMultipart() { if (undecodedChunk == null || undecodedChunk.readableBytes() == 0) { // nothing to decode return; } InterfaceHttpData data = decodeMultipart(currentStatus); while (data != null) { addHttpData(data); if (c...
[ "private", "void", "parseBodyMultipart", "(", ")", "{", "if", "(", "undecodedChunk", "==", "null", "||", "undecodedChunk", ".", "readableBytes", "(", ")", "==", "0", ")", "{", "// nothing to decode", "return", ";", "}", "InterfaceHttpData", "data", "=", "decod...
Parse the Body for multipart @throws ErrorDataDecoderException if there is a problem with the charset decoding or other errors
[ "Parse", "the", "Body", "for", "multipart" ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostMultipartRequestDecoder.java#L437-L450
122,859
netty/netty
codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostMultipartRequestDecoder.java
HttpPostMultipartRequestDecoder.skipControlCharacters
private static void skipControlCharacters(ByteBuf undecodedChunk) { if (!undecodedChunk.hasArray()) { try { skipControlCharactersStandard(undecodedChunk); } catch (IndexOutOfBoundsException e1) { throw new NotEnoughDataDecoderException(e1); } ...
java
private static void skipControlCharacters(ByteBuf undecodedChunk) { if (!undecodedChunk.hasArray()) { try { skipControlCharactersStandard(undecodedChunk); } catch (IndexOutOfBoundsException e1) { throw new NotEnoughDataDecoderException(e1); } ...
[ "private", "static", "void", "skipControlCharacters", "(", "ByteBuf", "undecodedChunk", ")", "{", "if", "(", "!", "undecodedChunk", ".", "hasArray", "(", ")", ")", "{", "try", "{", "skipControlCharactersStandard", "(", "undecodedChunk", ")", ";", "}", "catch", ...
Skip control Characters @throws NotEnoughDataDecoderException
[ "Skip", "control", "Characters" ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostMultipartRequestDecoder.java#L580-L598
122,860
netty/netty
codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostMultipartRequestDecoder.java
HttpPostMultipartRequestDecoder.findMultipartDelimiter
private InterfaceHttpData findMultipartDelimiter(String delimiter, MultiPartStatus dispositionStatus, MultiPartStatus closeDelimiterStatus) { // --AaB03x or --AaB03x-- int readerIndex = undecodedChunk.readerIndex(); try { skipControlCharacters(undecodedChunk); } c...
java
private InterfaceHttpData findMultipartDelimiter(String delimiter, MultiPartStatus dispositionStatus, MultiPartStatus closeDelimiterStatus) { // --AaB03x or --AaB03x-- int readerIndex = undecodedChunk.readerIndex(); try { skipControlCharacters(undecodedChunk); } c...
[ "private", "InterfaceHttpData", "findMultipartDelimiter", "(", "String", "delimiter", ",", "MultiPartStatus", "dispositionStatus", ",", "MultiPartStatus", "closeDelimiterStatus", ")", "{", "// --AaB03x or --AaB03x--", "int", "readerIndex", "=", "undecodedChunk", ".", "readerI...
Find the next Multipart Delimiter @param delimiter delimiter to find @param dispositionStatus the next getStatus if the delimiter is a start @param closeDelimiterStatus the next getStatus if the delimiter is a close delimiter @return the next InterfaceHttpData if any @throws ErrorDataDecoderException
[ "Find", "the", "next", "Multipart", "Delimiter" ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostMultipartRequestDecoder.java#L622-L657
122,861
netty/netty
codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostMultipartRequestDecoder.java
HttpPostMultipartRequestDecoder.cleanMixedAttributes
private void cleanMixedAttributes() { currentFieldAttributes.remove(HttpHeaderValues.CHARSET); currentFieldAttributes.remove(HttpHeaderNames.CONTENT_LENGTH); currentFieldAttributes.remove(HttpHeaderNames.CONTENT_TRANSFER_ENCODING); currentFieldAttributes.remove(HttpHeaderNames.CONTENT_TY...
java
private void cleanMixedAttributes() { currentFieldAttributes.remove(HttpHeaderValues.CHARSET); currentFieldAttributes.remove(HttpHeaderNames.CONTENT_LENGTH); currentFieldAttributes.remove(HttpHeaderNames.CONTENT_TRANSFER_ENCODING); currentFieldAttributes.remove(HttpHeaderNames.CONTENT_TY...
[ "private", "void", "cleanMixedAttributes", "(", ")", "{", "currentFieldAttributes", ".", "remove", "(", "HttpHeaderValues", ".", "CHARSET", ")", ";", "currentFieldAttributes", ".", "remove", "(", "HttpHeaderNames", ".", "CONTENT_LENGTH", ")", ";", "currentFieldAttribu...
Remove all Attributes that should be cleaned between two FileUpload in Mixed mode
[ "Remove", "all", "Attributes", "that", "should", "be", "cleaned", "between", "two", "FileUpload", "in", "Mixed", "mode" ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostMultipartRequestDecoder.java#L975-L981
122,862
netty/netty
codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostMultipartRequestDecoder.java
HttpPostMultipartRequestDecoder.loadDataMultipartStandard
private static boolean loadDataMultipartStandard(ByteBuf undecodedChunk, String delimiter, HttpData httpData) { final int startReaderIndex = undecodedChunk.readerIndex(); final int delimeterLength = delimiter.length(); int index = 0; int lastPosition = startReaderIndex; byte prev...
java
private static boolean loadDataMultipartStandard(ByteBuf undecodedChunk, String delimiter, HttpData httpData) { final int startReaderIndex = undecodedChunk.readerIndex(); final int delimeterLength = delimiter.length(); int index = 0; int lastPosition = startReaderIndex; byte prev...
[ "private", "static", "boolean", "loadDataMultipartStandard", "(", "ByteBuf", "undecodedChunk", ",", "String", "delimiter", ",", "HttpData", "httpData", ")", "{", "final", "int", "startReaderIndex", "=", "undecodedChunk", ".", "readerIndex", "(", ")", ";", "final", ...
Load the field value or file data from a Multipart request @return {@code true} if the last chunk is loaded (boundary delimiter found), {@code false} if need more chunks @throws ErrorDataDecoderException
[ "Load", "the", "field", "value", "or", "file", "data", "from", "a", "Multipart", "request" ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostMultipartRequestDecoder.java#L1296-L1332
122,863
netty/netty
codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostMultipartRequestDecoder.java
HttpPostMultipartRequestDecoder.loadDataMultipart
private static boolean loadDataMultipart(ByteBuf undecodedChunk, String delimiter, HttpData httpData) { if (!undecodedChunk.hasArray()) { return loadDataMultipartStandard(undecodedChunk, delimiter, httpData); } final SeekAheadOptimize sao = new SeekAheadOptimize(undecodedChunk); ...
java
private static boolean loadDataMultipart(ByteBuf undecodedChunk, String delimiter, HttpData httpData) { if (!undecodedChunk.hasArray()) { return loadDataMultipartStandard(undecodedChunk, delimiter, httpData); } final SeekAheadOptimize sao = new SeekAheadOptimize(undecodedChunk); ...
[ "private", "static", "boolean", "loadDataMultipart", "(", "ByteBuf", "undecodedChunk", ",", "String", "delimiter", ",", "HttpData", "httpData", ")", "{", "if", "(", "!", "undecodedChunk", ".", "hasArray", "(", ")", ")", "{", "return", "loadDataMultipartStandard", ...
Load the field value from a Multipart request @return {@code true} if the last chunk is loaded (boundary delimiter found), {@code false} if need more chunks @throws ErrorDataDecoderException
[ "Load", "the", "field", "value", "from", "a", "Multipart", "request" ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostMultipartRequestDecoder.java#L1340-L1381
122,864
netty/netty
codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostMultipartRequestDecoder.java
HttpPostMultipartRequestDecoder.cleanString
private static String cleanString(String field) { int size = field.length(); StringBuilder sb = new StringBuilder(size); for (int i = 0; i < size; i++) { char nextChar = field.charAt(i); switch (nextChar) { case HttpConstants.COLON: case HttpConsta...
java
private static String cleanString(String field) { int size = field.length(); StringBuilder sb = new StringBuilder(size); for (int i = 0; i < size; i++) { char nextChar = field.charAt(i); switch (nextChar) { case HttpConstants.COLON: case HttpConsta...
[ "private", "static", "String", "cleanString", "(", "String", "field", ")", "{", "int", "size", "=", "field", ".", "length", "(", ")", ";", "StringBuilder", "sb", "=", "new", "StringBuilder", "(", "size", ")", ";", "for", "(", "int", "i", "=", "0", ";...
Clean the String from any unallowed character @return the cleaned String
[ "Clean", "the", "String", "from", "any", "unallowed", "character" ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostMultipartRequestDecoder.java#L1388-L1410
122,865
netty/netty
codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostMultipartRequestDecoder.java
HttpPostMultipartRequestDecoder.skipOneLine
private boolean skipOneLine() { if (!undecodedChunk.isReadable()) { return false; } byte nextByte = undecodedChunk.readByte(); if (nextByte == HttpConstants.CR) { if (!undecodedChunk.isReadable()) { undecodedChunk.readerIndex(undecodedChunk.readerI...
java
private boolean skipOneLine() { if (!undecodedChunk.isReadable()) { return false; } byte nextByte = undecodedChunk.readByte(); if (nextByte == HttpConstants.CR) { if (!undecodedChunk.isReadable()) { undecodedChunk.readerIndex(undecodedChunk.readerI...
[ "private", "boolean", "skipOneLine", "(", ")", "{", "if", "(", "!", "undecodedChunk", ".", "isReadable", "(", ")", ")", "{", "return", "false", ";", "}", "byte", "nextByte", "=", "undecodedChunk", ".", "readByte", "(", ")", ";", "if", "(", "nextByte", ...
Skip one empty line @return True if one empty line was skipped
[ "Skip", "one", "empty", "line" ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostMultipartRequestDecoder.java#L1417-L1439
122,866
netty/netty
codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostMultipartRequestDecoder.java
HttpPostMultipartRequestDecoder.splitMultipartHeader
private static String[] splitMultipartHeader(String sb) { ArrayList<String> headers = new ArrayList<String>(1); int nameStart; int nameEnd; int colonEnd; int valueStart; int valueEnd; nameStart = HttpPostBodyUtil.findNonWhitespace(sb, 0); for (nameEnd = na...
java
private static String[] splitMultipartHeader(String sb) { ArrayList<String> headers = new ArrayList<String>(1); int nameStart; int nameEnd; int colonEnd; int valueStart; int valueEnd; nameStart = HttpPostBodyUtil.findNonWhitespace(sb, 0); for (nameEnd = na...
[ "private", "static", "String", "[", "]", "splitMultipartHeader", "(", "String", "sb", ")", "{", "ArrayList", "<", "String", ">", "headers", "=", "new", "ArrayList", "<", "String", ">", "(", "1", ")", ";", "int", "nameStart", ";", "int", "nameEnd", ";", ...
Split one header in Multipart @return an array of String where rank 0 is the name of the header, follows by several values that were separated by ';' or ','
[ "Split", "one", "header", "in", "Multipart" ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostMultipartRequestDecoder.java#L1447-L1485
122,867
netty/netty
codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostMultipartRequestDecoder.java
HttpPostMultipartRequestDecoder.splitMultipartHeaderValues
private static String[] splitMultipartHeaderValues(String svalue) { List<String> values = InternalThreadLocalMap.get().arrayList(1); boolean inQuote = false; boolean escapeNext = false; int start = 0; for (int i = 0; i < svalue.length(); i++) { char c = svalue.charAt(...
java
private static String[] splitMultipartHeaderValues(String svalue) { List<String> values = InternalThreadLocalMap.get().arrayList(1); boolean inQuote = false; boolean escapeNext = false; int start = 0; for (int i = 0; i < svalue.length(); i++) { char c = svalue.charAt(...
[ "private", "static", "String", "[", "]", "splitMultipartHeaderValues", "(", "String", "svalue", ")", "{", "List", "<", "String", ">", "values", "=", "InternalThreadLocalMap", ".", "get", "(", ")", ".", "arrayList", "(", "1", ")", ";", "boolean", "inQuote", ...
Split one header value in Multipart @return an array of String where values that were separated by ';' or ','
[ "Split", "one", "header", "value", "in", "Multipart" ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http/src/main/java/io/netty/handler/codec/http/multipart/HttpPostMultipartRequestDecoder.java#L1491-L1519
122,868
netty/netty
codec-http2/src/main/java/io/netty/handler/codec/http2/InboundHttpToHttp2Adapter.java
InboundHttpToHttp2Adapter.handle
static void handle(ChannelHandlerContext ctx, Http2Connection connection, Http2FrameListener listener, FullHttpMessage message) throws Http2Exception { try { int streamId = getStreamId(connection, message.headers()); Http2Stream stream = connection.stream(st...
java
static void handle(ChannelHandlerContext ctx, Http2Connection connection, Http2FrameListener listener, FullHttpMessage message) throws Http2Exception { try { int streamId = getStreamId(connection, message.headers()); Http2Stream stream = connection.stream(st...
[ "static", "void", "handle", "(", "ChannelHandlerContext", "ctx", ",", "Http2Connection", "connection", ",", "Http2FrameListener", "listener", ",", "FullHttpMessage", "message", ")", "throws", "Http2Exception", "{", "try", "{", "int", "streamId", "=", "getStreamId", ...
control, but there is not yet an API for signaling that.
[ "control", "but", "there", "is", "not", "yet", "an", "API", "for", "signaling", "that", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec-http2/src/main/java/io/netty/handler/codec/http2/InboundHttpToHttp2Adapter.java#L55-L80
122,869
netty/netty
codec/src/main/java/io/netty/handler/codec/compression/Bzip2BlockCompressor.java
Bzip2BlockCompressor.writeSymbolMap
private void writeSymbolMap(ByteBuf out) { Bzip2BitWriter writer = this.writer; final boolean[] blockValuesPresent = this.blockValuesPresent; final boolean[] condensedInUse = new boolean[16]; for (int i = 0; i < condensedInUse.length; i++) { for (int j = 0, k = i << 4; j < ...
java
private void writeSymbolMap(ByteBuf out) { Bzip2BitWriter writer = this.writer; final boolean[] blockValuesPresent = this.blockValuesPresent; final boolean[] condensedInUse = new boolean[16]; for (int i = 0; i < condensedInUse.length; i++) { for (int j = 0, k = i << 4; j < ...
[ "private", "void", "writeSymbolMap", "(", "ByteBuf", "out", ")", "{", "Bzip2BitWriter", "writer", "=", "this", ".", "writer", ";", "final", "boolean", "[", "]", "blockValuesPresent", "=", "this", ".", "blockValuesPresent", ";", "final", "boolean", "[", "]", ...
Write the Huffman symbol to output byte map.
[ "Write", "the", "Huffman", "symbol", "to", "output", "byte", "map", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec/src/main/java/io/netty/handler/codec/compression/Bzip2BlockCompressor.java#L106-L131
122,870
netty/netty
codec/src/main/java/io/netty/handler/codec/compression/Bzip2BlockCompressor.java
Bzip2BlockCompressor.writeRun
private void writeRun(final int value, int runLength) { final int blockLength = this.blockLength; final byte[] block = this.block; blockValuesPresent[value] = true; crc.updateCRC(value, runLength); final byte byteValue = (byte) value; switch (runLength) { ca...
java
private void writeRun(final int value, int runLength) { final int blockLength = this.blockLength; final byte[] block = this.block; blockValuesPresent[value] = true; crc.updateCRC(value, runLength); final byte byteValue = (byte) value; switch (runLength) { ca...
[ "private", "void", "writeRun", "(", "final", "int", "value", ",", "int", "runLength", ")", "{", "final", "int", "blockLength", "=", "this", ".", "blockLength", ";", "final", "byte", "[", "]", "block", "=", "this", ".", "block", ";", "blockValuesPresent", ...
Writes an RLE run to the block array, updating the block CRC and present values array as required. @param value The value to write @param runLength The run length of the value to write
[ "Writes", "an", "RLE", "run", "to", "the", "block", "array", "updating", "the", "block", "CRC", "and", "present", "values", "array", "as", "required", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec/src/main/java/io/netty/handler/codec/compression/Bzip2BlockCompressor.java#L138-L173
122,871
netty/netty
codec/src/main/java/io/netty/handler/codec/compression/Bzip2BlockCompressor.java
Bzip2BlockCompressor.write
boolean write(final int value) { if (blockLength > blockLengthLimit) { return false; } final int rleCurrentValue = this.rleCurrentValue; final int rleLength = this.rleLength; if (rleLength == 0) { this.rleCurrentValue = value; this.rleLength =...
java
boolean write(final int value) { if (blockLength > blockLengthLimit) { return false; } final int rleCurrentValue = this.rleCurrentValue; final int rleLength = this.rleLength; if (rleLength == 0) { this.rleCurrentValue = value; this.rleLength =...
[ "boolean", "write", "(", "final", "int", "value", ")", "{", "if", "(", "blockLength", ">", "blockLengthLimit", ")", "{", "return", "false", ";", "}", "final", "int", "rleCurrentValue", "=", "this", ".", "rleCurrentValue", ";", "final", "int", "rleLength", ...
Writes a byte to the block, accumulating to an RLE run where possible. @param value The byte to write @return {@code true} if the byte was written, or {@code false} if the block is already full
[ "Writes", "a", "byte", "to", "the", "block", "accumulating", "to", "an", "RLE", "run", "where", "possible", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec/src/main/java/io/netty/handler/codec/compression/Bzip2BlockCompressor.java#L180-L204
122,872
netty/netty
codec/src/main/java/io/netty/handler/codec/compression/Bzip2BlockCompressor.java
Bzip2BlockCompressor.write
int write(final ByteBuf buffer, int offset, int length) { int index = buffer.forEachByte(offset, length, writeProcessor); return index == -1 ? length : index - offset; }
java
int write(final ByteBuf buffer, int offset, int length) { int index = buffer.forEachByte(offset, length, writeProcessor); return index == -1 ? length : index - offset; }
[ "int", "write", "(", "final", "ByteBuf", "buffer", ",", "int", "offset", ",", "int", "length", ")", "{", "int", "index", "=", "buffer", ".", "forEachByte", "(", "offset", ",", "length", ",", "writeProcessor", ")", ";", "return", "index", "==", "-", "1"...
Writes an array to the block. @param buffer The buffer to write @param offset The offset within the input data to write from @param length The number of bytes of input data to write @return The actual number of input bytes written. May be less than the number requested, or zero if the block is already full
[ "Writes", "an", "array", "to", "the", "block", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec/src/main/java/io/netty/handler/codec/compression/Bzip2BlockCompressor.java#L214-L217
122,873
netty/netty
codec/src/main/java/io/netty/handler/codec/compression/Bzip2BlockCompressor.java
Bzip2BlockCompressor.close
void close(ByteBuf out) { // If an RLE run is in progress, write it out if (rleLength > 0) { writeRun(rleCurrentValue & 0xff, rleLength); } // Apply a one byte block wrap required by the BWT implementation block[blockLength] = block[0]; // Perform the Burrow...
java
void close(ByteBuf out) { // If an RLE run is in progress, write it out if (rleLength > 0) { writeRun(rleCurrentValue & 0xff, rleLength); } // Apply a one byte block wrap required by the BWT implementation block[blockLength] = block[0]; // Perform the Burrow...
[ "void", "close", "(", "ByteBuf", "out", ")", "{", "// If an RLE run is in progress, write it out", "if", "(", "rleLength", ">", "0", ")", "{", "writeRun", "(", "rleCurrentValue", "&", "0xff", ",", "rleLength", ")", ";", "}", "// Apply a one byte block wrap required ...
Compresses and writes out the block.
[ "Compresses", "and", "writes", "out", "the", "block", "." ]
ba06eafa1c1824bd154f1a380019e7ea2edf3c4c
https://github.com/netty/netty/blob/ba06eafa1c1824bd154f1a380019e7ea2edf3c4c/codec/src/main/java/io/netty/handler/codec/compression/Bzip2BlockCompressor.java#L222-L259
122,874
apache/spark
common/network-common/src/main/java/org/apache/spark/network/server/TransportRequestHandler.java
TransportRequestHandler.processStreamUpload
private void processStreamUpload(final UploadStream req) { assert (req.body() == null); try { RpcResponseCallback callback = new RpcResponseCallback() { @Override public void onSuccess(ByteBuffer response) { respond(new RpcResponse(req.requestId, new NioManagedBuffer(response)));...
java
private void processStreamUpload(final UploadStream req) { assert (req.body() == null); try { RpcResponseCallback callback = new RpcResponseCallback() { @Override public void onSuccess(ByteBuffer response) { respond(new RpcResponse(req.requestId, new NioManagedBuffer(response)));...
[ "private", "void", "processStreamUpload", "(", "final", "UploadStream", "req", ")", "{", "assert", "(", "req", ".", "body", "(", ")", "==", "null", ")", ";", "try", "{", "RpcResponseCallback", "callback", "=", "new", "RpcResponseCallback", "(", ")", "{", "...
Handle a request from the client to upload a stream of data.
[ "Handle", "a", "request", "from", "the", "client", "to", "upload", "a", "stream", "of", "data", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/server/TransportRequestHandler.java#L172-L240
122,875
apache/spark
common/network-common/src/main/java/org/apache/spark/network/server/TransportRequestHandler.java
TransportRequestHandler.respond
private ChannelFuture respond(Encodable result) { SocketAddress remoteAddress = channel.remoteAddress(); return channel.writeAndFlush(result).addListener(future -> { if (future.isSuccess()) { logger.trace("Sent result {} to client {}", result, remoteAddress); } else { logger.error(St...
java
private ChannelFuture respond(Encodable result) { SocketAddress remoteAddress = channel.remoteAddress(); return channel.writeAndFlush(result).addListener(future -> { if (future.isSuccess()) { logger.trace("Sent result {} to client {}", result, remoteAddress); } else { logger.error(St...
[ "private", "ChannelFuture", "respond", "(", "Encodable", "result", ")", "{", "SocketAddress", "remoteAddress", "=", "channel", ".", "remoteAddress", "(", ")", ";", "return", "channel", ".", "writeAndFlush", "(", "result", ")", ".", "addListener", "(", "future", ...
Responds to a single message with some Encodable object. If a failure occurs while sending, it will be logged and the channel closed.
[ "Responds", "to", "a", "single", "message", "with", "some", "Encodable", "object", ".", "If", "a", "failure", "occurs", "while", "sending", "it", "will", "be", "logged", "and", "the", "channel", "closed", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/server/TransportRequestHandler.java#L256-L267
122,876
apache/spark
examples/src/main/java/org/apache/spark/examples/streaming/JavaCustomReceiver.java
JavaCustomReceiver.receive
private void receive() { try { Socket socket = null; BufferedReader reader = null; try { // connect to the server socket = new Socket(host, port); reader = new BufferedReader( new InputStreamReader(socket.getInputStream(), StandardCharsets.UTF_8)); // Un...
java
private void receive() { try { Socket socket = null; BufferedReader reader = null; try { // connect to the server socket = new Socket(host, port); reader = new BufferedReader( new InputStreamReader(socket.getInputStream(), StandardCharsets.UTF_8)); // Un...
[ "private", "void", "receive", "(", ")", "{", "try", "{", "Socket", "socket", "=", "null", ";", "BufferedReader", "reader", "=", "null", ";", "try", "{", "// connect to the server", "socket", "=", "new", "Socket", "(", "host", ",", "port", ")", ";", "read...
Create a socket connection and receive data until receiver is stopped
[ "Create", "a", "socket", "connection", "and", "receive", "data", "until", "receiver", "is", "stopped" ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/examples/src/main/java/org/apache/spark/examples/streaming/JavaCustomReceiver.java#L106-L133
122,877
apache/spark
core/src/main/java/org/apache/spark/api/java/StorageLevels.java
StorageLevels.create
public static StorageLevel create( boolean useDisk, boolean useMemory, boolean useOffHeap, boolean deserialized, int replication) { return StorageLevel.apply(useDisk, useMemory, useOffHeap, deserialized, replication); }
java
public static StorageLevel create( boolean useDisk, boolean useMemory, boolean useOffHeap, boolean deserialized, int replication) { return StorageLevel.apply(useDisk, useMemory, useOffHeap, deserialized, replication); }
[ "public", "static", "StorageLevel", "create", "(", "boolean", "useDisk", ",", "boolean", "useMemory", ",", "boolean", "useOffHeap", ",", "boolean", "deserialized", ",", "int", "replication", ")", "{", "return", "StorageLevel", ".", "apply", "(", "useDisk", ",", ...
Create a new StorageLevel object. @param useDisk saved to disk, if true @param useMemory saved to on-heap memory, if true @param useOffHeap saved to off-heap memory, if true @param deserialized saved as deserialized objects, if true @param replication replication factor
[ "Create", "a", "new", "StorageLevel", "object", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/core/src/main/java/org/apache/spark/api/java/StorageLevels.java#L47-L54
122,878
apache/spark
sql/core/src/main/java/org/apache/spark/sql/execution/vectorized/ColumnVectorUtils.java
ColumnVectorUtils.toBatch
public static ColumnarBatch toBatch( StructType schema, MemoryMode memMode, Iterator<Row> row) { int capacity = 4 * 1024; WritableColumnVector[] columnVectors; if (memMode == MemoryMode.OFF_HEAP) { columnVectors = OffHeapColumnVector.allocateColumns(capacity, schema); } else { columnVe...
java
public static ColumnarBatch toBatch( StructType schema, MemoryMode memMode, Iterator<Row> row) { int capacity = 4 * 1024; WritableColumnVector[] columnVectors; if (memMode == MemoryMode.OFF_HEAP) { columnVectors = OffHeapColumnVector.allocateColumns(capacity, schema); } else { columnVe...
[ "public", "static", "ColumnarBatch", "toBatch", "(", "StructType", "schema", ",", "MemoryMode", "memMode", ",", "Iterator", "<", "Row", ">", "row", ")", "{", "int", "capacity", "=", "4", "*", "1024", ";", "WritableColumnVector", "[", "]", "columnVectors", ";...
Converts an iterator of rows into a single ColumnBatch.
[ "Converts", "an", "iterator", "of", "rows", "into", "a", "single", "ColumnBatch", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/core/src/main/java/org/apache/spark/sql/execution/vectorized/ColumnVectorUtils.java#L208-L229
122,879
apache/spark
common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/ExternalShuffleBlockResolver.java
ExternalShuffleBlockResolver.registerExecutor
public void registerExecutor( String appId, String execId, ExecutorShuffleInfo executorInfo) { AppExecId fullId = new AppExecId(appId, execId); logger.info("Registered executor {} with {}", fullId, executorInfo); if (!knownManagers.contains(executorInfo.shuffleManager)) { throw new U...
java
public void registerExecutor( String appId, String execId, ExecutorShuffleInfo executorInfo) { AppExecId fullId = new AppExecId(appId, execId); logger.info("Registered executor {} with {}", fullId, executorInfo); if (!knownManagers.contains(executorInfo.shuffleManager)) { throw new U...
[ "public", "void", "registerExecutor", "(", "String", "appId", ",", "String", "execId", ",", "ExecutorShuffleInfo", "executorInfo", ")", "{", "AppExecId", "fullId", "=", "new", "AppExecId", "(", "appId", ",", "execId", ")", ";", "logger", ".", "info", "(", "\...
Registers a new Executor with all the configuration we need to find its shuffle files.
[ "Registers", "a", "new", "Executor", "with", "all", "the", "configuration", "we", "need", "to", "find", "its", "shuffle", "files", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/ExternalShuffleBlockResolver.java#L142-L162
122,880
apache/spark
common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/ExternalShuffleBlockResolver.java
ExternalShuffleBlockResolver.applicationRemoved
public void applicationRemoved(String appId, boolean cleanupLocalDirs) { logger.info("Application {} removed, cleanupLocalDirs = {}", appId, cleanupLocalDirs); Iterator<Map.Entry<AppExecId, ExecutorShuffleInfo>> it = executors.entrySet().iterator(); while (it.hasNext()) { Map.Entry<AppExecId, Executor...
java
public void applicationRemoved(String appId, boolean cleanupLocalDirs) { logger.info("Application {} removed, cleanupLocalDirs = {}", appId, cleanupLocalDirs); Iterator<Map.Entry<AppExecId, ExecutorShuffleInfo>> it = executors.entrySet().iterator(); while (it.hasNext()) { Map.Entry<AppExecId, Executor...
[ "public", "void", "applicationRemoved", "(", "String", "appId", ",", "boolean", "cleanupLocalDirs", ")", "{", "logger", ".", "info", "(", "\"Application {} removed, cleanupLocalDirs = {}\"", ",", "appId", ",", "cleanupLocalDirs", ")", ";", "Iterator", "<", "Map", "....
Removes our metadata of all executors registered for the given application, and optionally also deletes the local directories associated with the executors of that application in a separate thread. It is not valid to call registerExecutor() for an executor with this appId after invoking this method.
[ "Removes", "our", "metadata", "of", "all", "executors", "registered", "for", "the", "given", "application", "and", "optionally", "also", "deletes", "the", "local", "directories", "associated", "with", "the", "executors", "of", "that", "application", "in", "a", "...
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/ExternalShuffleBlockResolver.java#L190-L217
122,881
apache/spark
common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/ExternalShuffleBlockResolver.java
ExternalShuffleBlockResolver.executorRemoved
public void executorRemoved(String executorId, String appId) { logger.info("Clean up non-shuffle files associated with the finished executor {}", executorId); AppExecId fullId = new AppExecId(appId, executorId); final ExecutorShuffleInfo executor = executors.get(fullId); if (executor == null) { //...
java
public void executorRemoved(String executorId, String appId) { logger.info("Clean up non-shuffle files associated with the finished executor {}", executorId); AppExecId fullId = new AppExecId(appId, executorId); final ExecutorShuffleInfo executor = executors.get(fullId); if (executor == null) { //...
[ "public", "void", "executorRemoved", "(", "String", "executorId", ",", "String", "appId", ")", "{", "logger", ".", "info", "(", "\"Clean up non-shuffle files associated with the finished executor {}\"", ",", "executorId", ")", ";", "AppExecId", "fullId", "=", "new", "...
Removes all the non-shuffle files in any local directories associated with the finished executor.
[ "Removes", "all", "the", "non", "-", "shuffle", "files", "in", "any", "local", "directories", "associated", "with", "the", "finished", "executor", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/ExternalShuffleBlockResolver.java#L223-L237
122,882
apache/spark
common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/ExternalShuffleBlockResolver.java
ExternalShuffleBlockResolver.deleteExecutorDirs
private void deleteExecutorDirs(String[] dirs) { for (String localDir : dirs) { try { JavaUtils.deleteRecursively(new File(localDir)); logger.debug("Successfully cleaned up directory: {}", localDir); } catch (Exception e) { logger.error("Failed to delete directory: " + localDir, ...
java
private void deleteExecutorDirs(String[] dirs) { for (String localDir : dirs) { try { JavaUtils.deleteRecursively(new File(localDir)); logger.debug("Successfully cleaned up directory: {}", localDir); } catch (Exception e) { logger.error("Failed to delete directory: " + localDir, ...
[ "private", "void", "deleteExecutorDirs", "(", "String", "[", "]", "dirs", ")", "{", "for", "(", "String", "localDir", ":", "dirs", ")", "{", "try", "{", "JavaUtils", ".", "deleteRecursively", "(", "new", "File", "(", "localDir", ")", ")", ";", "logger", ...
Synchronously deletes each directory one at a time. Should be executed in its own thread, as this may take a long time.
[ "Synchronously", "deletes", "each", "directory", "one", "at", "a", "time", ".", "Should", "be", "executed", "in", "its", "own", "thread", "as", "this", "may", "take", "a", "long", "time", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/ExternalShuffleBlockResolver.java#L243-L252
122,883
apache/spark
common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/ExternalShuffleBlockResolver.java
ExternalShuffleBlockResolver.deleteNonShuffleFiles
private void deleteNonShuffleFiles(String[] dirs) { FilenameFilter filter = new FilenameFilter() { @Override public boolean accept(File dir, String name) { // Don't delete shuffle data or shuffle index files. return !name.endsWith(".index") && !name.endsWith(".data"); } }; ...
java
private void deleteNonShuffleFiles(String[] dirs) { FilenameFilter filter = new FilenameFilter() { @Override public boolean accept(File dir, String name) { // Don't delete shuffle data or shuffle index files. return !name.endsWith(".index") && !name.endsWith(".data"); } }; ...
[ "private", "void", "deleteNonShuffleFiles", "(", "String", "[", "]", "dirs", ")", "{", "FilenameFilter", "filter", "=", "new", "FilenameFilter", "(", ")", "{", "@", "Override", "public", "boolean", "accept", "(", "File", "dir", ",", "String", "name", ")", ...
Synchronously deletes non-shuffle files in each directory recursively. Should be executed in its own thread, as this may take a long time.
[ "Synchronously", "deletes", "non", "-", "shuffle", "files", "in", "each", "directory", "recursively", ".", "Should", "be", "executed", "in", "its", "own", "thread", "as", "this", "may", "take", "a", "long", "time", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/ExternalShuffleBlockResolver.java#L258-L275
122,884
apache/spark
common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/ExternalShuffleBlockResolver.java
ExternalShuffleBlockResolver.getSortBasedShuffleBlockData
private ManagedBuffer getSortBasedShuffleBlockData( ExecutorShuffleInfo executor, int shuffleId, int mapId, int reduceId) { File indexFile = getFile(executor.localDirs, executor.subDirsPerLocalDir, "shuffle_" + shuffleId + "_" + mapId + "_0.index"); try { ShuffleIndexInformation shuffleIndexInf...
java
private ManagedBuffer getSortBasedShuffleBlockData( ExecutorShuffleInfo executor, int shuffleId, int mapId, int reduceId) { File indexFile = getFile(executor.localDirs, executor.subDirsPerLocalDir, "shuffle_" + shuffleId + "_" + mapId + "_0.index"); try { ShuffleIndexInformation shuffleIndexInf...
[ "private", "ManagedBuffer", "getSortBasedShuffleBlockData", "(", "ExecutorShuffleInfo", "executor", ",", "int", "shuffleId", ",", "int", "mapId", ",", "int", "reduceId", ")", "{", "File", "indexFile", "=", "getFile", "(", "executor", ".", "localDirs", ",", "execut...
Sort-based shuffle data uses an index called "shuffle_ShuffleId_MapId_0.index" into a data file called "shuffle_ShuffleId_MapId_0.data". This logic is from IndexShuffleBlockResolver, and the block id format is from ShuffleDataBlockId and ShuffleIndexBlockId.
[ "Sort", "-", "based", "shuffle", "data", "uses", "an", "index", "called", "shuffle_ShuffleId_MapId_0", ".", "index", "into", "a", "data", "file", "called", "shuffle_ShuffleId_MapId_0", ".", "data", ".", "This", "logic", "is", "from", "IndexShuffleBlockResolver", "...
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-shuffle/src/main/java/org/apache/spark/network/shuffle/ExternalShuffleBlockResolver.java#L282-L299
122,885
apache/spark
core/src/main/java/org/apache/spark/shuffle/sort/ShuffleInMemorySorter.java
ShuffleInMemorySorter.insertRecord
public void insertRecord(long recordPointer, int partitionId) { if (!hasSpaceForAnotherRecord()) { throw new IllegalStateException("There is no space for new record"); } array.set(pos, PackedRecordPointer.packPointer(recordPointer, partitionId)); pos++; }
java
public void insertRecord(long recordPointer, int partitionId) { if (!hasSpaceForAnotherRecord()) { throw new IllegalStateException("There is no space for new record"); } array.set(pos, PackedRecordPointer.packPointer(recordPointer, partitionId)); pos++; }
[ "public", "void", "insertRecord", "(", "long", "recordPointer", ",", "int", "partitionId", ")", "{", "if", "(", "!", "hasSpaceForAnotherRecord", "(", ")", ")", "{", "throw", "new", "IllegalStateException", "(", "\"There is no space for new record\"", ")", ";", "}"...
Inserts a record to be sorted. @param recordPointer a pointer to the record, encoded by the task memory manager. Due to certain pointer compression techniques used by the sorter, the sort can only operate on pointers that point to locations in the first {@link PackedRecordPointer#MAXIMUM_PAGE_SIZE_BYTES} bytes of a da...
[ "Inserts", "a", "record", "to", "be", "sorted", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/core/src/main/java/org/apache/spark/shuffle/sort/ShuffleInMemorySorter.java#L146-L152
122,886
apache/spark
core/src/main/java/org/apache/spark/shuffle/sort/ShuffleInMemorySorter.java
ShuffleInMemorySorter.getSortedIterator
public ShuffleSorterIterator getSortedIterator() { int offset = 0; if (useRadixSort) { offset = RadixSort.sort( array, pos, PackedRecordPointer.PARTITION_ID_START_BYTE_INDEX, PackedRecordPointer.PARTITION_ID_END_BYTE_INDEX, false, false); } else { MemoryBlock unused = new...
java
public ShuffleSorterIterator getSortedIterator() { int offset = 0; if (useRadixSort) { offset = RadixSort.sort( array, pos, PackedRecordPointer.PARTITION_ID_START_BYTE_INDEX, PackedRecordPointer.PARTITION_ID_END_BYTE_INDEX, false, false); } else { MemoryBlock unused = new...
[ "public", "ShuffleSorterIterator", "getSortedIterator", "(", ")", "{", "int", "offset", "=", "0", ";", "if", "(", "useRadixSort", ")", "{", "offset", "=", "RadixSort", ".", "sort", "(", "array", ",", "pos", ",", "PackedRecordPointer", ".", "PARTITION_ID_START_...
Return an iterator over record pointers in sorted order.
[ "Return", "an", "iterator", "over", "record", "pointers", "in", "sorted", "order", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/core/src/main/java/org/apache/spark/shuffle/sort/ShuffleInMemorySorter.java#L183-L202
122,887
apache/spark
common/network-common/src/main/java/org/apache/spark/network/client/TransportResponseHandler.java
TransportResponseHandler.failOutstandingRequests
private void failOutstandingRequests(Throwable cause) { for (Map.Entry<StreamChunkId, ChunkReceivedCallback> entry : outstandingFetches.entrySet()) { try { entry.getValue().onFailure(entry.getKey().chunkIndex, cause); } catch (Exception e) { logger.warn("ChunkReceivedCallback.onFailure t...
java
private void failOutstandingRequests(Throwable cause) { for (Map.Entry<StreamChunkId, ChunkReceivedCallback> entry : outstandingFetches.entrySet()) { try { entry.getValue().onFailure(entry.getKey().chunkIndex, cause); } catch (Exception e) { logger.warn("ChunkReceivedCallback.onFailure t...
[ "private", "void", "failOutstandingRequests", "(", "Throwable", "cause", ")", "{", "for", "(", "Map", ".", "Entry", "<", "StreamChunkId", ",", "ChunkReceivedCallback", ">", "entry", ":", "outstandingFetches", ".", "entrySet", "(", ")", ")", "{", "try", "{", ...
Fire the failure callback for all outstanding requests. This is called when we have an uncaught exception or pre-mature connection termination.
[ "Fire", "the", "failure", "callback", "for", "all", "outstanding", "requests", ".", "This", "is", "called", "when", "we", "have", "an", "uncaught", "exception", "or", "pre", "-", "mature", "connection", "termination", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/client/TransportResponseHandler.java#L107-L134
122,888
apache/spark
common/network-yarn/src/main/java/org/apache/spark/network/yarn/YarnShuffleService.java
YarnShuffleService.serviceInit
@Override protected void serviceInit(Configuration conf) throws Exception { _conf = conf; boolean stopOnFailure = conf.getBoolean(STOP_ON_FAILURE_KEY, DEFAULT_STOP_ON_FAILURE); try { // In case this NM was killed while there were running spark applications, we need to restore // lost state f...
java
@Override protected void serviceInit(Configuration conf) throws Exception { _conf = conf; boolean stopOnFailure = conf.getBoolean(STOP_ON_FAILURE_KEY, DEFAULT_STOP_ON_FAILURE); try { // In case this NM was killed while there were running spark applications, we need to restore // lost state f...
[ "@", "Override", "protected", "void", "serviceInit", "(", "Configuration", "conf", ")", "throws", "Exception", "{", "_conf", "=", "conf", ";", "boolean", "stopOnFailure", "=", "conf", ".", "getBoolean", "(", "STOP_ON_FAILURE_KEY", ",", "DEFAULT_STOP_ON_FAILURE", "...
Start the shuffle server with the given configuration.
[ "Start", "the", "shuffle", "server", "with", "the", "given", "configuration", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-yarn/src/main/java/org/apache/spark/network/yarn/YarnShuffleService.java#L156-L217
122,889
apache/spark
common/network-yarn/src/main/java/org/apache/spark/network/yarn/YarnShuffleService.java
YarnShuffleService.serviceStop
@Override protected void serviceStop() { try { if (shuffleServer != null) { shuffleServer.close(); } if (transportContext != null) { transportContext.close(); } if (blockHandler != null) { blockHandler.close(); } if (db != null) { db.close(...
java
@Override protected void serviceStop() { try { if (shuffleServer != null) { shuffleServer.close(); } if (transportContext != null) { transportContext.close(); } if (blockHandler != null) { blockHandler.close(); } if (db != null) { db.close(...
[ "@", "Override", "protected", "void", "serviceStop", "(", ")", "{", "try", "{", "if", "(", "shuffleServer", "!=", "null", ")", "{", "shuffleServer", ".", "close", "(", ")", ";", "}", "if", "(", "transportContext", "!=", "null", ")", "{", "transportContex...
Close the shuffle server to clean up any associated state.
[ "Close", "the", "shuffle", "server", "to", "clean", "up", "any", "associated", "state", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-yarn/src/main/java/org/apache/spark/network/yarn/YarnShuffleService.java#L317-L335
122,890
apache/spark
common/network-yarn/src/main/java/org/apache/spark/network/yarn/YarnShuffleService.java
YarnShuffleService.initRecoveryDb
protected File initRecoveryDb(String dbName) { Preconditions.checkNotNull(_recoveryPath, "recovery path should not be null if NM recovery is enabled"); File recoveryFile = new File(_recoveryPath.toUri().getPath(), dbName); if (recoveryFile.exists()) { return recoveryFile; } // db doesn...
java
protected File initRecoveryDb(String dbName) { Preconditions.checkNotNull(_recoveryPath, "recovery path should not be null if NM recovery is enabled"); File recoveryFile = new File(_recoveryPath.toUri().getPath(), dbName); if (recoveryFile.exists()) { return recoveryFile; } // db doesn...
[ "protected", "File", "initRecoveryDb", "(", "String", "dbName", ")", "{", "Preconditions", ".", "checkNotNull", "(", "_recoveryPath", ",", "\"recovery path should not be null if NM recovery is enabled\"", ")", ";", "File", "recoveryFile", "=", "new", "File", "(", "_reco...
Figure out the recovery path and handle moving the DB if YARN NM recovery gets enabled and DB exists in the local dir of NM by old version of shuffle service.
[ "Figure", "out", "the", "recovery", "path", "and", "handle", "moving", "the", "DB", "if", "YARN", "NM", "recovery", "gets", "enabled", "and", "DB", "exists", "in", "the", "local", "dir", "of", "NM", "by", "old", "version", "of", "shuffle", "service", "."...
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-yarn/src/main/java/org/apache/spark/network/yarn/YarnShuffleService.java#L363-L401
122,891
apache/spark
launcher/src/main/java/org/apache/spark/launcher/Main.java
Main.buildCommand
private static List<String> buildCommand( AbstractCommandBuilder builder, Map<String, String> env, boolean printLaunchCommand) throws IOException, IllegalArgumentException { List<String> cmd = builder.buildCommand(env); if (printLaunchCommand) { System.err.println("Spark Command: " + joi...
java
private static List<String> buildCommand( AbstractCommandBuilder builder, Map<String, String> env, boolean printLaunchCommand) throws IOException, IllegalArgumentException { List<String> cmd = builder.buildCommand(env); if (printLaunchCommand) { System.err.println("Spark Command: " + joi...
[ "private", "static", "List", "<", "String", ">", "buildCommand", "(", "AbstractCommandBuilder", "builder", ",", "Map", "<", "String", ",", "String", ">", "env", ",", "boolean", "printLaunchCommand", ")", "throws", "IOException", ",", "IllegalArgumentException", "{...
Prepare spark commands with the appropriate command builder. If printLaunchCommand is set then the commands will be printed to the stderr.
[ "Prepare", "spark", "commands", "with", "the", "appropriate", "command", "builder", ".", "If", "printLaunchCommand", "is", "set", "then", "the", "commands", "will", "be", "printed", "to", "the", "stderr", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/launcher/src/main/java/org/apache/spark/launcher/Main.java#L106-L116
122,892
apache/spark
launcher/src/main/java/org/apache/spark/launcher/Main.java
Main.prepareWindowsCommand
private static String prepareWindowsCommand(List<String> cmd, Map<String, String> childEnv) { StringBuilder cmdline = new StringBuilder(); for (Map.Entry<String, String> e : childEnv.entrySet()) { cmdline.append(String.format("set %s=%s", e.getKey(), e.getValue())); cmdline.append(" && "); } ...
java
private static String prepareWindowsCommand(List<String> cmd, Map<String, String> childEnv) { StringBuilder cmdline = new StringBuilder(); for (Map.Entry<String, String> e : childEnv.entrySet()) { cmdline.append(String.format("set %s=%s", e.getKey(), e.getValue())); cmdline.append(" && "); } ...
[ "private", "static", "String", "prepareWindowsCommand", "(", "List", "<", "String", ">", "cmd", ",", "Map", "<", "String", ",", "String", ">", "childEnv", ")", "{", "StringBuilder", "cmdline", "=", "new", "StringBuilder", "(", ")", ";", "for", "(", "Map", ...
Prepare a command line for execution from a Windows batch script. The method quotes all arguments so that spaces are handled as expected. Quotes within arguments are "double quoted" (which is batch for escaping a quote). This page has more details about quoting and other batch script fun stuff: http://ss64.com/nt/synt...
[ "Prepare", "a", "command", "line", "for", "execution", "from", "a", "Windows", "batch", "script", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/launcher/src/main/java/org/apache/spark/launcher/Main.java#L125-L136
122,893
apache/spark
launcher/src/main/java/org/apache/spark/launcher/Main.java
Main.prepareBashCommand
private static List<String> prepareBashCommand(List<String> cmd, Map<String, String> childEnv) { if (childEnv.isEmpty()) { return cmd; } List<String> newCmd = new ArrayList<>(); newCmd.add("env"); for (Map.Entry<String, String> e : childEnv.entrySet()) { newCmd.add(String.format("%s=%s...
java
private static List<String> prepareBashCommand(List<String> cmd, Map<String, String> childEnv) { if (childEnv.isEmpty()) { return cmd; } List<String> newCmd = new ArrayList<>(); newCmd.add("env"); for (Map.Entry<String, String> e : childEnv.entrySet()) { newCmd.add(String.format("%s=%s...
[ "private", "static", "List", "<", "String", ">", "prepareBashCommand", "(", "List", "<", "String", ">", "cmd", ",", "Map", "<", "String", ",", "String", ">", "childEnv", ")", "{", "if", "(", "childEnv", ".", "isEmpty", "(", ")", ")", "{", "return", "...
Prepare the command for execution from a bash script. The final command will have commands to set up any needed environment variables needed by the child process.
[ "Prepare", "the", "command", "for", "execution", "from", "a", "bash", "script", ".", "The", "final", "command", "will", "have", "commands", "to", "set", "up", "any", "needed", "environment", "variables", "needed", "by", "the", "child", "process", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/launcher/src/main/java/org/apache/spark/launcher/Main.java#L142-L155
122,894
apache/spark
sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/codegen/UnsafeRowWriter.java
UnsafeRowWriter.zeroOutNullBytes
public void zeroOutNullBytes() { for (int i = 0; i < nullBitsSize; i += 8) { Platform.putLong(getBuffer(), startingOffset + i, 0L); } }
java
public void zeroOutNullBytes() { for (int i = 0; i < nullBitsSize; i += 8) { Platform.putLong(getBuffer(), startingOffset + i, 0L); } }
[ "public", "void", "zeroOutNullBytes", "(", ")", "{", "for", "(", "int", "i", "=", "0", ";", "i", "<", "nullBitsSize", ";", "i", "+=", "8", ")", "{", "Platform", ".", "putLong", "(", "getBuffer", "(", ")", ",", "startingOffset", "+", "i", ",", "0L",...
Clears out null bits. This should be called before we write a new row to row buffer.
[ "Clears", "out", "null", "bits", ".", "This", "should", "be", "called", "before", "we", "write", "a", "new", "row", "to", "row", "buffer", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/sql/catalyst/src/main/java/org/apache/spark/sql/catalyst/expressions/codegen/UnsafeRowWriter.java#L99-L103
122,895
apache/spark
common/network-common/src/main/java/org/apache/spark/network/crypto/AuthEngine.java
AuthEngine.challenge
ClientChallenge challenge() throws GeneralSecurityException { this.authNonce = randomBytes(conf.encryptionKeyLength() / Byte.SIZE); SecretKeySpec authKey = generateKey(conf.keyFactoryAlgorithm(), conf.keyFactoryIterations(), authNonce, conf.encryptionKeyLength()); initializeForAuth(conf.cipherTransfor...
java
ClientChallenge challenge() throws GeneralSecurityException { this.authNonce = randomBytes(conf.encryptionKeyLength() / Byte.SIZE); SecretKeySpec authKey = generateKey(conf.keyFactoryAlgorithm(), conf.keyFactoryIterations(), authNonce, conf.encryptionKeyLength()); initializeForAuth(conf.cipherTransfor...
[ "ClientChallenge", "challenge", "(", ")", "throws", "GeneralSecurityException", "{", "this", ".", "authNonce", "=", "randomBytes", "(", "conf", ".", "encryptionKeyLength", "(", ")", "/", "Byte", ".", "SIZE", ")", ";", "SecretKeySpec", "authKey", "=", "generateKe...
Create the client challenge. @return A challenge to be sent the remote side.
[ "Create", "the", "client", "challenge", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/crypto/AuthEngine.java#L84-L98
122,896
apache/spark
common/network-common/src/main/java/org/apache/spark/network/crypto/AuthEngine.java
AuthEngine.respond
ServerResponse respond(ClientChallenge clientChallenge) throws GeneralSecurityException { SecretKeySpec authKey = generateKey(clientChallenge.kdf, clientChallenge.iterations, clientChallenge.nonce, clientChallenge.keyLength); initializeForAuth(clientChallenge.cipher, clientChallenge.nonce, authKey); ...
java
ServerResponse respond(ClientChallenge clientChallenge) throws GeneralSecurityException { SecretKeySpec authKey = generateKey(clientChallenge.kdf, clientChallenge.iterations, clientChallenge.nonce, clientChallenge.keyLength); initializeForAuth(clientChallenge.cipher, clientChallenge.nonce, authKey); ...
[ "ServerResponse", "respond", "(", "ClientChallenge", "clientChallenge", ")", "throws", "GeneralSecurityException", "{", "SecretKeySpec", "authKey", "=", "generateKey", "(", "clientChallenge", ".", "kdf", ",", "clientChallenge", ".", "iterations", ",", "clientChallenge", ...
Validates the client challenge, and create the encryption backend for the channel from the parameters sent by the client. @param clientChallenge The challenge from the client. @return A response to be sent to the client.
[ "Validates", "the", "client", "challenge", "and", "create", "the", "encryption", "backend", "for", "the", "channel", "from", "the", "parameters", "sent", "by", "the", "client", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/crypto/AuthEngine.java#L107-L127
122,897
apache/spark
common/network-common/src/main/java/org/apache/spark/network/crypto/AuthEngine.java
AuthEngine.validate
void validate(ServerResponse serverResponse) throws GeneralSecurityException { byte[] response = validateChallenge(authNonce, serverResponse.response); byte[] expected = rawResponse(challenge); Preconditions.checkArgument(Arrays.equals(expected, response)); byte[] nonce = decrypt(serverResponse.nonce)...
java
void validate(ServerResponse serverResponse) throws GeneralSecurityException { byte[] response = validateChallenge(authNonce, serverResponse.response); byte[] expected = rawResponse(challenge); Preconditions.checkArgument(Arrays.equals(expected, response)); byte[] nonce = decrypt(serverResponse.nonce)...
[ "void", "validate", "(", "ServerResponse", "serverResponse", ")", "throws", "GeneralSecurityException", "{", "byte", "[", "]", "response", "=", "validateChallenge", "(", "authNonce", ",", "serverResponse", ".", "response", ")", ";", "byte", "[", "]", "expected", ...
Validates the server response and initializes the cipher to use for the session. @param serverResponse The response from the server.
[ "Validates", "the", "server", "response", "and", "initializes", "the", "cipher", "to", "use", "for", "the", "session", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/crypto/AuthEngine.java#L134-L148
122,898
apache/spark
common/network-common/src/main/java/org/apache/spark/network/crypto/AuthEngine.java
AuthEngine.validateChallenge
private byte[] validateChallenge(byte[] nonce, byte[] encryptedChallenge) throws GeneralSecurityException { byte[] challenge = decrypt(encryptedChallenge); checkSubArray(appId, challenge, 0); checkSubArray(nonce, challenge, appId.length); return Arrays.copyOfRange(challenge, appId.length + nonce.le...
java
private byte[] validateChallenge(byte[] nonce, byte[] encryptedChallenge) throws GeneralSecurityException { byte[] challenge = decrypt(encryptedChallenge); checkSubArray(appId, challenge, 0); checkSubArray(nonce, challenge, appId.length); return Arrays.copyOfRange(challenge, appId.length + nonce.le...
[ "private", "byte", "[", "]", "validateChallenge", "(", "byte", "[", "]", "nonce", ",", "byte", "[", "]", "encryptedChallenge", ")", "throws", "GeneralSecurityException", "{", "byte", "[", "]", "challenge", "=", "decrypt", "(", "encryptedChallenge", ")", ";", ...
Validates an encrypted challenge as defined in the protocol, and returns the byte array that corresponds to the actual challenge data.
[ "Validates", "an", "encrypted", "challenge", "as", "defined", "in", "the", "protocol", "and", "returns", "the", "byte", "array", "that", "corresponds", "to", "the", "actual", "challenge", "data", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/crypto/AuthEngine.java#L227-L234
122,899
apache/spark
common/network-common/src/main/java/org/apache/spark/network/crypto/AuthEngine.java
AuthEngine.checkSubArray
private void checkSubArray(byte[] test, byte[] data, int offset) { Preconditions.checkArgument(data.length >= test.length + offset); for (int i = 0; i < test.length; i++) { Preconditions.checkArgument(test[i] == data[i + offset]); } }
java
private void checkSubArray(byte[] test, byte[] data, int offset) { Preconditions.checkArgument(data.length >= test.length + offset); for (int i = 0; i < test.length; i++) { Preconditions.checkArgument(test[i] == data[i + offset]); } }
[ "private", "void", "checkSubArray", "(", "byte", "[", "]", "test", ",", "byte", "[", "]", "data", ",", "int", "offset", ")", "{", "Preconditions", ".", "checkArgument", "(", "data", ".", "length", ">=", "test", ".", "length", "+", "offset", ")", ";", ...
Checks that the "test" array is in the data array starting at the given offset.
[ "Checks", "that", "the", "test", "array", "is", "in", "the", "data", "array", "starting", "at", "the", "given", "offset", "." ]
25ee0474f47d9c30d6f553a7892d9549f91071cf
https://github.com/apache/spark/blob/25ee0474f47d9c30d6f553a7892d9549f91071cf/common/network-common/src/main/java/org/apache/spark/network/crypto/AuthEngine.java#L308-L313