Example #1
0
  @Override
  protected void printRImpl(
      Env env, WriteStream out, int depth, IdentityHashMap<Value, String> valueSet)
      throws IOException {
    if (_classDef.printRImpl(env, _object, out, depth, valueSet)) {
      return;
    }

    Set<? extends Map.Entry<Value, Value>> entrySet = entrySet();

    if (entrySet == null) {
      out.print("resource(" + toString(env) + ")"); // XXX:
      return;
    }

    out.print(_classDef.getSimpleName());
    out.println(" Object");
    printRDepth(out, depth);
    out.print("(");

    for (Map.Entry<Value, Value> entry : entrySet) {
      out.println();
      printRDepth(out, depth);
      out.print("    [" + entry.getKey() + "] => ");

      entry.getValue().printRImpl(env, out, depth + 1, valueSet);
    }

    out.println();
    printRDepth(out, depth);
    out.println(")");
  }
Example #2
0
  private void addHeader(ClientSocket stream, WriteStream ws, CharBuffer key, String value)
      throws IOException {
    int keyLen = key.getLength();
    int valLen = value.length();

    int len = keyLen + valLen;

    if (keyLen < 0x80) len += 1;
    else len += 4;

    if (valLen < 0x80) len += 1;
    else len += 4;

    writeHeader(ws, FCGI_PARAMS, len);

    if (keyLen < 0x80) ws.write(keyLen);
    else {
      ws.write(0x80 | (keyLen >> 24));
      ws.write(keyLen >> 16);
      ws.write(keyLen >> 8);
      ws.write(keyLen);
    }

    if (valLen < 0x80) ws.write(valLen);
    else {
      ws.write(0x80 | (valLen >> 24));
      ws.write(valLen >> 16);
      ws.write(valLen >> 8);
      ws.write(valLen);
    }

    ws.print(key.getBuffer(), 0, keyLen);
    ws.print(value);
  }
 /** Prints the code to create an LongLiteral. */
 @Override
 public void printCreate(WriteStream os) throws IOException {
   os.print("new com.caucho.el.EqExpr(");
   _left.printCreate(os);
   os.print(", ");
   _right.printCreate(os);
   os.print(")");
 }
Example #4
0
  /** var_dump() implementation */
  public void varDumpImpl(
      Env env, Value obj, WriteStream out, int depth, IdentityHashMap<Value, String> valueSet)
      throws IOException {
    String name = "SimpleXMLElement";

    if (obj != null) name = obj.getClassName();

    // php/1x33
    if (_text != null && _children == null && _attributes == null) {
      if (depth > 0) {
        _text.varDump(env, out, depth, valueSet);
        return;
      }

      out.println("object(" + name + ") (1) {");
      printDepth(out, 2 * (depth + 1));
      out.println("[0]=>");

      printDepth(out, 2 * (depth + 1));
      _text.varDump(env, out, depth, valueSet);
      out.println();

      printDepth(out, 2 * depth);
      out.print("}");

      return;
    }

    Set<Map.Entry<Value, Value>> entrySet = entrySet();
    out.println("object(" + name + ") (" + entrySet.size() + ") {");

    for (Map.Entry<Value, Value> entry : entrySet) {
      printDepth(out, 2 * (depth + 1));
      out.print("[");

      if (entry.getKey().isString()) out.print("\"" + entry.getKey() + "\"");
      else out.print(entry.getKey());

      out.println("]=>");

      printDepth(out, 2 * (depth + 1));
      entry.getValue().varDump(env, out, depth + 1, valueSet);
      out.println();
    }

    printDepth(out, 2 * depth);
    out.print('}');
  }
  /**
   * Generates the XML text representation for the tag validation.
   *
   * @param os write stream to the generated XML.
   */
  public void printXml(WriteStream os) throws IOException {
    os.print("<" + getTagName());

    for (int i = 0; i < _attrNames.size(); i++) {
      QName name = _attrNames.get(i);
      String value = _attrValues.get(i);

      os.print(" " + name.getName() + "=\"");

      printXmlText(os, value);

      os.print("\"");
    }

    os.print(">");

    printXmlChildren(os);

    os.print("</" + getTagName() + ">");
  }
  public static void writeDepend(Path dependPath, ArrayList<PersistentDependency> dependList)
      throws IOException {
    WriteStream os = dependPath.openWrite();
    try {
      for (int i = 0; i < dependList.size(); i++) {
        PersistentDependency dependency = dependList.get(i);

        if (dependency instanceof Depend) {
          Depend depend = (Depend) dependency;

          os.print('"');
          os.print(depend.getPath().getNativePath());
          os.print("\" \"");
          os.print(depend.getDigest());
          os.println("\"");
        }
      }
    } finally {
      os.close();
    }
  }
