/** * Converts this string to a byte array. */ public byte[] toByteArray() { return toByteArray(0, length()); }
/** * Converts this string to a byte array. */ public byte[] toByteArray() { return toByteArray(0, length()); }
/** * Converts this string to a byte array. */ public byte[] toByteArray() { return toByteArray(0, length()); }
private static SimpleRequest newLargeRequest() { return SimpleRequest.newBuilder() .setPayload(Payload.newBuilder() .setBody(ByteString.copyFrom(LARGE_PAYLOAD.toByteArray()))) .build(); }
/** * Converts this string to a byte array. */ public byte[] toByteArray() { return toByteArray(0, length()); }
/** * Converts this string to a byte array. */ public byte[] toByteArray() { return toByteArray(0, length()); }
/** * Converts this string to a byte array. */ public byte[] toByteArray() { return toByteArray(0, length()); }
/** * Converts this string to a byte array. */ public byte[] toByteArray() { return toByteArray(0, length()); }
private JsonNode getPayloadFromAsciiString(AsciiString token) throws IOException { AsciiString payload = token.split('.')[1]; return VoxelwindServer.MAPPER.readTree(Base64.getDecoder().decode(payload.toByteArray())); }
public static void writeLELengthAsciiString(ByteBuf buffer, AsciiString string) { Preconditions.checkNotNull(buffer, "buffer"); Preconditions.checkNotNull(string, "string"); buffer.writeIntLE(string.length()); buffer.writeBytes(string.toByteArray()); }
static void augment(HttpClientRequest outbound, Object request) { if(request instanceof BasicAuthorized) { BasicAuthorized basicAuthorized = (BasicAuthorized)request; String encoded = Base64.getEncoder().encodeToString(new AsciiString(basicAuthorized.getClientId()).concat(":").concat(basicAuthorized.getClientSecret()).toByteArray()); outbound.headers().set(AUTHORIZATION, BASIC_PREAMBLE + encoded); } }
private static ByteBuf getCloseDelimiter(ByteBufAllocator allocator, AsciiString boundary) { AsciiString s = DOUBLE_DASH.concat(boundary).concat(DOUBLE_DASH); return allocator.directBuffer(s.length()).writeBytes(s.toByteArray()); }
private static ByteBuf getDelimiter(ByteBufAllocator allocator, AsciiString boundary) { AsciiString s = DOUBLE_DASH.concat(boundary).concat(CRLF); return allocator.directBuffer(s.length()).writeBytes(s.toByteArray()); }
private ByteBuf getHeaders(ByteBufAllocator allocator) { AsciiString s = AsciiString.EMPTY_STRING; for (Map.Entry<String, String> entry : this.headers) { s = s.concat(new AsciiString(entry.getKey())).concat(HEADER_DELIMITER).concat(entry.getValue()).concat(CRLF); } return allocator.directBuffer(s.length()).writeBytes(s.toByteArray()); }
private ByteBuf getData(ByteBufAllocator allocator) { CompositeByteBuf dataBuf = allocator.compositeBuffer(); dataBuf.addComponent(allocator.directBuffer(CRLF.length()).writeBytes(CRLF.toByteArray())); if (this.inputStream != null) { dataBuf.addComponent(getData(allocator, this.inputStream)); } else if (this.source != null) { dataBuf.addComponent(getData(allocator, this.objectMapper, this.source)); } dataBuf.addComponent(allocator.directBuffer(CRLF.length()).writeBytes(CRLF.toByteArray())); return dataBuf.writerIndex(dataBuf.capacity()); }
certData = VoxelwindServer.MAPPER.readTree(packet.getChainData().toByteArray()); } catch (IOException e) { throw new RuntimeException("Certificate JSON can not be read.");