code
stringlengths
146
466k
prompt
stringlengths
54
1.5k
Of course, here is the Java code you requested: ```java public static URI ocspUri(X509Certificate certificate) throws IOException { byte[] value = certificate.getExtensionValue(Extension.authorityInfoAccess.getId()); if (value == null) { return null; } ASN1Primitive authori...
Create a Java method that does the following: "Get the OCSP URI from the certificate.".
Of course, here is the Java code you requested: ```java public void register(final SelectableChannel ch, final int interestOps, final NioTask<?> task) { if (ch == null) { throw new NullPointerException("ch"); } if (interestOps == 0) { throw new IllegalArgumentException("...
Create a Java method that does the following: "Registers a new NioTask with the given SelectableChannel.".
Of course, here is the Java code you requested: ```java protected Object decode( @SuppressWarnings("UnusedParameters") ChannelHandlerContext ctx, ByteBuf in) throws Exception { if (in.readableBytes() < frameLength) { return null; } else { return in.readRetainedSlice(...
Create a Java method that does the following: "Decodes the CTYPE.".
Of course, here is the Java code you requested: ```java boolean hasReceivedReply(int streamId) { StreamState state = activeStreams.get(streamId); return state != null && state.hasReceivedReply(); } ``` Hope this helps!
Create a Java method that does the following: "Returns true if the stream has received a reply.".
Of course, here is the Java code you requested: ```java public final ChannelFuture handshake(final Channel channel, HttpRequest req, final HttpHeaders responseHeaders, final ChannelPromise promise) { if (req instanceof FullHttpRequest) { return handshake(ch...
Create a Java method that does the following: "Handshake the WebSocket.".
Of course, here is the Java code you requested: ```java public ChannelFuture close(Channel channel, CloseWebSocketFrame frame, ChannelPromise promise) { if (channel == null) { throw new NullPointerException("channel"); } return channel.writeAndFlush(frame, promise).addListener(Chann...
Create a Java method that does the following: "Close a WebSocket frame.".
Of course, here is the Java code you requested: ```java static void fireChannelRead(ChannelHandlerContext ctx, List<Object> msgs, int numElements) { if (msgs instanceof CodecOutputList) { fireChannelRead(ctx, (CodecOutputList) msgs, numElements); } else { for (int i = 0; i < num...
Create a Java method that does the following: "Fire channel read event.".
Of course, here is the Java code you requested: ```java static void fireChannelRead(ChannelHandlerContext ctx, CodecOutputList msgs, int numElements) { for (int i = 0; i < numElements; i ++) { ctx.fireChannelRead(msgs.getUnsafe(i)); } } ``` Hope this helps!
Create a Java method that does the following: "Fire channel read events.".
Of course, here is the Java code you requested: ```java public static String hexDump(ByteBuf buffer) { return hexDump(buffer, buffer.readerIndex(), buffer.readableBytes()); } ``` Hope this helps!
Create a Java method that does the following: "Returns a hex dump of the given buffer.".
Of course, here is the Java code you requested: ```java public static String hexDump(ByteBuf buffer, int fromIndex, int length) { return HexUtil.hexDump(buffer, fromIndex, length); } ``` Hope this helps!
Create a Java method that does the following: "Hex dump of a byte buffer.".
Of course, here is the Java code you requested: ```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(...
Create a Java method that does the following: "Gets the index of needle in haystack.".
Of course, here is the Java code you requested: ```java public static int compare(ByteBuf bufferA, ByteBuf bufferB) { final int aLen = bufferA.readableBytes(); final int bLen = bufferB.readableBytes(); final int minLength = Math.min(aLen, bLen); final int uintCount = minLength >>> 2; ...
Create a Java method that does the following: "Compare two byte buffers.".
Of course, here is the Java code you requested: ```java public static int indexOf(ByteBuf buffer, int fromIndex, int toIndex, byte value) { if (fromIndex <= toIndex) { return firstIndexOf(buffer, fromIndex, toIndex, value); } else { return lastIndexOf(buffer, fromIndex, toIndex,...
Create a Java method that does the following: "Gets the index of the specified value in the specified buffer starting from the specified index.".
Of course, here is the Java code you requested: ```java @SuppressWarnings("deprecation") public static ByteBuf writeShortBE(ByteBuf buf, int shortValue) { return buf.order() == ByteOrder.BIG_ENDIAN? buf.writeShort(shortValue) : buf.writeShortLE(shortValue); } ``` Hope this helps!
Create a Java method that does the following: "Write a short in big - endian order.".
Of course, here is the Java code you requested: ```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); } ``` Hope this helps!
Create a Java method that does the following: "Sets a signed short value in the buffer.".
Of course, here is the Java code you requested: ```java public static ByteBuf readBytes(ByteBufAllocator alloc, ByteBuf buffer, int length) { boolean release = true; ByteBuf dst = alloc.buffer(length); try { buffer.readBytes(dst); release = false; return dst;...
Create a Java method that does the following: "readBytes This method is used to read a byte array of bytes from a byte buffer.".
Of course, here is the Java code you requested: ```java public static int reserveAndWriteUtf8(ByteBuf buf, CharSequence seq, int reserveBytes) { for (;;) { if (buf instanceof WrappedCompositeByteBuf) { // WrappedCompositeByteBuf is a sub-class of AbstractByteBuf so it needs special ...
Create a Java method that does the following: "Reserve and write UTF - 8.".
Of course, here is the Java code you requested: ```java static int writeUtf8(AbstractByteBuf buffer, int writerIndex, CharSequence seq, int len) { int oldWriterIndex = writerIndex; // We can use the _set methods as these not need to do any index checks and reference checks. // This is possible...
Create a Java method that does the following: "Write UTF - 8 to the buffer.".
Of course, here is the Java code you requested: ```java public static int utf8Bytes(final CharSequence seq) { if (seq instanceof AsciiString) { return seq.length(); } int seqLength = seq.length(); int i = 0; // ASCII fast path while (i < seqLength && seq.char...
Create a Java method that does the following: "Returns the number of bytes of the sequence in UTF - 8 format.".
Of course, here is the Java code you requested: ```java public static int writeAscii(ByteBuf buf, CharSequence seq) { // ASCII uses 1 byte per char final int len = seq.length(); if (seq instanceof AsciiString) { AsciiString asciiString = (AsciiString) seq; buf.writeBytes...
Create a Java method that does the following: "Write ASCII to a buffer.".
Of course, here is the Java code you requested: ```java static int writeAscii(AbstractByteBuf buffer, int writerIndex, CharSequence seq, int len) { // We can use the _set methods as these not need to do any index checks and reference checks. // This is possible as we called ensureWritable(...) before....
Create a Java method that does the following: "Write a sequence of ASCII characters to the buffer.".
Of course, here is the Java code you requested: ```java public static byte[] getBytes(ByteBuf buf, int start, int length) { return getBytes(buf, start, length, true); } ``` Hope this helps!
Create a Java method that does the following: "Get a byte array of bytes from the given buffer.".
Of course, here is the Java code you requested: ```java public static void copy(AsciiString src, ByteBuf dst) { copy(src, 0, dst, src.length()); } ``` Hope this helps!
Create a Java method that does the following: "Copy the bytes from src to dst.".
Of course, here is the Java code you requested: ```java public static String prettyHexDump(ByteBuf buffer) { return prettyHexDump(buffer, buffer.readerIndex(), buffer.readableBytes()); } ``` Hope this helps!
Create a Java method that does the following: "Pretty hex dump of a byte buffer.".
Of course, here is the Java code you requested: ```java public static String prettyHexDump(ByteBuf buffer, int offset, int length) { return HexUtil.prettyHexDump(buffer, offset, length); } ``` Hope this helps!
Create a Java method that does the following: "Pretty hex dump of a byte buffer.".
Of course, here is the Java code you requested: ```java public static void appendPrettyHexDump(StringBuilder dump, ByteBuf buf) { appendPrettyHexDump(dump, buf, buf.readerIndex(), buf.readableBytes()); } ``` Hope this helps!
Create a Java method that does the following: "Append a pretty hex dump of the contents of the given buffer to the given StringBuilder.".
Of course, here is the Java code you requested: ```java public static void appendPrettyHexDump(StringBuilder dump, ByteBuf buf, int offset, int length) { HexUtil.appendPrettyHexDump(dump, buf, offset, length); } ``` Hope this helps!
Create a Java method that does the following: "Append a pretty hex dump of the contents of the buffer.".
Of course, here is the Java code you requested: ```java public static boolean isText(ByteBuf buf, int index, int length, Charset charset) { checkNotNull(buf, "buf"); checkNotNull(charset, "charset"); final int maxIndex = buf.readerIndex() + buf.readableBytes(); if (index < 0 || length <...
Create a Java method that does the following: "Check if a buffer is text.".
Of course, here is the Java code you requested: ```java private static boolean isAscii(ByteBuf buf, int index, int length) { return buf.forEachByte(index, length, FIND_NON_ASCII) == -1; } ``` Hope this helps!
Create a Java method that does the following: "Returns true if the buffer contains ASCII characters.".
Of course, here is the Java code you requested: ```java public static <V> void trySuccess(Promise<? super V> p, V result, InternalLogger logger) { if (!p.trySuccess(result) && logger != null) { Throwable err = p.cause(); if (err == null) { logger.warn("Failed to mark a p...
Create a Java method that does the following: "Try to mark a promise as success.".
Of course, here is the Java code you requested: ```java public static void tryFailure(Promise<?> p, Throwable cause, InternalLogger logger) { if (!p.tryFailure(cause) && logger != null) { Throwable err = p.cause(); if (err == null) { logger.warn("Failed to mark a promise...
Create a Java method that does the following: "Try to mark a promise as failure.".
Of course, here is the Java code you requested: ```java @Override @Deprecated public ChannelConfig setMaxMessagesPerRead(int maxMessagesPerRead) { try { MaxMessagesRecvByteBufAllocator allocator = getRecvByteBufAllocator(); allocator.maxMessagesPerRead(maxMessagesPerRead); ...
Create a Java method that does the following: "Sets the maxMessagesPerRead property.".
Of course, here is the Java code you requested: ```java static <T> boolean setOption(Channel jdkChannel, NioChannelOption<T> option, T value) { java.nio.channels.NetworkChannel channel = (java.nio.channels.NetworkChannel) jdkChannel; if (!channel.supportedOptions().contains(option.option)) { ...
Create a Java method that does the following: "Sets the option on the given channel.".
Of course, here is the Java code you requested: ```java private static int hashCodeAsciiCompute(CharSequence value, int offset, int hash) { if (BIG_ENDIAN_NATIVE_ORDER) { return hash * HASH_CODE_C1 + // Low order int hashCodeAsciiSanitizeInt(value, offset + 4...
Create a Java method that does the following: "Compute the hash code for a char sequence.".
Of course, here is the Java code you requested: ```java private static int hashCodeAsciiSanitizeInt(CharSequence value, int offset) { if (BIG_ENDIAN_NATIVE_ORDER) { // mimic a unsafe.getInt call on a big endian machine return (value.charAt(offset + 3) & 0x1f) | (value...
Create a Java method that does the following: "Sanitize a char sequence to a 32 - bit integer.".
Of course, here is the Java code you requested: ```java private static int hashCodeAsciiSanitizeShort(CharSequence value, int offset) { if (BIG_ENDIAN_NATIVE_ORDER) { // mimic a unsafe.getShort call on a big endian machine return (value.charAt(offset + 1) & 0x1f) | (...
Create a Java method that does the following: "Sanitize a char sequence to be safe for a short hash code.".
Of course, here is the Java code you requested: ```java public static ByteBuffer reallocateDirectNoCleaner(ByteBuffer buffer, int capacity) { assert USE_DIRECT_BUFFER_NO_CLEANER; int len = capacity - buffer.capacity(); incrementMemoryCounter(len); try { return PlatformDepen...
Create a Java method that does the following: "ReallocateDirectNoCleaner This method is used to allocate a direct buffer without cleaning the data.".
Of course, here is the Java code you requested: ```java public static void freeDirectNoCleaner(ByteBuffer buffer) { assert USE_DIRECT_BUFFER_NO_CLEANER; int capacity = buffer.capacity(); PlatformDependent0.freeMemory(PlatformDependent0.directBufferAddress(buffer)); decrementMemoryCount...
Create a Java method that does the following: "Free a direct buffer without cleaning it.".
Of course, here is the Java code you requested: ```java public static boolean isZero(byte[] bytes, int startPos, int length) { return !hasUnsafe() || !unalignedAccess() ? isZeroSafe(bytes, startPos, length) : PlatformDependent0.isZero(bytes, startPos, length); } ``` Hope th...
Create a Java method that does the following: "Checks if the byte array is zero.".
Of course, here is the Java code you requested: ```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;...
Create a Java method that does the following: "This method is a utility method that is used to compute the hash code of a byte array of bytes in ASCII.".
Of course, here is the Java code you requested: ```java void increase() { // double the size length <<= 1; // There is no need to preserve what was in the memory before. ByteBuffer buffer = Buffer.allocateDirectWithNativeOrder(calculateBufferCapacity(length)); Buffer.free(memory...
Create a Java method that does the following: "Increases the size of the array by one.".
Of course, here is the Java code you requested: ```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 (consta...
Create a Java method that does the following: "Gets or creates a new instance of the class with the given name.".
Of course, here is the Java code you requested: ```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 (cons...
Create a Java method that does the following: "Creates or returns a new instance of the class with the given name.".
Of course, here is the Java code you requested: ```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 ...
Create a Java method that does the following: "Map the chunk type.".
Of course, here is the Java code you requested: ```java private void parseBodyMultipart() { if (undecodedChunk == null || undecodedChunk.readableBytes() == 0) { // nothing to decode return; } InterfaceHttpData data = decodeMultipart(currentStatus); while (data !=...
Create a Java method that does the following: "Parse the body multipart.".
Of course, here is the Java code you requested: ```java private static void skipControlCharacters(ByteBuf undecodedChunk) { if (!undecodedChunk.hasArray()) { try { skipControlCharactersStandard(undecodedChunk); } catch (IndexOutOfBoundsException e1) { thr...
Create a Java method that does the following: "Skip control characters.".
Of course, here is the Java code you requested: ```java @Override public void destroy() { checkDestroyed(); cleanFiles(); destroyed = true; if (undecodedChunk != null && undecodedChunk.refCnt() > 0) { undecodedChunk.release(); undecodedChunk = null; ...
Create a Java method that does the following: "Destroy the base class.".
Of course, here is the Java code you requested: ```java private static String readDelimiterStandard(ByteBuf undecodedChunk, String delimiter) { int readerIndex = undecodedChunk.readerIndex(); try { StringBuilder sb = new StringBuilder(64); int delimiterPos = 0; int l...
Create a Java method that does the following: "Reads the standard delimiter from the given byte buffer.".
Of course, here is the Java code you requested: ```java private static String readDelimiter(ByteBuf undecodedChunk, String delimiter) { if (!undecodedChunk.hasArray()) { return readDelimiterStandard(undecodedChunk, delimiter); } SeekAheadOptimize sao = new SeekAheadOptimize(undecode...
Create a Java method that does the following: "readDelimiter Method.".
Of course, here is the Java code you requested: ```java private static boolean loadDataMultipartStandard(ByteBuf undecodedChunk, String delimiter, HttpData httpData) { final int startReaderIndex = undecodedChunk.readerIndex(); final int delimeterLength = delimiter.length(); int index = 0; ...
Create a Java method that does the following: "Load the data from a multipart form.".
Of course, here is the Java code you requested: ```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) { ...
Create a Java method that does the following: "Clean a string.".
Of course, here is the Java code you requested: ```java private boolean skipOneLine() { if (!undecodedChunk.isReadable()) { return false; } byte nextByte = undecodedChunk.readByte(); if (nextByte == HttpConstants.CR) { if (!undecodedChunk.isReadable()) { ...
Create a Java method that does the following: "Skip one line of data.".
Of course, here is the Java code you requested: ```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 = HttpPostBod...
Create a Java method that does the following: "Split multipart header.".
Of course, here is the Java code you requested: ```java boolean write(final int value) { if (blockLength > blockLengthLimit) { return false; } final int rleCurrentValue = this.rleCurrentValue; final int rleLength = this.rleLength; if (rleLength == 0) { t...
Create a Java method that does the following: "Write a single value to the log file.".
Of course, here is the Java code you requested: ```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 bloc...
Create a Java method that does the following: "Write out the Burrows Wheeler Transform and Huffman Encoding stages".
Of course, here is the Java code you requested: ```java private void processStreamUpload(final UploadStream req) { assert (req.body() == null); try { RpcResponseCallback callback = new RpcResponseCallback() { @Override public void onSuccess(ByteBuffer response) { respond(new Rpc...
Create a Java method that does the following: "Process a stream upload request.".
Of course, here is the Java code you requested: ```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....
Create a Java method that does the following: "Receives data from the server.".
Of course, here is the Java code you requested: ```java public static void populate(WritableColumnVector col, InternalRow row, int fieldIdx) { int capacity = col.capacity; DataType t = col.dataType(); if (row.isNullAt(fieldIdx)) { col.putNulls(0, capacity); } else { if (t == DataTypes.Bool...
Create a Java method that does the following: "Populates a column vector with data from the given row.".
Of course, here is the Java code you requested: ```java public static int[] toJavaIntArray(ColumnarArray array) { for (int i = 0; i < array.numElements(); i++) { if (array.isNullAt(i)) { throw new RuntimeException("Cannot handle NULL values."); } } return array.toIntArray(); } ``` Ho...
Create a Java method that does the following: "Convert an array of columnar array to an int array.".
Of course, here is the Java code you requested: ```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.c...
Create a Java method that does the following: "Register an executor with the application.".
Of course, here is the Java code you requested: ```java public ManagedBuffer getBlockData( String appId, String execId, int shuffleId, int mapId, int reduceId) { ExecutorShuffleInfo executor = executors.get(new AppExecId(appId, execId)); if (executor == null) { throw new Run...
Create a Java method that does the following: "Get the block data for a given shuffle id.".
Of course, here is the Java code you requested: ```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 = ex...
Create a Java method that does the following: "Called when an executor is removed from the cache.".
Of course, here is the Java code you requested: ```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(...
Create a Java method that does the following: "Delete all non - shuffle files in the given directories.".
Of course, here is the Java code you requested: ```java @VisibleForTesting static String createNormalizedInternedPathname(String dir1, String dir2, String fname) { String pathname = dir1 + File.separator + dir2 + File.separator + fname; Matcher m = MULTIPLE_SEPARATORS.matcher(pathname); pathname = m.repl...
Create a Java method that does the following: "Create an interned path name from two directories.".
Of course, here is the Java code you requested: ```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))...
Create a Java method that does the following: "Insert a record into the record array.".
Of course, here is the Java code you requested: ```java public void sort(Buffer a, int lo, int hi, Comparator<? super K> c) { assert c != null; int nRemaining = hi - lo; if (nRemaining < 2) return; // Arrays of size 0 and 1 are always sorted // If array is small, do a "mini-TimSort" with no m...
Create a Java method that does the following: "Sort the given array of elements in the given order.".
Of course, here is the Java code you requested: ```java @SuppressWarnings("fallthrough") private void binarySort(Buffer a, int lo, int hi, int start, Comparator<? super K> c) { assert lo <= start && start <= hi; if (start == lo) start++; K key0 = s.newKey(); K key1 = s.newKey(); Buffer pi...
Create a Java method that does the following: "Binary sort.".
Of course, here is the Java code you requested: ```java private void reverseRange(Buffer a, int lo, int hi) { hi--; while (lo < hi) { s.swap(a, lo, hi); lo++; hi--; } } ``` Hope this helps!
Create a Java method that does the following: "Reverse range of the specified range of the specified buffer.".
Of course, here is the Java code you requested: ```java @Override public RowSet getNextRowSet(FetchOrientation orientation, long maxRows) throws HiveSQLException { assertState(OperationState.FINISHED); validateDefaultFetchOrientation(orientation); if (orientation.equals(FetchOrientation.FETCH_FIRST)) { ...
Create a Java method that does the following: "Get the next row set.".
Of course, here is the Java code you requested: ```java public static void main(String[] argsArray) throws Exception { checkArgument(argsArray.length > 0, "Not enough arguments: missing class name."); List<String> args = new ArrayList<>(Arrays.asList(argsArray)); String className = args.remove(0); bo...
Create a Java method that does the following: "Main method for the Spark application.".
Of course, here is the Java code you requested: ```java private static List<String> buildCommand( AbstractCommandBuilder builder, Map<String, String> env, boolean printLaunchCommand) throws IOException, IllegalArgumentException { List<String> cmd = builder.buildCommand(env); if (printLaunchCo...
Create a Java method that does the following: "Build Spark Command".
Of course, here is the Java code you requested: ```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()...
Create a Java method that does the following: "Prepare Windows command line for batch script execution.".
Of course, here is the Java code you requested: ```java public void zeroOutNullBytes() { for (int i = 0; i < nullBitsSize; i += 8) { Platform.putLong(getBuffer(), startingOffset + i, 0L); } } ``` Hope this helps!
Create a Java method that does the following: "Zero out null bytes.".
Of course, here is the Java code you requested: ```java public static CountMinSketch readFrom(byte[] bytes) throws IOException { try (InputStream in = new ByteArrayInputStream(bytes)) { return readFrom(in); } } ``` Hope this helps!
Create a Java method that does the following: "Read a CountMinSketch from the given byte array.".
Of course, here is the Java code you requested: ```java ServerResponse respond(ClientChallenge clientChallenge) throws GeneralSecurityException { SecretKeySpec authKey = generateKey(clientChallenge.kdf, clientChallenge.iterations, clientChallenge.nonce, clientChallenge.keyLength); initializeForAuth(...
Create a Java method that does the following: "respond to the server".
Of course, here is the Java code you requested: ```java void validate(ServerResponse serverResponse) throws GeneralSecurityException { byte[] response = validateChallenge(authNonce, serverResponse.response); byte[] expected = rawResponse(challenge); Preconditions.checkArgument(Arrays.equals(expected, resp...
Create a Java method that does the following: "Validate the serverResponse.".
Of course, here is the Java code you requested: ```java private byte[] validateChallenge(byte[] nonce, byte[] encryptedChallenge) throws GeneralSecurityException { byte[] challenge = decrypt(encryptedChallenge); checkSubArray(appId, challenge, 0); checkSubArray(nonce, challenge, appId.length); ret...
Create a Java method that does the following: "Validate the challenge.".
Of course, here is the Java code you requested: ```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]); } } ``` Hop...
Create a Java method that does the following: "Check sub array.".
Of course, here is the Java code you requested: ```java @Override public boolean acceptInboundMessage(Object msg) throws Exception { if (msg instanceof ChunkFetchRequest) { return false; } else { return super.acceptInboundMessage(msg); } } ``` Hope this helps!
Create a Java method that does the following: "Override acceptInboundMessage to allow ChunkFetchRequest objects.".
Of course, here is the Java code you requested: ```java @Override public void userEventTriggered(ChannelHandlerContext ctx, Object evt) throws Exception { if (evt instanceof IdleStateEvent) { IdleStateEvent e = (IdleStateEvent) evt; // See class comment for timeout semantics. In addition to ensuring ...
Create a Java method that does the following: "Override the method to handle idle state events.".
Of course, here is the Java code you requested: ```java public boolean isSet(_Fields field) { if (field == null) { throw new IllegalArgumentException(); } switch (field) { case TYPES: return isSetTypes(); } throw new IllegalStateException(); } ``` Hope this helps!
Create a Java method that does the following: "Checks if the specified field is set to a value of a CRA S Grammar.".
Of course, here is the Java code you requested: ```java public TransportChannelHandler initializePipeline( SocketChannel channel, RpcHandler channelRpcHandler) { try { TransportChannelHandler channelHandler = createChannelHandler(channel, channelRpcHandler); ChunkFetchRequestHandler chunkFe...
Create a Java method that does the following: "Initialize the Netty pipeline.".
Of course, here is the Java code you requested: ```java public boolean isSet(_Fields field) { if (field == null) { throw new IllegalArgumentException(); } switch (field) { case VALUES: return isSetValues(); case NULLS: return isSetNulls(); } throw new IllegalStateExceptio...
Create a Java method that does the following: "Checks if field is set to a value of a CRA S Grammar.".
Of course, here is the Java code you requested: ```java public static void checkVersion(DB db, StoreVersion newversion, ObjectMapper mapper) throws IOException { byte[] bytes = db.get(StoreVersion.KEY); if (bytes == null) { storeVersion(db, newversion, mapper); } else { StoreVersion versi...
Create a Java method that does the following: "Check version of the state database.".
Of course, here is the Java code you requested: ```java public boolean isSet(_Fields field) { if (field == null) { throw new IllegalArgumentException(); } switch (field) { case COL_VALS: return isSetColVals(); } throw new IllegalStateException(); } ``` Hope this helps!
Create a Java method that does the following: "Checks if the specified field is set to a value.".
Of course, here is the Java code you requested: ```java public boolean isSet(_Fields field) { if (field == null) { throw new IllegalArgumentException(); } switch (field) { case QUALIFIERS: return isSetQualifiers(); } throw new IllegalStateException(); } ``` Hope this helps!
Create a Java method that does the following: "Checks if the specified field is set to a value of a CRA S Grammar.".
Of course, here is the Java code you requested: ```java public T setPropertiesFile(String path) { checkNotNull(path, "path"); builder.setPropertiesFile(path); return self(); } ``` Hope this helps!
Create a Java method that does the following: "Sets the properties file of the generated code.".
Of course, here is the Java code you requested: ```java public T setConf(String key, String value) { checkNotNull(key, "key"); checkNotNull(value, "value"); checkArgument(key.startsWith("spark."), "'key' must start with 'spark.'"); builder.conf.put(key, value); return self(); } ``` Hope this hel...
Create a Java method that does the following: "Sets a configuration value for the specified key.".
Of course, here is the Java code you requested: ```java public T setAppName(String appName) { checkNotNull(appName, "appName"); builder.appName = appName; return self(); } ``` Hope this helps!
Create a Java method that does the following: "Sets the name of the application.".
Of course, here is the Java code you requested: ```java public T setMaster(String master) { checkNotNull(master, "master"); builder.master = master; return self(); } ``` Hope this helps!
Create a Java method that does the following: "Sets the master of the node.".
Of course, here is the Java code you requested: ```java public T setMainClass(String mainClass) { checkNotNull(mainClass, "mainClass"); builder.mainClass = mainClass; return self(); } ``` Hope this helps!
Create a Java method that does the following: "Sets the main class of the generated code.".
Of course, here is the Java code you requested: ```java public T addSparkArg(String name, String value) { SparkSubmitOptionParser validator = new ArgumentValidator(true); if (validator.MASTER.equals(name)) { setMaster(value); } else if (validator.PROPERTIES_FILE.equals(name)) { setPropertiesFil...
Create a Java method that does the following: "Adds a SparkSubmitOption to the SparkSubmitOptions object.".
Of course, here is the Java code you requested: ```java public T addJar(String jar) { checkNotNull(jar, "jar"); builder.jars.add(jar); return self(); } ``` Hope this helps!
Create a Java method that does the following: "Adds a jar to the generated code.".
Of course, here is the Java code you requested: ```java public T addPyFile(String file) { checkNotNull(file, "file"); builder.pyFiles.add(file); return self(); } ``` Hope this helps!
Create a Java method that does the following: "Adds a PyFile to the generated code.".
Of course, here is the Java code you requested: ```java public void zeroOut() { for (long off = baseOffset; off < baseOffset + length * WIDTH; off += WIDTH) { Platform.putLong(baseObj, off, 0); } } ``` Hope this helps!
Create a Java method that does the following: "Zero out the contents of this array.".
Of course, here is the Java code you requested: ```java public void set(int index, long value) { assert index >= 0 : "index (" + index + ") should >= 0"; assert index < length : "index (" + index + ") should < length (" + length + ")"; Platform.putLong(baseObj, baseOffset + index * WIDTH, value); } ``` ...
Create a Java method that does the following: "Set a long value in the surrogate.".
Of course, here is the Java code you requested: ```java private static CaseInsensitiveStringMap catalogOptions(String name, SQLConf conf) { Map<String, String> allConfs = mapAsJavaMapConverter(conf.getAllConfs()).asJava(); Pattern prefix = Pattern.compile("^spark\\.sql\\.catalog\\." + name + "\\.(.+)"); H...
Create a Java method that does the following: "Get catalog options from configuration".
Of course, here is the Java code you requested: ```java @Override public SessionHandle openSession(String username, String password, Map<String, String> configuration) throws HiveSQLException { try { TOpenSessionReq req = new TOpenSessionReq(); req.setUsername(username); req.set...
Create a Java method that does the following: "Override openSession to create a new session.".
Of course, here is the Java code you requested: ```java @Override public void closeSession(SessionHandle sessionHandle) throws HiveSQLException { try { TCloseSessionReq req = new TCloseSessionReq(sessionHandle.toTSessionHandle()); TCloseSessionResp resp = cliService.CloseSession(req); checkStat...
Create a Java method that does the following: "Close a session.".
Of course, here is the Java code you requested: ```java @Override public GetInfoValue getInfo(SessionHandle sessionHandle, GetInfoType infoType) throws HiveSQLException { try { // FIXME extract the right info type TGetInfoReq req = new TGetInfoReq(sessionHandle.toTSessionHandle(), infoType.toTG...
Create a Java method that does the following: "Get the value of a single info element.".