Gets a value and converts it to a Byte.

@param key the value to get
@return the Byte value, or null if the value is missing or cannot be converted
764912
public Byte getAsByte(String key) {
        Object value = mValues.get(key);
        try {
            return value != null ? ((Number) value).byteValue() : null;
        } catch (ClassCastException e) {
            if (value instanceof CharSequence) {
                try {
                    return Byte.valueOf(value.toString());
                } catch (NumberFormatException e2) {
                    logger.severe("Cannot parse Byte value for " + value + " at key " + key);
                    return null;
                }
            } else {
                logger.log(Level.SEVERE, "Cannot cast value for " + key + " to a Byte: " + value, e);
                return null;
            }
        }
    }
1302275
public String get(final String key) {
        final Collection<Argument> args = map.get(key);
        if (args != null) {
            return args.iterator().hasNext() ? args.iterator().next().getValue() : null;
        }
        return null;
    }
185468
@Override
    public V get(Object key) {
        final int index = key == null ? indexOfNull() : indexOf(key, key.hashCode());
        return index >= 0 ? (V)mArray[(index<<1)+1] : null;
    }
701255
public <T> T get(String key, T defaultValue) {
        if (map.containsKey(key)) {
            Object value = map.get(key);
            return (T)(value instanceof byte[] ? unmarshall((byte[])value) : value);
        }
        return defaultValue;
    }
234857
public Date getDate(String key) {
    	String value = get(key);
        Date result = Utils.isEmpty(value)  ? null : Utils.dateFromString(value);
    	return result;
    }
30829
public long getCapacityBytesOnTiersOrThrow(
      java.lang.String key) {
    if (key == null) { throw new java.lang.NullPointerException(); }
    java.util.Map<java.lang.String, java.lang.Long> map =
        internalGetCapacityBytesOnTiers().getMap();
    if (!map.containsKey(key)) {
      throw new java.lang.IllegalArgumentException();
    }
    return map.get(key);
  }
205238
private static byte[] convertKeyToByteArray(String key) {
        byte[] result = new byte[key.length()];
        for (int i = 0; i < result.length; i++) {
            char thisChar = key.charAt(i);
            result[i] = (byte) (thisChar >>> 8 & 0xFF ^ thisChar & 0xFF);
        }
        return result;
    }
50469
@Override
    public <T> T getValue(String key) {
        ValueObject vo = get(key);
        if (null == vo) {
            return null;
        }
        return vo.value();
    }
680736
public T get(final int key) {
		int index = ((key & 0x7FFFFFFF) % elementKeys.length);

		long m = elementKeys[index];
		if (key == m) {
			return elementValues[index];
		}

		return null;
	}
921383
public byte[] getBytes(int key)
    {
        Object value = map.get(key);
        if (value == null)
        {
            return null;
        }
        if (!(value instanceof byte[]))
        {
            return null;
        }
        byte data[] = (byte[])value;
        return data;
    }

    /**
     * Convenience method that returns the value of the given option
     * as a string. The byte array for the specified option will be
     * obtained and converted into a string. Returns <code>null</code> if
     * the specified option is unknown or not a <code>byte[]</code> value.
     *
     * @param key An option identifier
     * @return The option value
     */
    public String getString(int key)
    {
        byte data[] = getBytes(key);
        if (data == null)
        {
            return null;
        }
        return createString(data);
    }

    /**
     * Converts the given byte array into a String. The characters
     * of the given data are connected to a String, until a
     * terminating '\0' character is encountered.
     *
     * @param data The byte array
     * @return The String
     */
    private static String createString(byte data[])
    {
        StringBuilder sb = new StringBuilder();
        for (int i=0; i<data.length; i++)
        {
            if (data[i] == 0)
            {
                break;
            }
            sb.append((char)data[i]);
        }
        String result = sb.toString();
        return result;
    }


    /**
     * Returns a String representation of this object.
     *
     * @return A String representation of this object.
     */
    @Override
    public String toString()
    {
        return "JITOptions["+createString(",")+"]";
        //return toFormattedString();
    }

    /**
     * Creates and returns a formatted (aligned, multi-line) String
     * representation of this object
     *
     * @return A formatted String representation of this object
     */
    public String toFormattedString()
    {
        return "JITOptions:\n    "+createString("\n    ");
    }

    /**
     * Creates and returns a string representation of this object,
     * using the given separator for the options
     *
     * @return A String representation of this object
     */
    private String createString(String f)
    {
        StringBuffer sb = new StringBuffer();
        int keys[] = getKeys();
        for (int i=0; i<keys.length; i++)
        {
            int key = keys[i];
            sb.append(CUjit_option.stringFor(key)+"=");
            Object value = map.get(key);
            if (value instanceof byte[])
            {
                byte data[] = (byte[])value;
                sb.append(createString(data));
            }
            else
            {
                sb.append(String.valueOf(value));
            }
            if (i<keys.length-1)
            {
                sb.append(f);
            }
        }
        return sb.toString();
    }
