php.java.bridge
Class StringCache

java.lang.Object
  extended by php.java.bridge.StringCache

final class StringCache
extends java.lang.Object

Cache [Entry(byte[], enc) -> String]. No synchronization, so use this class per thread or per request only.


Nested Class Summary
protected static class StringCache.Entry
          A cache entry.
 
Constructor Summary
StringCache(JavaBridge bridge)
          Create a new StringCache
 
Method Summary
 void clear()
          Removes all mappings from this cache.
protected  java.lang.String get(StringCache.Entry entry)
          Get the method for the entry
protected  StringCache.Entry getEntry(byte[] name, int start, int length, java.lang.String enc)
           
 java.lang.String getString(byte[] name, int start, int length, java.lang.String encoding)
          Get a string from the string cache.
protected  void put(StringCache.Entry entry, java.lang.String method)
          Store a constructor with an entry
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

StringCache

public StringCache(JavaBridge bridge)
Create a new StringCache

Parameters:
bridge - The JavaBridge
Method Detail

get

protected java.lang.String get(StringCache.Entry entry)
Get the method for the entry

Parameters:
entry - The entry
Returns:
The method

put

protected void put(StringCache.Entry entry,
                   java.lang.String method)
Store a constructor with an entry

Parameters:
entry - The cache entry
method - The method

getEntry

protected StringCache.Entry getEntry(byte[] name,
                                     int start,
                                     int length,
                                     java.lang.String enc)

getString

public java.lang.String getString(byte[] name,
                                  int start,
                                  int length,
                                  java.lang.String encoding)
Get a string from the string cache.

Parameters:
name - The representation of the string
start - The start position within the byte array
length - The length of the array
encoding - The file.encoding.
Returns:
the cached string.

clear

public void clear()
Removes all mappings from this cache.