java.lang.String.copyValueOf()方法的使用及代码示例

x33g5p2x  于2022-01-16 转载在 其他  
字(6.6k)|赞(0)|评价(0)|浏览(146)

本文整理了Java中java.lang.String.copyValueOf()方法的一些代码示例,展示了String.copyValueOf()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。String.copyValueOf()方法的具体详情如下:
包路径:java.lang.String
类名称:String
方法名:copyValueOf

String.copyValueOf介绍

[英]Returns a String that represents the character sequence in the array specified.
[中]返回表示指定数组中字符序列的字符串。

代码示例

代码示例来源:origin: google/guava

/**
 * Returns the Java Unicode escape sequence for the given {@code char}, in the form "\u12AB" where
 * "12AB" is the four hexadecimal digits representing the 16-bit code unit.
 */
private static String showCharacter(char c) {
 String hex = "0123456789ABCDEF";
 char[] tmp = {'\\', 'u', '\0', '\0', '\0', '\0'};
 for (int i = 0; i < 4; i++) {
  tmp[5 - i] = hex.charAt(c & 0xF);
  c = (char) (c >> 4);
 }
 return String.copyValueOf(tmp);
}

代码示例来源:origin: prestodb/presto

/**
 * Returns the Java Unicode escape sequence for the given {@code char}, in the form "\u12AB" where
 * "12AB" is the four hexadecimal digits representing the 16-bit code unit.
 */
private static String showCharacter(char c) {
 String hex = "0123456789ABCDEF";
 char[] tmp = {'\\', 'u', '\0', '\0', '\0', '\0'};
 for (int i = 0; i < 4; i++) {
  tmp[5 - i] = hex.charAt(c & 0xF);
  c = (char) (c >> 4);
 }
 return String.copyValueOf(tmp);
}

代码示例来源:origin: google/j2objc

/**
 * Returns the Java Unicode escape sequence for the given {@code char}, in the form "\u12AB" where
 * "12AB" is the four hexadecimal digits representing the 16-bit code unit.
 */
private static String showCharacter(char c) {
 String hex = "0123456789ABCDEF";
 char[] tmp = {'\\', 'u', '\0', '\0', '\0', '\0'};
 for (int i = 0; i < 4; i++) {
  tmp[5 - i] = hex.charAt(c & 0xF);
  c = (char) (c >> 4);
 }
 return String.copyValueOf(tmp);
}

代码示例来源:origin: wildfly/wildfly

/**
 * Returns the Java Unicode escape sequence for the given {@code char}, in the form "\u12AB" where
 * "12AB" is the four hexadecimal digits representing the 16-bit code unit.
 */
private static String showCharacter(char c) {
 String hex = "0123456789ABCDEF";
 char[] tmp = {'\\', 'u', '\0', '\0', '\0', '\0'};
 for (int i = 0; i < 4; i++) {
  tmp[5 - i] = hex.charAt(c & 0xF);
  c = (char) (c >> 4);
 }
 return String.copyValueOf(tmp);
}

代码示例来源:origin: libgdx/libgdx

public final String toString () {
    return String.copyValueOf(backingArray, offset + position, remaining());
  }
}

代码示例来源:origin: qiujiayu/AutoLoadCache

@Override
public Object deepClone(Object obj, final Type type) {
  if (null == obj) {
    return obj;
  }
  String str = (String) obj;
  return String.copyValueOf(str.toCharArray());
}

代码示例来源:origin: libgdx/libgdx

public final String toString () {
    return String.copyValueOf(backingArray, offset + position, remaining());
  }
}

代码示例来源:origin: oracle/helidon

/**
 * Returns the Java Unicode escape sequence for the given character, in the form "\u12AB" where
 * "12AB" is the four hexadecimal digits representing the 16 bits of the UTF-16 character.
 */
private static String showCharacter(char c) {
  String hex = "0123456789ABCDEF";
  char[] tmp = {'\\', 'u', '\0', '\0', '\0', '\0'};
  for (int i = 0; i < 4; i++) {
    tmp[5 - i] = hex.charAt(c & 0xF);
    c = (char) (c >> 4);
  }
  return String.copyValueOf(tmp);
}

代码示例来源:origin: google/guava

@Override
 public List<Character> create(Character[] elements) {
  char[] chars = Chars.toArray(Arrays.asList(elements));
  return Lists.charactersOf(String.copyValueOf(chars));
 }
}

代码示例来源:origin: facebook/litho

