org.eclipse.jetty.util
类 StringMap

java.lang.Object
  继承者 java.util.AbstractMap
      继承者 org.eclipse.jetty.util.StringMap
所有已实现的接口:
Externalizable, Serializable, Map

public class StringMap
extends AbstractMap
implements Externalizable

Map implementation Optimized for Strings keys.. This String Map has been optimized for mapping small sets of Strings where the most frequently accessed Strings have been put to the map first. It also has the benefit that it can look up entries by substring or sections of char and byte arrays. This can prevent many String objects from being created just to look up in the map. This map is NOT synchronized.

另请参见:
序列化表格

嵌套类摘要
 
从类 java.util.AbstractMap 继承的嵌套类/接口
AbstractMap.SimpleEntry<K,V>, AbstractMap.SimpleImmutableEntry<K,V>
 
从接口 java.util.Map 继承的嵌套类/接口
Map.Entry<K,V>
 
字段摘要
protected static int __HASH_WIDTH
           
protected  HashSet _entrySet
           
protected  boolean _ignoreCase
           
protected  org.eclipse.jetty.util.StringMap.NullEntry _nullEntry
           
protected  Object _nullValue
           
protected  org.eclipse.jetty.util.StringMap.Node _root
           
protected  Set _umEntrySet
           
protected  int _width
           
static boolean CASE_INSENSTIVE
           
 
构造方法摘要
StringMap()
          Constructor.
StringMap(boolean ignoreCase)
          Constructor.
StringMap(boolean ignoreCase, int width)
          Constructor.
 
方法摘要
 void clear()
           
 boolean containsKey(Object key)
           
 Set entrySet()
           
 Object get(Object key)
           
 Object get(String key)
           
 Map.Entry getBestEntry(byte[] key, int offset, int maxLength)
          Get a map entry by byte array key, using as much of the passed key as needed for a match.
 Map.Entry getEntry(char[] key, int offset, int length)
          Get a map entry by char array key.
 Map.Entry getEntry(String key, int offset, int length)
          Get a map entry by substring key.
 int getWidth()
           
 boolean isEmpty()
           
 boolean isIgnoreCase()
           
 Object put(Object key, Object value)
           
 Object put(String key, Object value)
           
 void readExternal(ObjectInput in)
           
 Object remove(Object key)
           
 Object remove(String key)
           
 void setIgnoreCase(boolean ic)
          Set the ignoreCase attribute.
 void setWidth(int width)
          Set the hash width.
 int size()
           
 void writeExternal(ObjectOutput out)
           
 
从类 java.util.AbstractMap 继承的方法
clone, containsValue, equals, hashCode, keySet, putAll, toString, values
 
从类 java.lang.Object 继承的方法
finalize, getClass, notify, notifyAll, wait, wait, wait
 

字段详细信息

CASE_INSENSTIVE

public static final boolean CASE_INSENSTIVE
另请参见:
常量字段值

__HASH_WIDTH

protected static final int __HASH_WIDTH
另请参见:
常量字段值

_width

protected int _width

_root

protected org.eclipse.jetty.util.StringMap.Node _root

_ignoreCase

protected boolean _ignoreCase

_nullEntry

protected org.eclipse.jetty.util.StringMap.NullEntry _nullEntry

_nullValue

protected Object _nullValue

_entrySet

protected HashSet _entrySet

_umEntrySet

protected Set _umEntrySet
构造方法详细信息

StringMap

public StringMap()
Constructor.


StringMap

public StringMap(boolean ignoreCase)
Constructor.

参数:
ignoreCase -

StringMap

public StringMap(boolean ignoreCase,
                 int width)
Constructor.

参数:
ignoreCase -
width - Width of hash tables, larger values are faster but use more memory.
方法详细信息

setIgnoreCase

public void setIgnoreCase(boolean ic)
Set the ignoreCase attribute.

参数:
ic - If true, the map is case insensitive for keys.

isIgnoreCase

public boolean isIgnoreCase()

setWidth

public void setWidth(int width)
Set the hash width.

参数:
width - Width of hash tables, larger values are faster but use more memory.

getWidth

public int getWidth()

put

public Object put(Object key,
                  Object value)
指定者:
接口 Map 中的 put
覆盖:
AbstractMap 中的 put

put

public Object put(String key,
                  Object value)

get

public Object get(Object key)
指定者:
接口 Map 中的 get
覆盖:
AbstractMap 中的 get

get

public Object get(String key)

getEntry

public Map.Entry getEntry(String key,
                          int offset,
                          int length)
Get a map entry by substring key.

参数:
key - String containing the key
offset - Offset of the key within the String.
length - The length of the key
返回:
The Map.Entry for the key or null if the key is not in the map.

getEntry

public Map.Entry getEntry(char[] key,
                          int offset,
                          int length)
Get a map entry by char array key.

参数:
key - char array containing the key
offset - Offset of the key within the array.
length - The length of the key
返回:
The Map.Entry for the key or null if the key is not in the map.

getBestEntry

public Map.Entry getBestEntry(byte[] key,
                              int offset,
                              int maxLength)
Get a map entry by byte array key, using as much of the passed key as needed for a match. A simple 8859-1 byte to char mapping is assumed.

参数:
key - char array containing the key
offset - Offset of the key within the array.
maxLength - The length of the key
返回:
The Map.Entry for the key or null if the key is not in the map.

remove

public Object remove(Object key)
指定者:
接口 Map 中的 remove
覆盖:
AbstractMap 中的 remove

remove

public Object remove(String key)

entrySet

public Set entrySet()
指定者:
接口 Map 中的 entrySet
指定者:
AbstractMap 中的 entrySet

size

public int size()
指定者:
接口 Map 中的 size
覆盖:
AbstractMap 中的 size

isEmpty

public boolean isEmpty()
指定者:
接口 Map 中的 isEmpty
覆盖:
AbstractMap 中的 isEmpty

containsKey

public boolean containsKey(Object key)
指定者:
接口 Map 中的 containsKey
覆盖:
AbstractMap 中的 containsKey

clear

public void clear()
指定者:
接口 Map 中的 clear
覆盖:
AbstractMap 中的 clear

writeExternal

public void writeExternal(ObjectOutput out)
                   throws IOException
指定者:
接口 Externalizable 中的 writeExternal
抛出:
IOException

readExternal

public void readExternal(ObjectInput in)
                  throws IOException,
                         ClassNotFoundException
指定者:
接口 Externalizable 中的 readExternal
抛出:
IOException
ClassNotFoundException


Copyright © 2013. All Rights Reserved.