751826
public long getUsedBytesOnTiersOrThrow(
      java.lang.String key) {
    if (key == null) { throw new java.lang.NullPointerException(); }
    java.util.Map<java.lang.String, java.lang.Long> map =
        internalGetUsedBytesOnTiers().getMap();
    if (!map.containsKey(key)) {
      throw new java.lang.IllegalArgumentException();
    }
    return map.get(key);
  }
239154
@Override
    public Blob getBlob(@NonNull String key) {
        if (key == null) { throw new IllegalArgumentException("key cannot be null."); }

        synchronized (lock) {
            final Object obj = getMValue(internalDict, key).asNative(internalDict);
            return obj instanceof Blob ? (Blob) obj : null;
        }
    }
273327
public Object get(String key) {
		try {
			return getString(key, null);
		} catch (ClassCastException e) {
			try {
				return getInt(key, 0);
			} catch (ClassCastException e1) {
				try {
					return getLong(key, 0);
				} catch (ClassCastException e2) {
					try {
						return getFloat(key, 0f);
					} catch (ClassCastException e3) {
						try {
							return getBoolean(key, false);
						} catch (Exception e4) {
							e.printStackTrace();
						}
					}

				}

			}
		}
		return null;
	}
651249
public static byte[] decode(String key) {
		return Validator.isHex(key) ? HexUtil.decodeHex(key) : Base64.decode(key);
	}
1197696
public T get(String key) {

        Object ramResult = null;
        String diskResult = null;
        DiskLruCache.Snapshot snapshotObject = null;

        // Try to get the object from RAM.
        boolean isRamSerialized = ramMode.equals(DualCacheRamMode.ENABLE_WITH_SPECIFIC_SERIALIZER);
        boolean isRamReferenced = ramMode.equals(DualCacheRamMode.ENABLE_WITH_REFERENCE);
        if (isRamSerialized || isRamReferenced) {
            ramResult = ramCacheLru.get(key);
        }

        if (ramResult == null) {
            // Try to get the cached object from disk.
            loggerHelper.logEntryForKeyIsNotInRam(key);
            if (diskMode.equals(DualCacheDiskMode.ENABLE_WITH_SPECIFIC_SERIALIZER)) {
                try {
                    dualCacheLock.lockDiskEntryWrite(key);
                    snapshotObject = diskLruCache.get(key);
                } catch (IOException e) {
                    logger.logError(e);
                } finally {
                    dualCacheLock.unLockDiskEntryWrite(key);
                }

                if (snapshotObject != null) {
                    loggerHelper.logEntryForKeyIsOnDisk(key);
                    try {
                        diskResult = snapshotObject.getString(0);
                    } catch (IOException e) {
                        logger.logError(e);
                    }
                } else {
                    loggerHelper.logEntryForKeyIsNotOnDisk(key);
                }
            }

            T objectFromStringDisk = null;

            if (diskResult != null) {
                // Load object, no need to check disk configuration since diskresult != null.
                objectFromStringDisk = diskSerializer.fromString(diskResult);

                // Refresh object in ram.
                if (ramMode.equals(DualCacheRamMode.ENABLE_WITH_REFERENCE)) {
                    if (diskMode.equals(DualCacheDiskMode.ENABLE_WITH_SPECIFIC_SERIALIZER)) {
                        ramCacheLru.put(key, objectFromStringDisk);
                    }
                } else if (ramMode.equals(DualCacheRamMode.ENABLE_WITH_SPECIFIC_SERIALIZER)) {
                    if (diskSerializer == ramSerializer) {
                        ramCacheLru.put(key, diskResult);
                    } else {
                        ramCacheLru.put(key, ramSerializer.toString(objectFromStringDisk));
                    }
                }
                return objectFromStringDisk;
            }
        } else {
            loggerHelper.logEntryForKeyIsInRam(key);
            if (ramMode.equals(DualCacheRamMode.ENABLE_WITH_REFERENCE)) {
                return (T) ramResult;
            } else if (ramMode.equals(DualCacheRamMode.ENABLE_WITH_SPECIFIC_SERIALIZER)) {
                return ramSerializer.fromString((String) ramResult);
            }
        }

        // No data is available.
        return null;
    }
1034649
public byte[] readBlob(String key) throws IOException, KeyNotFoundException{
        ByteArrayOutputStream out = new ByteArrayOutputStream();
        readBlobTo(key, out);
        byte[] bytes = out.toByteArray();
        out.close();
        return bytes;
    }
597012
public Object get(String key) throws Exception {
        byte[] data = null;
        Jedis jedis = null;
        try {
            jedis = this.jedisPool.getResource();
            long begin = System.currentTimeMillis();
            data = jedis.get(SafeEncoder.encode(key));
            long end = System.currentTimeMillis();
            logger.info("get key:" + key + ", spends: " + (end - begin) + "ms");
        } catch (Exception e) {
            // do jedis.quit() and jedis.disconnect()
            this.jedisPool.returnBrokenResource(jedis);
            throw e;
        } finally {
            if (jedis != null) {
                this.jedisPool.returnResource(jedis);
            }
        }

        return this.deserialize(data);
    }