congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
StringUtils.format
Code IndexAdd Tabnine to your IDE (free)

How to use
format
method
in
org.apache.hadoop.util.StringUtils

Best Java code snippets using org.apache.hadoop.util.StringUtils.format (Showing top 20 results out of 315)

origin: org.apache.hadoop/hadoop-common

/**
 * Format a percentage for presentation to the user.
 * @param fraction the percentage as a fraction, e.g. 0.1 = 10%
 * @param decimalPlaces the number of decimal places
 * @return a string representation of the percentage
 */
public static String formatPercent(double fraction, int decimalPlaces) {
 return format("%." + decimalPlaces + "f%%", fraction*100);
}

origin: org.apache.hadoop/hadoop-common

/** @deprecated use StringUtils.format("%.2f", d). */
@Deprecated
public static String limitDecimalTo2(double d) {
 return format("%.2f", d);
}

origin: org.apache.hadoop/hadoop-common

/**
 * Given an array of bytes it will convert the bytes to a hex string
 * representation of the bytes
 * @param bytes
 * @param start start index, inclusively
 * @param end end index, exclusively
 * @return hex string representation of the byte array
 */
public static String byteToHexString(byte[] bytes, int start, int end) {
 if (bytes == null) {
  throw new IllegalArgumentException("bytes == null");
 }
 StringBuilder s = new StringBuilder(); 
 for(int i = start; i < end; i++) {
  s.append(format("%02x", bytes[i]));
 }
 return s.toString();
}
origin: org.apache.hadoop/hadoop-common

} else {
 final String  format = "%." + decimalPlaces + "f";
 String s = format(format, n/(double)prefix.value);
  s = format(format, n/(double)prefix.value);
origin: apache/kylin

String cmd = StringUtils.format(
    "--connect \"%s\" --driver %s --username %s --password %s --query \"%s AND \\$CONDITIONS\" "
        + "--target-dir %s/%s --split-by %s --boundary-query \"%s\" --null-string '' "
origin: org.apache.hadoop/hadoop-hdfs

innerInfo.put("min", StringUtils.format("%.2f%%", min));
innerInfo.put("median", StringUtils.format("%.2f%%", median));
innerInfo.put("max", StringUtils.format("%.2f%%", max));
innerInfo.put("stdDev", StringUtils.format("%.2f%%", dev));
info.put("nodeUsage", innerInfo);
origin: ch.cern.hadoop/hadoop-common

/**
 * Format a percentage for presentation to the user.
 * @param fraction the percentage as a fraction, e.g. 0.1 = 10%
 * @param decimalPlaces the number of decimal places
 * @return a string representation of the percentage
 */
public static String formatPercent(double fraction, int decimalPlaces) {
 return format("%." + decimalPlaces + "f%%", fraction*100);
}

origin: io.prestosql.hadoop/hadoop-apache

/**
 * Format a percentage for presentation to the user.
 * @param fraction the percentage as a fraction, e.g. 0.1 = 10%
 * @param decimalPlaces the number of decimal places
 * @return a string representation of the percentage
 */
public static String formatPercent(double fraction, int decimalPlaces) {
 return format("%." + decimalPlaces + "f%%", fraction*100);
}

origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

 static String left(float f) {
  return StringUtils.format("left:%.1f%%", f * 100);
 }
}
origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

 static String left(float f) {
  return StringUtils.format("left:%.1f%%", f * 100);
 }
}
origin: io.hops/hadoop-common

/**
 * Format a percentage for presentation to the user.
 * @param fraction the percentage as a fraction, e.g. 0.1 = 10%
 * @param decimalPlaces the number of decimal places
 * @return a string representation of the percentage
 */
public static String formatPercent(double fraction, int decimalPlaces) {
 return format("%." + decimalPlaces + "f%%", fraction * 100);
}

origin: io.prestosql.hadoop/hadoop-apache

/** Convert percentage to a string. */
public static String percent2String(double percentage) {
 return StringUtils.format("%.2f%%", percentage);
}
origin: com.github.jiayuhan-it/hadoop-common

/**
 * Format a percentage for presentation to the user.
 * @param fraction the percentage as a fraction, e.g. 0.1 = 10%
 * @param decimalPlaces the number of decimal places
 * @return a string representation of the percentage
 */