Example #7
0
  @Override
  protected void varDumpImpl(
      Env env, WriteStream out, int depth, IdentityHashMap<Value, String> valueSet)
      throws IOException {
    Value oldThis = env.setThis(this);

    try {
      if (!_classDef.varDumpImpl(env, this, _object, out, depth, valueSet))
        out.print("resource(" + toString(env) + ")"); // XXX:
    } finally {
      env.setThis(oldThis);
    }
  }
  /**
   * Generates the XML text representation for the tag validation.
   *
   * @param os write stream to the generated XML.
   */
  public void printXml(WriteStream os) throws IOException {
    os.print("<jsp:directive.page");
    printJspId(os);
    if (!_parseState.isELIgnored()) os.print(" el-ignored='false'");
    /*
    if (! _parseState.isScriptingEnabled())
      os.print(" scripting-enabled='false'");
    */
    if (_parseState.getContentType() != null)
      os.print(" content-type='" + _parseState.getContentType() + "'");

    ArrayList<String> imports = _parseState.getImportList();

    if (imports != null && imports.size() != 0) {
      os.print(" import='");
      for (int i = 0; i < imports.size(); i++) {
        if (i != 0) os.print(',');
        os.print(imports.get(i));
      }
      os.print("'");
    }

    os.print("/>");
  }
Example #9
0
  /** Prints the date to a stream. */
  public void printDate(WriteStream os) throws IOException {
    os.print(DAY_NAMES[(int) (_dayOfEpoch % 7 + 11) % 7]);
    os.write(',');
    os.write(' ');
    os.print((_dayOfMonth + 1) / 10);
    os.print((_dayOfMonth + 1) % 10);
    os.write(' ');
    os.print(MONTH_NAMES[(int) _month]);
    os.write(' ');
    os.print(_year);
    os.write(' ');
    os.print((_timeOfDay / 36000000) % 10);
    os.print((_timeOfDay / 3600000) % 10);
    os.write(':');
    os.print((_timeOfDay / 600000) % 6);
    os.print((_timeOfDay / 60000) % 10);
    os.write(':');
    os.print((_timeOfDay / 10000) % 6);
    os.print((_timeOfDay / 1000) % 10);

    if (_zoneName == null) {
      os.print(" GMT");
      return;
    }

    long offset = _zoneOffset;

    if (offset < 0) {
      os.write(' ');
      os.write('-');
      offset = -offset;
    } else {
      os.write(' ');
      os.write('+');
    }

    os.print((offset / 36000000) % 10);
    os.print((offset / 3600000) % 10);
    os.print((offset / 600000) % 6);
    os.print((offset / 60000) % 10);

    os.write(' ');
    os.write('(');
    os.print(_zoneName);
    os.write(')');
  }
Example #10
0
 private static void printRDepth(WriteStream out, int depth) throws IOException {
   for (int i = 0; i < 8 * depth; i++) out.print(' ');
 }
Example #11
0
 protected void printDepth(WriteStream out, int depth) throws IOException {
   for (int i = 0; i < depth; i++) out.print(' ');
 }