private static String getBasePropMatcherName(final MethodParamModel prop, final String suffix) {
 final String name = prop.getName();
 final int fst = Character.toUpperCase(name.codePointAt(0));
 return 'm'
   + String.copyValueOf(Character.toChars(fst))
   + name.substring(name.offsetByCodePoints(0, 1))
   + suffix;
}

代码示例来源:origin: pentaho/pentaho-kettle

@Override
public void print( char[] s ) {
 log.logDebug( String.copyValueOf( s ) );
}

代码示例来源:origin: pentaho/pentaho-kettle

@Override
public void println( char[] s ) {
 log.logDebug( String.copyValueOf( s ) + Const.CR );
}

代码示例来源:origin: robovm/robovm

@Override public final String toString() {
  return String.copyValueOf(backingArray, arrayOffset + position, remaining());
 }
}

代码示例来源:origin: jmxtrans/jmxtrans

@Override
public void write(char[] cbuf, int off, int len) throws IOException {
  logger.info(String.copyValueOf(cbuf, off, len).replace("\n", "").replace(" ", delimiter));
}

代码示例来源:origin: syncany/syncany

@Override
public String onUserPassword(String header, String message) {
  if (!isInteractive) {
    throw new RuntimeException("Repository is encrypted, but no password was given in non-interactive mode.");
  }
  out.println();
  if (header != null) {
    out.println(header);
    out.println(Strings.repeat("-", header.length()));
  }
  if (!message.trim().endsWith(":")) {
    message += ": ";
  }
  char[] passwordChars = console.readPassword(message);
  return String.copyValueOf(passwordChars);
}

代码示例来源:origin: google/guava

@AndroidIncompatible // slow
@GwtIncompatible // Floats.tryParse
public void testTryParseAllCodePoints() {
 // Exercise non-ASCII digit test cases and the like.
 char[] tmp = new char[2];
 for (int i = Character.MIN_CODE_POINT; i < Character.MAX_CODE_POINT; i++) {
  Character.toChars(i, tmp, 0);
  checkTryParse(String.copyValueOf(tmp, 0, Character.charCount(i)));
 }
}

代码示例来源:origin: google/guava

@AndroidIncompatible // slow
@GwtIncompatible // Doubles.tryParse
public void testTryParseAllCodePoints() {
 // Exercise non-ASCII digit test cases and the like.
 char[] tmp = new char[2];
 for (int i = Character.MIN_CODE_POINT; i < Character.MAX_CODE_POINT; i++) {
  Character.toChars(i, tmp, 0);
  checkTryParse(String.copyValueOf(tmp, 0, Character.charCount(i)));
 }
}

代码示例来源:origin: Alluxio/alluxio

private void validateCallbacks(String user, String passwd, Callback[] callbacks)
   throws IOException, UnsupportedCallbackException {
  for (Callback cb : callbacks) {
   if (cb instanceof NameCallback) {
    assertEquals(user, ((NameCallback) cb).getName());
   } else if (cb instanceof PasswordCallback) {
    char[] passwordChar = ((PasswordCallback) cb).getPassword();
    assertEquals(passwd, passwordChar == null ? null : String.copyValueOf(passwordChar));
   }
  }
 }
}

代码示例来源:origin: marytts/marytts

public void read(MaryRandomAccessFile stream) throws IOException {
    featureDimension = stream.readIntEndian();
    totalComponents = stream.readIntEndian();
    isDiagonalCovariance = stream.readBooleanEndian();
    int tmpLen = stream.readIntEndian();
    if (tmpLen > 0)
      info = String.copyValueOf(stream.readCharEndian(tmpLen));

    weights = stream.readDoubleEndian(totalComponents);

    components = new GaussianComponent[totalComponents];
    for (int i = 0; i < totalComponents; i++) {
      components[i] = new GaussianComponent();
      components[i].read(stream);
    }
  }
}

代码示例来源:origin: marytts/marytts

public void read(MaryRandomAccessFile stream) throws IOException {
    featureDimension = stream.readIntEndian();
    totalComponents = stream.readIntEndian();
    isDiagonalCovariance = stream.readBooleanEndian();
    int tmpLen = stream.readIntEndian();
    if (tmpLen > 0)
      info = String.copyValueOf(stream.readCharEndian(tmpLen));

    weights = stream.readDoubleEndian(totalComponents);

    components = new GaussianComponent[totalComponents];
    for (int i = 0; i < totalComponents; i++) {
      components[i] = new GaussianComponent();
      components[i].read(stream);
    }
  }
}

相关文章

微信公众号

最新文章

更多