/** * Create a new ByteBuffer using provided byte array. * * @param array * the byte array to back buffer with. * @return ByteBuffer with provided byte array, in flush mode */ public static ByteBuffer toBuffer(byte[] array) { if (array == null) return EMPTY_BUFFER; return toBuffer(array, 0, array.length); }
public static ByteBuffer toBuffer(String s) { return toBuffer(s, StandardCharsets.ISO_8859_1); }
public static ByteBuffer toBuffer(String s, Charset charset) { if (s == null) return EMPTY_BUFFER; return toBuffer(s.getBytes(charset)); }
HttpScheme(String s) { _string=s; _buffer=BufferUtil.toBuffer(s); }
HttpScheme(String s) { _string=s; _buffer=BufferUtil.toBuffer(s); }
HttpHeaderValue(String s) { _string=s; _buffer=BufferUtil.toBuffer(s); }
HttpHeaderValue(String s) { _string=s; _buffer=BufferUtil.toBuffer(s); }
HttpScheme(String s) { _string=s; _buffer=BufferUtil.toBuffer(s); }
/** * @param input the input bytes * @param outputSize the output size */ public ByteArrayEndPoint(byte[] input, int outputSize) { this(null,0,input!=null?BufferUtil.toBuffer(input):null,BufferUtil.allocate(outputSize)); }
/** * @param input the input string (converted to bytes using default encoding charset) * @param outputSize the output size */ public ByteArrayEndPoint(String input, int outputSize) { this(null,0,input!=null?BufferUtil.toBuffer(input):null,BufferUtil.allocate(outputSize)); }
/** * */ public ByteArrayEndPoint(byte[] input, int outputSize) { this(null,0,input!=null?BufferUtil.toBuffer(input):null,BufferUtil.allocate(outputSize)); }
/** * */ public ByteArrayEndPoint(String input, int outputSize) { this(null,0,input!=null?BufferUtil.toBuffer(input):null,BufferUtil.allocate(outputSize)); }
public WebSocketFrame setPayload(String str) { setPayload(BufferUtil.toBuffer(str,StringUtil.__UTF8_CHARSET)); return this; }
/** * Execute a request and return the EndPoint through which * responses can be received. * @param rawRequest the request * @return the local endpoint */ public LocalEndPoint executeRequest(String rawRequest) { return executeRequest(BufferUtil.toBuffer(rawRequest,StringUtil.__UTF8_CHARSET)); }
/** * Execute a request and return the EndPoint through which * responses can be received. * @param rawRequest the request * @return the local endpoint */ public LocalEndPoint executeRequest(String rawRequest) { return executeRequest(BufferUtil.toBuffer(rawRequest, StandardCharsets.UTF_8)); }
Type(String s) { _string=s; _buffer=BufferUtil.toBuffer(s); _base=this; _charset=null; _charsetString=null; _assumedCharset=false; _field=new PreEncodedHttpField(HttpHeader.CONTENT_TYPE,_string); }
Type(String s,Type base) { _string=s; _buffer=BufferUtil.toBuffer(s); _base=base; int i=s.indexOf(";charset="); _charset=Charset.forName(s.substring(i+9)); _charsetString=_charset.toString().toLowerCase(Locale.ENGLISH); _assumedCharset=false; _field=new PreEncodedHttpField(HttpHeader.CONTENT_TYPE,_string); }
Type(String s,Charset cs) { _string=s; _base=this; _buffer=BufferUtil.toBuffer(s); _charset=cs; _charsetString=_charset==null?null:_charset.toString().toLowerCase(Locale.ENGLISH); _assumedCharset=true; _field=new PreEncodedHttpField(HttpHeader.CONTENT_TYPE,_string); }
public ByteArrayEndPoint(Scheduler timer, long idleTimeoutMs, byte[] input, int outputSize) { this(timer,idleTimeoutMs,input!=null?BufferUtil.toBuffer(input):null,BufferUtil.allocate(outputSize)); }
public static Response parseResponse(String response) { Response r=new Response(); HttpParser parser =new HttpParser(r); parser.parseNext(BufferUtil.toBuffer(response)); return r; }