code stringlengths 146 466k | prompt stringlengths 54 1.5k |
|---|---|
Of course, here is the Java code you requested:
```java
public static ByteBuf copiedBuffer(byte[] array, int offset, int length) {
if (length == 0) {
return EMPTY_BUFFER;
}
byte[] copy = PlatformDependent.allocateUninitializedArray(length);
System.arraycopy(array, offset, co... | Create a Java method that does the following: "Creates a copy of the specified byte array.". |
Of course, here is the Java code you requested:
```java
public static ByteBuf copiedBuffer(ByteBuffer buffer) {
int length = buffer.remaining();
if (length == 0) {
return EMPTY_BUFFER;
}
byte[] copy = PlatformDependent.allocateUninitializedArray(length);
// Duplicate... | Create a Java method that does the following: "Returns a copy of the given buffer.". |
Of course, here is the Java code you requested:
```java
public static ByteBuf copiedBuffer(byte[]... arrays) {
switch (arrays.length) {
case 0:
return EMPTY_BUFFER;
case 1:
if (arrays[0].length == 0) {
return EMPTY_BUFFER;
} else {
... | Create a Java method that does the following: "Returns a new byte array buffer that contains the contents of the specified byte arrays.". |
Of course, here is the Java code you requested:
```java
public static ByteBuf copiedBuffer(ByteBuf... buffers) {
switch (buffers.length) {
case 0:
return EMPTY_BUFFER;
case 1:
return copiedBuffer(buffers[0]);
}
// Merge the specified buffers into one buf... | Create a Java method that does the following: "Returns a new byte buffer that contains all of the specified buffers.". |
Of course, here is the Java code you requested:
```java
public static ByteBuf copiedBuffer(ByteBuffer... buffers) {
switch (buffers.length) {
case 0:
return EMPTY_BUFFER;
case 1:
return copiedBuffer(buffers[0]);
}
// Merge the specified buffers into one ... | Create a Java method that does the following: "Returns a new byte buffer that contains all of the specified buffers.". |
Of course, here is the Java code you requested:
```java
public static ByteBuf copiedBuffer(CharSequence string, Charset charset) {
if (string == null) {
throw new NullPointerException("string");
}
if (string instanceof CharBuffer) {
return copiedBuffer((CharBuffer) stri... | Create a Java method that does the following: "Returns a copied buffer from the specified string.". |
Of course, here is the Java code you requested:
```java
public static ByteBuf copiedBuffer(
CharSequence string, int offset, int length, Charset charset) {
if (string == null) {
throw new NullPointerException("string");
}
if (length == 0) {
return EMPTY_BUFFE... | Create a Java method that does the following: "This method is a convenience method for copying a CharSequence to a ByteBuf.". |
Of course, here is the Java code you requested:
```java
public static ByteBuf copiedBuffer(char[] array, int offset, int length, Charset charset) {
if (array == null) {
throw new NullPointerException("array");
}
if (length == 0) {
return EMPTY_BUFFER;
}
r... | Create a Java method that does the following: "Create a new byte buffer that wraps the specified char array.". |
Of course, here is the Java code you requested:
```java
public static ByteBuf copyLong(long value) {
ByteBuf buf = buffer(8);
buf.writeLong(value);
return buf;
}
```
Hope this helps! | Create a Java method that does the following: "Create a new 8 - byte big - endian buffer that holds the specified 64 - bit integer.". |
Of course, here is the Java code you requested:
```java
public static ByteBuf copyBoolean(boolean value) {
ByteBuf buf = buffer(1);
buf.writeBoolean(value);
return buf;
}
```
Hope this helps! | Create a Java method that does the following: "Create a new big - endian buffer that holds a single boolean value.". |
Of course, here is the Java code you requested:
```java
public static ByteBuf copyBoolean(boolean... values) {
if (values == null || values.length == 0) {
return EMPTY_BUFFER;
}
ByteBuf buffer = buffer(values.length);
for (boolean v: values) {
buffer.writeBoolean... | Create a Java method that does the following: "Create a new big - endian buffer that holds a sequence of the specified boolean values.". |
Of course, here is the Java code you requested:
```java
public static ByteBuf copyDouble(double value) {
ByteBuf buf = buffer(8);
buf.writeDouble(value);
return buf;
}
```
Hope this helps! | Create a Java method that does the following: "Create a new 8 - byte big - endian buffer that holds a single double value.". |
Of course, here is the Java code you requested:
```java
public static ByteBuf copyDouble(double... values) {
if (values == null || values.length == 0) {
return EMPTY_BUFFER;
}
ByteBuf buffer = buffer(values.length * 8);
for (double v: values) {
buffer.writeDouble... | Create a Java method that does the following: "Create a new big - endian buffer that holds a sequence of doubles.". |
Of course, here is the Java code you requested:
```java
public AddressResolver<InetSocketAddress> asAddressResolver() {
AddressResolver<InetSocketAddress> result = addressResolver;
if (result == null) {
synchronized (this) {
result = addressResolver;
if (resu... | Create a Java method that does the following: "This method returns the address resolver.". |
Of course, here is the Java code you requested:
```java
public WebSocketServerHandshaker newHandshaker(HttpRequest req) {
CharSequence version = req.headers().get(HttpHeaderNames.SEC_WEBSOCKET_VERSION);
if (version != null) {
if (version.equals(WebSocketVersion.V13.toHttpHeaderValue())) {
... | Create a Java method that does the following: "New handshaker implementation.". |
Of course, here is the Java code you requested:
```java
public static ReadOnlyHttp2Headers clientHeaders(boolean validateHeaders,
AsciiString method, AsciiString path,
AsciiString scheme, AsciiString authority,
... | Create a Java method that does the following: "Create a ReadOnlyHttp2Headers instance with the specified headers.". |
Of course, here is the Java code you requested:
```java
public CompositeByteBuf addComponents(boolean increaseWriterIndex, ByteBuf... buffers) {
checkNotNull(buffers, "buffers");
addComponents0(increaseWriterIndex, componentCount, buffers, 0);
consolidateIfNeeded();
return this;
}
`... | Create a Java method that does the following: "Add multiple components to this composite buffer.". |
Of course, here is the Java code you requested:
```java
private int addComponent0(boolean increaseWriterIndex, int cIndex, ByteBuf buffer) {
assert buffer != null;
boolean wasAdded = false;
try {
checkComponentIndex(cIndex);
// No need to consolidate - just add a compon... | Create a Java method that does the following: "Add a component to the list.". |
Of course, here is the Java code you requested:
```java
public CompositeByteBuf addComponents(int cIndex, ByteBuf... buffers) {
checkNotNull(buffers, "buffers");
addComponents0(false, cIndex, buffers, 0);
consolidateIfNeeded();
return this;
}
```
Hope this helps! | Create a Java method that does the following: "Add a sequence of components to this composite buffer.". |
Of course, here is the Java code you requested:
```java
public CompositeByteBuf addComponents(int cIndex, Iterable<ByteBuf> buffers) {
return addComponents(false, cIndex, buffers);
}
```
Hope this helps! | Create a Java method that does the following: "Add a sequence of components to this CompositeByteBuf.". |
Of course, here is the Java code you requested:
```java
public CompositeByteBuf addFlattenedComponents(boolean increaseWriterIndex, ByteBuf buffer) {
checkNotNull(buffer, "buffer");
final int ridx = buffer.readerIndex();
final int widx = buffer.writerIndex();
if (ridx == widx) {
... | Create a Java method that does the following: "Adds all components from the given buffer into this CompositeByteBuf.". |
Of course, here is the Java code you requested:
```java
private CompositeByteBuf addComponents(boolean increaseIndex, int cIndex, Iterable<ByteBuf> buffers) {
if (buffers instanceof ByteBuf) {
// If buffers also implements ByteBuf (e.g. CompositeByteBuf), it has to go to addComponent(ByteBuf).
... | Create a Java method that does the following: "Add components from a list of buffers to this CompositeByteBuf.". |
Of course, here is the Java code you requested:
```java
public CompositeByteBuf removeComponents(int cIndex, int numComponents) {
checkComponentIndex(cIndex, numComponents);
if (numComponents == 0) {
return this;
}
int endIndex = cIndex + numComponents;
boolean need... | Create a Java method that does the following: "Removes the specified number of components from this CompositeByteBuf.". |
Of course, here is the Java code you requested:
```java
public CompositeByteBuf consolidate(int cIndex, int numComponents) {
checkComponentIndex(cIndex, numComponents);
if (numComponents <= 1) {
return this;
}
final int endCIndex = cIndex + numComponents;
final Comp... | Create a Java method that does the following: "Consolidates the specified number of components from this CompositeByteBuf.". |
Of course, here is the Java code you requested:
```java
private static ByteBuf append(ByteBufAllocator allocator, boolean useDirect,
PemEncoded encoded, int count, ByteBuf pem) {
ByteBuf content = encoded.content();
if (pem == null) {
// see the other append() method
... | Create a Java method that does the following: "Append a sequence of bytes to a CRA - CENTID SEGMENT.". |
Of course, here is the Java code you requested:
```java
public static ClassResolver weakCachingResolver(ClassLoader classLoader) {
return new CachingClassResolver(
new ClassLoaderClassResolver(defaultClassLoader(classLoader)),
new WeakReferenceMap<String, Class<?>>(new HashMap<S... | Create a Java method that does the following: "Returns a class resolver that uses the given classloader to cache classes.". |
Of course, here is the Java code you requested:
```java
public static ClassResolver softCachingResolver(ClassLoader classLoader) {
return new CachingClassResolver(
new ClassLoaderClassResolver(defaultClassLoader(classLoader)),
new SoftReferenceMap<String, Class<?>>(new HashMap<S... | Create a Java method that does the following: "Creates a class resolver that uses the default classloader.". |
Of course, here is the Java code you requested:
```java
protected static String[] getMultipartDataBoundary(String contentType) {
// Check if Post using "multipart/form-data; boundary=--89421926422648 [; charset=xxx]"
String[] headerContentType = splitHeaderContentType(contentType);
final String... | Create a Java method that does the following: "Get the multi - part boundary from the content type.". |
Of course, here is the Java code you requested:
```java
public Iterator<V> valueIterator(@SuppressWarnings("unused") K name) {
List<V> empty = Collections.emptyList();
return empty.iterator();
}
```
Hope this helps! | Create a Java method that does the following: "Returns an iterator over the value of the specified key.". |
Of course, here is the Java code you requested:
```java
private ByteBuf buffer(int i) {
ByteBuf b = buffers[i];
return b instanceof Component ? ((Component) b).buf : b;
}
```
Hope this helps! | Create a Java method that does the following: "Get the buffer for the given index.". |
Of course, here is the Java code you requested:
```java
@Deprecated
public static SslContext newServerContext(
File certChainFile, File keyFile, String keyPassword,
Iterable<String> ciphers, Iterable<String> nextProtocols,
long sessionCacheSize, long sessionTimeout) throws SSLEx... | Create a Java method that does the following: "Create a new server context using the specified parameters.". |
Of course, here is the Java code you requested:
```java
@Deprecated
public static SslContext newServerContext(
SslProvider provider, File certChainFile, File keyFile, String keyPassword) throws SSLException {
return newServerContext(provider, certChainFile, keyFile, keyPassword, null, IdentityC... | Create a Java method that does the following: "Create a new server context using the specified provider.". |
Of course, here is the Java code you requested:
```java
@Deprecated
public static SslContext newServerContext(
SslProvider provider,
File certChainFile, File keyFile, String keyPassword,
Iterable<String> ciphers, Iterable<String> nextProtocols,
long sessionCacheSize,... | Create a Java method that does the following: "Create a new server context using the specified provider.". |
Of course, here is the Java code you requested:
```java
@Deprecated
public static SslContext newClientContext(TrustManagerFactory trustManagerFactory) throws SSLException {
return newClientContext(null, null, trustManagerFactory);
}
```
Hope this helps! | Create a Java method that does the following: "Create a new SslContext using the trust manager factory.". |
Of course, here is the Java code you requested:
```java
@Deprecated
public static SslContext newClientContext(
File certChainFile, TrustManagerFactory trustManagerFactory,
Iterable<String> ciphers, Iterable<String> nextProtocols,
long sessionCacheSize, long sessionTimeout) throw... | Create a Java method that does the following: "Create a new SslContext using the Ciphers and Next Protocols.". |
Of course, here is the Java code you requested:
```java
@Deprecated
public static SslContext newClientContext(
File certChainFile, TrustManagerFactory trustManagerFactory,
Iterable<String> ciphers, CipherSuiteFilter cipherFilter, ApplicationProtocolConfig apn,
long sessionCacheS... | Create a Java method that does the following: "Create a new SslContext with the specified parameters.". |
Of course, here is the Java code you requested:
```java
@Deprecated
public static SslContext newClientContext(
SslProvider provider,
File trustCertCollectionFile, TrustManagerFactory trustManagerFactory,
File keyCertChainFile, File keyFile, String keyPassword,
KeyManagerFactory keyM... | Create a Java method that does the following: "Create a new client - side SSL context.". |
Of course, here is the Java code you requested:
```java
public SslHandler newHandler(ByteBufAllocator alloc, Executor delegatedTaskExecutor) {
return newHandler(alloc, startTls, delegatedTaskExecutor);
}
```
Hope this helps! | Create a Java method that does the following: "Create a new SslHandler.". |
Of course, here is the Java code you requested:
```java
@Deprecated
protected static TrustManagerFactory buildTrustManagerFactory(
File certChainFile, TrustManagerFactory trustManagerFactory)
throws NoSuchAlgorithmException, CertificateException, KeyStoreException, IOException {
X50... | Create a Java method that does the following: "Build a trust manager factory from a file.". |
Of course, here is the Java code you requested:
```java
protected String format(ChannelHandlerContext ctx, String eventName, Object arg) {
if (arg instanceof ByteBuf) {
return formatByteBuf(ctx, eventName, (ByteBuf) arg);
} else if (arg instanceof ByteBufHolder) {
return formatB... | Create a Java method that does the following: "Format a message.". |
Of course, here is the Java code you requested:
```java
protected String format(ChannelHandlerContext ctx, String eventName, Object firstArg, Object secondArg) {
if (secondArg == null) {
return formatSimple(ctx, eventName, firstArg);
}
String chStr = ctx.channel().toString();
... | Create a Java method that does the following: "Format a single event.". |
Of course, here is the Java code you requested:
```java
private static String formatByteBuf(ChannelHandlerContext ctx, String eventName, ByteBuf msg) {
String chStr = ctx.channel().toString();
int length = msg.readableBytes();
if (length == 0) {
StringBuilder buf = new StringBuilder... | Create a Java method that does the following: "Format a ByteBuf to be used in a HTTP request.". |
Of course, here is the Java code you requested:
```java
private static List<InterfaceHttpData> formpost(
Bootstrap bootstrap,
String host, int port, URI uriSimple, File file, HttpDataFactory factory,
List<Entry<String, String>> headers) throws Exception {
// XXX /formpost
... | Create a Java method that does the following: "Form post a file to a server.". |
Of course, here is the Java code you requested:
```java
final void clear() {
while (!resolveCache.isEmpty()) {
for (Iterator<Entry<String, Entries>> i = resolveCache.entrySet().iterator(); i.hasNext();) {
Map.Entry<String, Entries> e = i.next();
i.remove();
... | Create a Java method that does the following: "Clear the cache.". |
Of course, here is the Java code you requested:
```java
final boolean clear(String hostname) {
Entries entries = resolveCache.remove(hostname);
return entries != null && entries.clearAndCancel();
}
```
Hope this helps! | Create a Java method that does the following: "Clear the cache for a hostname.". |
Of course, here is the Java code you requested:
```java
public <T> ServerBootstrap childOption(ChannelOption<T> childOption, T value) {
if (childOption == null) {
throw new NullPointerException("childOption");
}
if (value == null) {
synchronized (childOptions) {
... | Create a Java method that does the following: "Sets the value of a childOption.". |
Of course, here is the Java code you requested:
```java
public int nextInt(int least, int bound) {
if (least >= bound) {
throw new IllegalArgumentException();
}
return nextInt(bound - least) + least;
}
```
Hope this helps! | Create a Java method that does the following: "Returns a random number in the range [ least bound ).". |
Of course, here is the Java code you requested:
```java
public boolean add(ByteBuf buf) {
if (count == IOV_MAX) {
// No more room!
return false;
} else if (buf.nioBufferCount() == 1) {
final int len = buf.readableBytes();
if (len == 0) {
r... | Create a Java method that does the following: "Add a buffer to the buffer.". |
Of course, here is the Java code you requested:
```java
public static OpenSslX509KeyManagerFactory newEngineBased(File certificateChain, String password)
throws CertificateException, IOException,
KeyStoreException, NoSuchAlgorithmException, UnrecoverableKeyException {
return newE... | Create a Java method that does the following: "Create an OpenSslX509KeyManagerFactory that will create a new X509KeyManagerFactory using the specified certificate chain and password.". |
Of course, here is the Java code you requested:
```java
public static OpenSslX509KeyManagerFactory newEngineBased(X509Certificate[] certificateChain, String password)
throws CertificateException, IOException,
KeyStoreException, NoSuchAlgorithmException, UnrecoverableKeyException {
... | Create a Java method that does the following: "Create an OpenSslX509KeyManagerFactory that will create a new SSLEngine based X509KeyManagerFactory.". |
Of course, here is the Java code you requested:
```java
public static OpenSslX509KeyManagerFactory newKeyless(X509Certificate... certificateChain)
throws CertificateException, IOException,
KeyStoreException, NoSuchAlgorithmException, UnrecoverableKeyException {
KeyStore store = new Open... | Create a Java method that does the following: "Create a new key factory that will create a new keyless certificate store.". |
Of course, here is the Java code you requested:
```java
public static void removeAll() {
InternalThreadLocalMap threadLocalMap = InternalThreadLocalMap.getIfSet();
if (threadLocalMap == null) {
return;
}
try {
Object v = threadLocalMap.indexedVariable(variablesT... | Create a Java method that does the following: "Removes all the FastThreadLocal objects from the thread local map.". |
Of course, here is the Java code you requested:
```java
@SuppressWarnings("unchecked")
public final V get() {
InternalThreadLocalMap threadLocalMap = InternalThreadLocalMap.get();
Object v = threadLocalMap.indexedVariable(index);
if (v != InternalThreadLocalMap.UNSET) {
return (... | Create a Java method that does the following: "Get the value of the CRA - SECTYPE.". |
Of course, here is the Java code you requested:
```java
@SuppressWarnings("unchecked")
public final V getIfExists() {
InternalThreadLocalMap threadLocalMap = InternalThreadLocalMap.getIfSet();
if (threadLocalMap != null) {
Object v = threadLocalMap.indexedVariable(index);
if... | Create a Java method that does the following: "Gets the value of the SECTYPE variable.". |
Of course, here is the Java code you requested:
```java
public final void set(V value) {
if (value != InternalThreadLocalMap.UNSET) {
InternalThreadLocalMap threadLocalMap = InternalThreadLocalMap.get();
setKnownNotUnset(threadLocalMap, value);
} else {
remove();
... | Create a Java method that does the following: "Sets the value of the class attribute.". |
Of course, here is the Java code you requested:
```java
static InetAddress decodeAddress(DnsRecord record, String name, boolean decodeIdn) {
if (!(record instanceof DnsRawRecord)) {
return null;
}
final ByteBuf content = ((ByteBufHolder) record).content();
final int contentL... | Create a Java method that does the following: "Decode an InetAddress from a DNS record.". |
Of course, here is the Java code you requested:
```java
@UnstableApi
public void setOcspResponse(byte[] response) {
if (!enableOcsp) {
throw new IllegalStateException("OCSP stapling is not enabled");
}
if (clientMode) {
throw new IllegalStateException("Not a server ... | Create a Java method that does the following: "Set the OCSP response.". |
Of course, here is the Java code you requested:
```java
private int writePlaintextData(final ByteBuffer src, int len) {
final int pos = src.position();
final int limit = src.limit();
final int sslWrote;
if (src.isDirect()) {
sslWrote = SSL.writeToSSL(ssl, bufferAddress(src)... | Create a Java method that does the following: "Write plaintext data to the SSL context.". |
Of course, here is the Java code you requested:
```java
private boolean doSSLShutdown() {
if (SSL.isInInit(ssl) != 0) {
// Only try to call SSL_shutdown if we are not in the init state anymore.
// Otherwise we will see 'error:140E0197:SSL routines:SSL_shutdown:shutdown while in init' in... | Create a Java method that does the following: "Do the SSL shutdown.". |
Of course, here is the Java code you requested:
```java
@Override
public final void setEnabledProtocols(String[] protocols) {
if (protocols == null) {
// This is correct from the API docs
throw new IllegalArgumentException();
}
int minProtocolIndex = OPENSSL_OP_NO_PR... | Create a Java method that does the following: "Sets the enabled protocols.". |
Of course, here is the Java code you requested:
```java
private static BitSet validCookieValueOctets() {
BitSet bits = new BitSet();
bits.set(0x21);
for (int i = 0x23; i <= 0x2B; i++) {
bits.set(i);
}
for (int i = 0x2D; i <= 0x3A; i++) {
bits.set(i);
... | Create a Java method that does the following: "validCookieValueOctets This method returns a BitSet of valid cookie value octets.". |
Of course, here is the Java code you requested:
```java
private static BitSet validCookieAttributeValueOctets() {
BitSet bits = new BitSet();
for (int i = 32; i < 127; i++) {
bits.set(i);
}
bits.set(';', false);
return bits;
}
```
Hope this helps! | Create a Java method that does the following: "validCookieAttributeValueOctets This returns a BitSet of valid Cookie Attribute value Octets.". |
Of course, here is the Java code you requested:
```java
private static Object safeDuplicate(Object message) {
if (message instanceof ByteBuf) {
return ((ByteBuf) message).retainedDuplicate();
} else if (message instanceof ByteBufHolder) {
return ((ByteBufHolder) message).retaine... | Create a Java method that does the following: "Safely duplicate a message.". |
Of course, here is the Java code you requested:
```java
private Http2Settings decodeSettings(ChannelHandlerContext ctx, ByteBuf frame) throws Http2Exception {
try {
final Http2Settings decodedSettings = new Http2Settings();
frameReader.readFrame(ctx, frame, new Http2FrameAdapter() {
... | Create a Java method that does the following: "Decodes the settings.". |
Of course, here is the Java code you requested:
```java
private static ByteBuf createSettingsFrame(ChannelHandlerContext ctx, ByteBuf payload) {
ByteBuf frame = ctx.alloc().buffer(FRAME_HEADER_LENGTH + payload.readableBytes());
writeFrameHeader(frame, payload.readableBytes(), SETTINGS, new Http2Flags()... | Create a Java method that does the following: "Creates a settings frame.". |
Of course, here is the Java code you requested:
```java
public static Map<String, Version> identify(ClassLoader classLoader) {
if (classLoader == null) {
classLoader = PlatformDependent.getContextClassLoader();
}
// Collect all properties.
Properties props = new Properties(... | Create a Java method that does the following: "Identify the version information of the current application.". |
Of course, here is the Java code you requested:
```java
public void onHttpClientUpgrade() throws Http2Exception {
if (connection().isServer()) {
throw connectionError(PROTOCOL_ERROR, "Client-side HTTP upgrade requested for a server");
}
if (!prefaceSent()) {
// If the pr... | Create a Java method that does the following: "Called when an HTTP upgrade is received.". |
Of course, here is the Java code you requested:
```java
@Override
public void exceptionCaught(ChannelHandlerContext ctx, Throwable cause) throws Exception {
if (getEmbeddedHttp2Exception(cause) != null) {
// Some exception in the causality chain is an Http2Exception - handle it.
onE... | Create a Java method that does the following: "Override exceptionCaught to handle Http2Exception.". |
Of course, here is the Java code you requested:
```java
@Override
public void closeStreamLocal(Http2Stream stream, ChannelFuture future) {
switch (stream.state()) {
case HALF_CLOSED_LOCAL:
case OPEN:
stream.closeLocalSide();
break;
default... | Create a Java method that does the following: "Close the local side of the stream.". |
Of course, here is the Java code you requested:
```java
private ChannelFuture resetUnknownStream(final ChannelHandlerContext ctx, int streamId, long errorCode,
ChannelPromise promise) {
ChannelFuture future = frameWriter().writeRstStream(ctx, streamId, errorCode, pr... | Create a Java method that does the following: "Reset unknown stream.". |
Of course, here is the Java code you requested:
```java
private CharSequence getSettingsHeaderValue(ChannelHandlerContext ctx) {
ByteBuf buf = null;
ByteBuf encodedBuf = null;
try {
// Get the local settings for the handler.
Http2Settings settings = connectionHandler.dec... | Create a Java method that does the following: "Gets the settings header value.". |
Of course, here is the Java code you requested:
```java
public static boolean isOriginForm(URI uri) {
return uri.getScheme() == null && uri.getSchemeSpecificPart() == null &&
uri.getHost() == null && uri.getAuthority() == null;
}
```
Hope this helps! | Create a Java method that does the following: "Is the URI an origin form of a URI.". |
Of course, here is the Java code you requested:
```java
public static boolean isAsteriskForm(URI uri) {
return "*".equals(uri.getPath()) &&
uri.getScheme() == null && uri.getSchemeSpecificPart() == null &&
uri.getHost() == null && uri.getAuthority() == null && uri.getQuery() == ... | Create a Java method that does the following: "Checks if the URI is a S3 Asterisk form URI.". |
Of course, here is the Java code you requested:
```java
public static boolean isKeepAlive(HttpMessage message) {
return !message.headers().containsValue(HttpHeaderNames.CONNECTION, HttpHeaderValues.CLOSE, true) &&
(message.protocolVersion().isKeepAliveDefault() ||
message.headers... | Create a Java method that does the following: "Check if the given message is a keepalive request.". |
Of course, here is the Java code you requested:
```java
public static void setKeepAlive(HttpMessage message, boolean keepAlive) {
setKeepAlive(message.headers(), message.protocolVersion(), keepAlive);
}
```
Hope this helps! | Create a Java method that does the following: "Sets the keep alive flag on the given message.". |
Of course, here is the Java code you requested:
```java
private static int getWebSocketContentLength(HttpMessage message) {
// WebSocket messages have constant content-lengths.
HttpHeaders h = message.headers();
if (message instanceof HttpRequest) {
HttpRequest req = (HttpRequest) m... | Create a Java method that does the following: "Gets the content length of a web socket message.". |
Of course, here is the Java code you requested:
```java
public static void setTransferEncodingChunked(HttpMessage m, boolean chunked) {
if (chunked) {
m.headers().set(HttpHeaderNames.TRANSFER_ENCODING, HttpHeaderValues.CHUNKED);
m.headers().remove(HttpHeaderNames.CONTENT_LENGTH);
... | Create a Java method that does the following: "Sets the transfer encoding of the message.". |
Of course, here is the Java code you requested:
```java
public static Charset getCharset(CharSequence contentTypeValue) {
if (contentTypeValue != null) {
return getCharset(contentTypeValue, CharsetUtil.ISO_8859_1);
} else {
return CharsetUtil.ISO_8859_1;
}
}
```
Hop... | Create a Java method that does the following: "Get the charset from the content type value.". |
Of course, here is the Java code you requested:
```java
public static Charset getCharset(HttpMessage message, Charset defaultCharset) {
CharSequence contentTypeValue = message.headers().get(HttpHeaderNames.CONTENT_TYPE);
if (contentTypeValue != null) {
return getCharset(contentTypeValue, de... | Create a Java method that does the following: "Gets the charset from the content type header.". |
Of course, here is the Java code you requested:
```java
public static Charset getCharset(CharSequence contentTypeValue, Charset defaultCharset) {
if (contentTypeValue != null) {
CharSequence charsetCharSequence = getCharsetAsSequence(contentTypeValue);
if (charsetCharSequence != null) {... | Create a Java method that does the following: "Gets the charset from the content type value.". |
Of course, here is the Java code you requested:
```java
public static CharSequence getMimeType(CharSequence contentTypeValue) {
if (contentTypeValue == null) {
throw new NullPointerException("contentTypeValue");
}
int indexOfSemicolon = AsciiString.indexOfIgnoreCaseAscii(contentTyp... | Create a Java method that does the following: "Gets the mime type from the content type value.". |
Of course, here is the Java code you requested:
```java
public static String formatHostnameForHttp(InetSocketAddress addr) {
String hostString = NetUtil.getHostname(addr);
if (NetUtil.isValidIpV6Address(hostString)) {
if (!addr.isUnresolved()) {
hostString = NetUtil.toAddres... | Create a Java method that does the following: "Format hostname for http.". |
Of course, here is the Java code you requested:
```java
public AddressResolver<T> getResolver(final EventExecutor executor) {
if (executor == null) {
throw new NullPointerException("executor");
}
if (executor.isShuttingDown()) {
throw new IllegalStateException("executor... | Create a Java method that does the following: "Get a new AddressResolver for the given executor.". |
Of course, here is the Java code you requested:
```java
public void add(Object msg, ChannelPromise promise) {
assert ctx.executor().inEventLoop();
if (msg == null) {
throw new NullPointerException("msg");
}
if (promise == null) {
throw new NullPointerException("p... | Create a Java method that does the following: "Add a message to the queue.". |
Of course, here is the Java code you requested:
```java
public ChannelFuture removeAndWriteAll() {
assert ctx.executor().inEventLoop();
if (isEmpty()) {
return null;
}
ChannelPromise p = ctx.newPromise();
PromiseCombiner combiner = new PromiseCombiner(ctx.executor(... | Create a Java method that does the following: "Removes all pending writes from the queue and writes them to the channel.". |
Of course, here is the Java code you requested:
```java
public void removeAndFail(Throwable cause) {
assert ctx.executor().inEventLoop();
if (cause == null) {
throw new NullPointerException("cause");
}
PendingWrite write = head;
if (write == null) {
retu... | Create a Java method that does the following: "Remove and fail the current exception.". |
Of course, here is the Java code you requested:
```java
public ChannelFuture removeAndWrite() {
assert ctx.executor().inEventLoop();
PendingWrite write = head;
if (write == null) {
return null;
}
Object msg = write.msg;
ChannelPromise promise = write.promise;... | Create a Java method that does the following: "Remove and write the current entry.". |
Of course, here is the Java code you requested:
```java
public ChannelPromise remove() {
assert ctx.executor().inEventLoop();
PendingWrite write = head;
if (write == null) {
return null;
}
ChannelPromise promise = write.promise;
ReferenceCountUtil.safeRelease... | Create a Java method that does the following: "Remove the current entry from the cache.". |
Of course, here is the Java code you requested:
```java
public boolean trimCurrentThreadCache() {
PoolThreadCache cache = threadCache.getIfExists();
if (cache != null) {
cache.trim();
return true;
}
return false;
}
```
Hope this helps! | Create a Java method that does the following: "Trims the current thread cache.". |
Of course, here is the Java code you requested:
```java
public String dumpStats() {
int heapArenasLen = heapArenas == null ? 0 : heapArenas.length;
StringBuilder buf = new StringBuilder(512)
.append(heapArenasLen)
.append(" heap arena(s):")
.append(String... | Create a Java method that does the following: "Dump the stats of the tc_record_type". |
Of course, here is the Java code you requested:
```java
public static SmtpRequest help(String cmd) {
return cmd == null ? HELP_NO_ARG : new DefaultSmtpRequest(SmtpCommand.HELP, cmd);
}
```
Hope this helps! | Create a Java method that does the following: "Returns a new request that will return the help message.". |
Of course, here is the Java code you requested:
```java
public static SmtpRequest vrfy(CharSequence user) {
return new DefaultSmtpRequest(SmtpCommand.VRFY, ObjectUtil.checkNotNull(user, "user"));
}
```
Hope this helps! | Create a Java method that does the following: "Create a new VRFY request.". |
Of course, here is the Java code you requested:
```java
private void optimiseSelectorsAndHuffmanTables(final boolean storeSelectors) {
final char[] mtfBlock = this.mtfBlock;
final byte[] selectors = this.selectors;
final int[][] huffmanCodeLengths = this.huffmanCodeLengths;
final int mt... | Create a Java method that does the following: "Optimise the selectors and huffman tables.". |
Of course, here is the Java code you requested:
```java
private void assignHuffmanCodeSymbols() {
final int[][] huffmanMergedCodeSymbols = this.huffmanMergedCodeSymbols;
final int[][] huffmanCodeLengths = this.huffmanCodeLengths;
final int mtfAlphabetSize = this.mtfAlphabetSize;
final ... | Create a Java method that does the following: "Assigns the Huffman Code Symbols to the Huffman Code Symbols.". |
Of course, here is the Java code you requested:
```java
private void writeSelectorsAndHuffmanTables(ByteBuf out) {
final Bzip2BitWriter writer = this.writer;
final byte[] selectors = this.selectors;
final int totalSelectors = selectors.length;
final int[][] huffmanCodeLengths = this.huf... | Create a Java method that does the following: "Write the selectors and Huffman tables.". |
Of course, here is the Java code you requested:
```java
private void writeBlockData(ByteBuf out) {
final Bzip2BitWriter writer = this.writer;
final int[][] huffmanMergedCodeSymbols = this.huffmanMergedCodeSymbols;
final byte[] selectors = this.selectors;
final char[] mtf = mtfBlock;
... | Create a Java method that does the following: "Write the block data.". |
Of course, here is the Java code you requested:
```java
void encode(ByteBuf out) {
// Create optimised selector list and Huffman tables
generateHuffmanOptimisationSeeds();
for (int i = 3; i >= 0; i--) {
optimiseSelectorsAndHuffmanTables(i == 0);
}
assignHuffmanCodeSy... | Create a Java method that does the following: "Encode the C ++ record set into the given output buffer.". |
Of course, here is the Java code you requested:
```java
public HttpHeaders preflightResponseHeaders() {
if (preflightHeaders.isEmpty()) {
return EmptyHttpHeaders.INSTANCE;
}
final HttpHeaders preflightHeaders = new DefaultHttpHeaders();
for (Entry<CharSequence, Callable<?>> ... | Create a Java method that does the following: "Gets the preflight response headers.". |
Of course, here is the Java code you requested:
```java
public boolean failAndRecycle(Throwable cause) {
ReferenceCountUtil.release(msg);
if (promise != null) {
promise.setFailure(cause);
}
return recycle();
}
```
Hope this helps! | Create a Java method that does the following: "Fail the exception and recycle the result set.". |
Of course, here is the Java code you requested:
```java
public void resumeTransfer() {
final ChannelHandlerContext ctx = this.ctx;
if (ctx == null) {
return;
}
if (ctx.executor().inEventLoop()) {
resumeTransfer0(ctx);
} else {
// let the trans... | Create a Java method that does the following: "Resume the transfer of the current message.". |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.