/** Decoded parameters to Map. * @param data the byte[] containing the encoded parameters */ public static void decodeUtf8To(byte[] raw,int offset, int length, MultiMap map) { decodeUtf8To(raw,offset,length,map,new Utf8StringBuilder()); }
/** Put multi valued entry. * @param name The entry key. * @param values The String array of multiple values. * @return The previous value or null. */ public Object putValues(K name, String[] values) { Object list=null; for (int i=0;i<values.length;i++) list=LazyList.add(list,values[i]); return put(name,list); }
/** Copy Stream in to Stream out until EOF or exception. */ public static void copy(InputStream in, OutputStream out) throws IOException { copy(in,out,-1); }
public static Class loadClass(Class loadClass,String name) throws ClassNotFoundException { return loadClass(loadClass,name,false); }
public Object nextElement() throws NoSuchElementException { return nextToken(); }
/** Throw a multiexception. * If this multi exception is empty then no action is taken. If it * contains a any exceptions then this * multi exception is thrown. */ public void ifExceptionThrowMulti() throws MultiException { if (LazyList.size(nested)>0) throw this; }
/** Get the real List from a LazyList. * * @param list A LazyList returned from LazyList.add(Object) * @return The List of added items, which may be an EMPTY_LIST * or a SingletonList. */ public static<E> List<E> getList(Object list) { return getList(list,false); }
/** Encode according to this resource type. * The default implementation calls URI.encodePath(uri) * @param uri * @return String encoded for this resource type. */ public String encode(String uri) { return URIUtil.encodePath(uri); }
public void reset(int minSize) { reset(); if (buf.length<minSize) { buf=new byte[minSize]; } }
public void write(char c) throws IOException { ensureSpareCapacity(1); if (c>=0&&c<=0x7f) _buf[_size++]=(byte)c; else { char[] ca ={c}; writeEncoded(ca,0,1); } }
/** Encode Hashtable with % encoding. */ public String encode() { return encode(StringUtil.__UTF8,false); }
public UrlEncoded(String s) { super(6); decode(s,StringUtil.__UTF8); }
/** * Set the scan interval * @param scanInterval pause between scans in seconds */ public synchronized void setScanInterval(int scanInterval) { this._scanInterval = scanInterval; schedule(); }
public void append(byte[] b,int offset, int length) { int end=offset+length; for (int i=offset; i<end;i++) append(b[i]); }
/** */ public Object clone() { return new UrlEncoded(this); } }
/** Copy Reader to Writer out until EOF or exception. */ public static void copy(Reader in, Writer out) throws IOException { copy(in,out,-1); }
/** Encode Hashtable with % encoding. */ public String encode(String charset) { return encode(charset,false); }
public UrlEncoded(String s, String charset) { super(6); decode(s,charset); }
/** Encode Hashtable with % encoding. * @param equalsForNullValue if True, then an '=' is always used, even * for parameters without a value. e.g. "blah?a=&b=&c=". */ public synchronized String encode(String charset, boolean equalsForNullValue) { return encode(this,charset,equalsForNullValue); }