Package er.extensions.formatters

Examples of er.extensions.formatters.ERXUnitAwareDecimalFormat


  public String bytesReadSize() {
    String bytesReadSize = null;
    AjaxUploadProgress progress = uploadProgress();
    if (progress != null) {
      NumberFormat formatter = new ERXUnitAwareDecimalFormat(ERXUnitAwareDecimalFormat.BYTE);
      formatter.setMaximumFractionDigits(2);
      bytesReadSize = formatter.format(progress.value());
    }
    return bytesReadSize;
  }
View Full Code Here


  public String streamLengthSize() {
    String streamLengthSize = null;
    AjaxUploadProgress progress = uploadProgress();
    if (progress != null) {
      NumberFormat formatter = new ERXUnitAwareDecimalFormat(ERXUnitAwareDecimalFormat.BYTE);
      formatter.setMaximumFractionDigits(2);
      streamLengthSize = formatter.format(progress.maximum());
    }
    return streamLengthSize;
  }
View Full Code Here

          done = true;
        }
        else {
          incrementValue(bytesRead);
          if (maxSize > 0 && _value > maxSize) {
            throw new IOException("The provided stream exceeded the maximum length of " + new ERXUnitAwareDecimalFormat(ERXUnitAwareDecimalFormat.BYTE).format(maxSize) + " bytes.");
          }
          outputStream.write(buffer, 0, bytesRead);
        }
      }
      while (!done && !isCanceled() && !shouldReset());
View Full Code Here

  public String bytesReadSize() {
    String bytesReadSize = null;
    AjaxUploadProgress progress = uploadProgress();
    if (progress != null) {
      NumberFormat formatter = new ERXUnitAwareDecimalFormat(ERXUnitAwareDecimalFormat.BYTE);
      formatter.setMaximumFractionDigits(2);
      bytesReadSize = formatter.format(progress.value());
    }
    return bytesReadSize;
  }
View Full Code Here

  public String streamLengthSize() {
    String streamLengthSize = null;
    AjaxUploadProgress progress = uploadProgress();
    if (progress != null) {
      NumberFormat formatter = new ERXUnitAwareDecimalFormat(ERXUnitAwareDecimalFormat.BYTE);
      formatter.setMaximumFractionDigits(2);
      streamLengthSize = formatter.format(progress.maximum());
    }
    return streamLengthSize;
  }
View Full Code Here

    // FIXME: Work in progress - fixed template; format parameter will be
    // ignored for now.
    JavaVMInfoPatternConverter(FormattingInfo formattingInfo, String format) {
      super(formattingInfo);
      _runtime = Runtime.getRuntime();
      _decimalFormatter = new ERXUnitAwareDecimalFormat(ERXUnitAwareDecimalFormat.BYTE);
      _decimalFormatter.setMaximumFractionDigits(2);
      _templateParser = new ERXSimpleTemplateParser("-");
      // This will prevent the convert method to get into an infinite loop
      // when debug level logging is enabled for the parser.
      _templateParser.isLoggingDisabled = true;
View Full Code Here

            }
          }
         
          try {
            if (_maxUploadSize >= 0L && streamLength > _maxUploadSize) {
              IOException e = new IOException("You attempted to upload a file larger than the maximum allowed size of " + new ERXUnitAwareDecimalFormat(ERXUnitAwareDecimalFormat.BYTE).format(_maxUploadSize) + ".");
              progress.setFailure(e);
              progress.dispose();
              throw e;
            }
            FileOutputStream fos = new FileOutputStream(progress.tempFile());
View Full Code Here

     */
    public WOActionResults forceGCAction() {
        if (canPerformActionWithPasswordKey("er.extensions.ERXGCPassword")) {
          ERXStringHolder result = pageWithName(ERXStringHolder.class);
            Runtime runtime = Runtime.getRuntime();
            ERXUnitAwareDecimalFormat decimalFormatter = new ERXUnitAwareDecimalFormat(ERXUnitAwareDecimalFormat.BYTE);
            decimalFormatter.setMaximumFractionDigits(2);
          
            String info = "Before: ";
            info += decimalFormatter.format(runtime.maxMemory()) + " max, ";
            info += decimalFormatter.format(runtime.totalMemory()) + " total, ";
            info += decimalFormatter.format(runtime.totalMemory()-runtime.freeMemory()) + " used, ";
            info += decimalFormatter.format(runtime.freeMemory()) + " free\n";
           
            int count = 5;
            if(request().stringFormValueForKey("count") != null) {
              count = Integer.parseInt(request().stringFormValueForKey("count"));
            }
            ERXExtensions.forceGC(count);
 
            info += "After: ";
            info += decimalFormatter.format(runtime.maxMemory()) + " max, ";
            info += decimalFormatter.format(runtime.totalMemory()) + " total, ";
            info += decimalFormatter.format(runtime.totalMemory()-runtime.freeMemory()) + " used, ";
            info += decimalFormatter.format(runtime.freeMemory()) + " free\n";

            result.setValue(info);
            log.info("GC forced\n"+info);
            return result;
        }
View Full Code Here

    super.appendToResponse(response, context);
    _aggregateLogEntries = null;
  }
 
  public Format byteFormat() {
    return new ERXUnitAwareDecimalFormat(ERXUnitAwareDecimalFormat.BYTE);
  }
View Full Code Here

  public Format byteFormat() {
    return new ERXUnitAwareDecimalFormat(ERXUnitAwareDecimalFormat.BYTE);
  }
 
  public Format timeFormat() {
    return new ERXUnitAwareDecimalFormat(ERXUnitAwareDecimalFormat.SECOND);
  }
View Full Code Here

TOP

Related Classes of er.extensions.formatters.ERXUnitAwareDecimalFormat

Copyright © 2018 www.massapicom. 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.