Examples of ArrayValueImpl


Examples of com.caucho.quercus.env.ArrayValueImpl

  /**
   * Lists the available modes.
   */
  public static Value mcrypt_list_modes(Env env)
  {
    ArrayValue array = new ArrayValueImpl();

    array.put(MCRYPT_MODE_ECB);
    array.put(MCRYPT_MODE_CBC);
    array.put(MCRYPT_MODE_CFB);
    array.put(MCRYPT_MODE_OFB);
    array.put(MCRYPT_MODE_NOFB);

    return array;
  }
View Full Code Here

Examples of com.caucho.quercus.env.ArrayValueImpl

  /**
   * Returns the supported key sizes
   */
  public Value get_supported_key_sizes()
  {
    ArrayValue value = new ArrayValueImpl();

    // php/1q0c - can mix any key size with any block size
    if (McryptModule.MCRYPT_RIJNDAEL_128.equals(_algorithm)) {
      value.put(128 / 8);
      value.put(192 / 8);
      value.put(256 / 8);
    }
    else if (McryptModule.MCRYPT_RIJNDAEL_192.equals(_algorithm)) {
      value.put(128 / 8);
      value.put(192 / 8);
      value.put(256 / 8);
    }
    else if (McryptModule.MCRYPT_RIJNDAEL_256.equals(_algorithm)) {
      value.put(128 / 8);
      value.put(192 / 8);
      value.put(256 / 8);
    }
    else if (McryptModule.MCRYPT_3DES.equals(_algorithm)) {
      value.put(24);
    }
    else if (McryptModule.MCRYPT_DES.equals(_algorithm)) {
      value.put(8);
    }

    return value;
  }
View Full Code Here

Examples of com.caucho.quercus.env.ArrayValueImpl

  public static Value decodeMimeHeaders(Env env,
                                        StringValue encodedHeaders,
                                        String charset)
    throws UnsupportedEncodingException
  {
    ArrayValue headers = new ArrayValueImpl();

    try {
      Enumeration<Header> enumeration
        = new InternetHeaders(encodedHeaders.toInputStream()).getAllHeaders();

      while (enumeration.hasMoreElements()) {
        Header header = enumeration.nextElement();

        StringValue name
        = QuercusMimeUtility.decodeMime(env, header.getName(), charset);
        StringValue val
        = QuercusMimeUtility.decodeMime(env, header.getValue(), charset);

        Value headerName;
        if ((headerName = headers.containsKey(name)) == null) {
          headers.put(name, val);
          continue;
        }

        ArrayValue inner;
        if (headerName.isArray()) {
          inner = headerName.toArrayValue(env);
        }
        else {
          inner = new ArrayValueImpl();
          inner.put(headerName);
        }

        inner.put(val);
        headers.put(name, inner);
      }

      return headers;
   
    } catch (MessagingException e) {
View Full Code Here

Examples of com.caucho.quercus.env.ArrayValueImpl

   * The domain is stored in the returned array under the key named ":domain:".
   */
  public static ArrayValue mbean_explode(String name)
  {
    try {
      ArrayValueImpl exploded = new ArrayValueImpl();

      if (name == null)
        name = "";

      ObjectName objectName = new ObjectName(name);

      exploded.put(":domain:", objectName.getDomain());

      Hashtable<String, String> entries = objectName.getKeyPropertyList();

      for (Map.Entry<String, String> entry : entries.entrySet()) {
        exploded.put(entry.getKey(), entry.getValue());
      }

      return exploded;
    } catch (MalformedObjectNameException e) {
      throw new QuercusModuleException(e);
View Full Code Here

Examples of com.caucho.quercus.env.ArrayValueImpl

   * of the current web application.
   */
  public ArrayValue query(Env env, String pattern)
  {
    try {
      ArrayValueImpl values = new ArrayValueImpl();

      ObjectName patternObjectName;

      patternObjectName = new ObjectName(pattern);

      Set<ObjectName> objectNames;

      objectNames = _server.queryNames(patternObjectName, null);

      if (objectNames == null)
        return values;

      TreeSet<ObjectName> sortedObjectNames
        = new TreeSet<ObjectName>(OBJECTNAME_COMPARATOR);

      sortedObjectNames.addAll(objectNames);

      for (ObjectName objectName : sortedObjectNames)
        values.put(env.wrapJava(new MBean(_server, objectName)));

      return values;
    }
    catch (MalformedObjectNameException e) {
      throw new QuercusModuleException(e);
View Full Code Here

Examples of com.caucho.quercus.env.ArrayValueImpl

    int level = Math.max(_errmode, ERRMODE_SILENT);

    _errorCode = errorCode;

    _errorInfo = new ArrayValueImpl();
    _errorInfo.put(errorCode);
    _errorInfo.put(driverError);
    _errorInfo.put(errorMessage);

    if (level == ERRMODE_WARNING)
View Full Code Here

Examples of com.caucho.quercus.env.ArrayValueImpl

  }

  public ArrayValue errorInfo()
  {
    if (_errorInfo == null) {
      _errorInfo = new ArrayValueImpl();
      _errorInfo.put(ERR_NONE);
    }

    return _errorInfo;
  }
View Full Code Here

Examples of com.caucho.quercus.env.ArrayValueImpl

  {
    _isError = true;

    _errorCode = ERR_GENERAL;

    _errorInfo = new ArrayValueImpl();
    _errorInfo.put(_errorCode);
    _errorInfo.put(2050);
    _errorInfo.put("");

    _env.notice(message);
View Full Code Here

Examples of com.caucho.quercus.env.ArrayValueImpl

  {
    _isError = true;

    _errorCode = ERR_GENERAL;

    _errorInfo = new ArrayValueImpl();
    _errorInfo.put(_errorCode);

    if (_errmode == ERRMODE_EXCEPTION) {
      throw new PDOException(_errorCode, message);
    }
View Full Code Here

Examples of com.caucho.quercus.env.ArrayValueImpl

  {
  }

  private static ConstArrayValue toUnicodeArray(Env env, ArrayValue array)
  {
    ArrayValueImpl copy = new ArrayValueImpl();
   
    Iterator<Map.Entry<Value,Value>> iter = array.getIterator(env);

    while (iter.hasNext()) {
      Map.Entry<Value,Value> entry = iter.next();

      Value key = entry.getKey();
      Value value = entry.getValue();

      if (key.isString())
        key = key.toUnicodeValue(env);

      if (value.isString())
        value = value.toUnicodeValue(env);

      copy.put(key, value);
    }

    return new ConstArrayValue(copy);
  }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.