public static String formatPercent(double fraction, int decimalPlaces) {
 return format("%." + decimalPlaces + "f%%", fraction*100);
}

origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

static String width(float f) {
 return StringUtils.format("width:%.1f%%", f * 100);
}
origin: org.apache.hadoop/hadoop-yarn-server-resourcemanager

 static String left(float f) {
  return StringUtils.format("left:%.1f%%", f * 100);
 }
}
origin: ch.cern.hadoop/hadoop-common

/** @deprecated use StringUtils.format("%.2f", d). */
@Deprecated
public static String limitDecimalTo2(double d) {
 return format("%.2f", d);
}

origin: io.prestosql.hadoop/hadoop-apache

/** @deprecated use StringUtils.format("%.2f", d). */
@Deprecated
public static String limitDecimalTo2(double d) {
 return format("%.2f", d);
}

origin: io.hops/hadoop-common

/** @deprecated use StringUtils.format("%.2f", d). */
@Deprecated
public static String limitDecimalTo2(double d) {
 return format("%.2f", d);
}

origin: com.github.jiayuhan-it/hadoop-common

/** @deprecated use StringUtils.format("%.2f", d). */
@Deprecated
public static String limitDecimalTo2(double d) {
 return format("%.2f", d);
}

origin: uber/hudi

public static final String createNewLogFile(FileSystem fs, String basePath, String partitionPath, String commitTime,
  String fileID, Optional<Integer> version) throws IOException {
 String folderPath = basePath + "/" + partitionPath + "/";
 boolean makeDir = fs.mkdirs(new Path(folderPath));
 if (!makeDir) {
  throw new IOException("cannot create directory for path " + folderPath);
 }
 boolean createFile = fs.createNewFile(new Path(
   folderPath + FSUtils.makeLogFileName(fileID, ".log", commitTime, version.orElse(DEFAULT_TASK_PARTITIONID))));
 if (!createFile) {
  throw new IOException(
    StringUtils.format("cannot create data file for commit %s and fileId %s", commitTime, fileID));
 }
 return fileID;
}
org.apache.hadoop.utilStringUtilsformat

Javadoc

The same as String.format(Locale.ENGLISH, format, objects).

Popular methods of StringUtils

  • stringifyException
    Make a string representation of the exception.
  • join
    Concatenates strings, using a separator.
  • split
  • arrayToString
  • toLowerCase
    Converts all of the characters in this String to lower case with Locale.ENGLISH.
  • escapeString
  • startupShutdownMessage
    Print a log message for starting up and shutting down
  • getStrings
    Returns an arraylist of strings.
  • toUpperCase
    Converts all of the characters in this String to upper case with Locale.ENGLISH.
  • byteToHexString
    Given an array of bytes it will convert the bytes to a hex string representation of the bytes
  • formatTime
    Given the time in long milliseconds, returns a String in the format Xhrs, Ymins, Z sec.
  • unEscapeString
  • formatTime,
  • unEscapeString,
  • getStringCollection,
  • byteDesc,
  • formatPercent,
  • getTrimmedStrings,
  • equalsIgnoreCase,
  • formatTimeDiff,
  • getTrimmedStringCollection

Popular in Java

  • Parsing JSON documents to java classes using gson
  • startActivity (Activity)
  • findViewById (Activity)
  • scheduleAtFixedRate (Timer)
  • Window (java.awt)
    A Window object is a top-level window with no borders and no menubar. The default layout for a windo
  • ArrayList (java.util)
    ArrayList is an implementation of List, backed by an array. All optional operations including adding
  • Calendar (java.util)
    Calendar is an abstract base class for converting between a Date object and a set of integer fields
  • ExecutorService (java.util.concurrent)
    An Executor that provides methods to manage termination and methods that can produce a Future for tr
  • Servlet (javax.servlet)
    Defines methods that all servlets must implement. A servlet is a small Java program that runs within
  • Base64 (org.apache.commons.codec.binary)
    Provides Base64 encoding and decoding as defined by RFC 2045.This class implements section 6.8. Base
  • Top 12 Jupyter Notebook extensions
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now