java.lang.Byte.toString()方法的使用及代码示例

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

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

Byte.toString介绍

[英]Returns a String object representing this Byte's value. The value is converted to signed decimal representation and returned as a string, exactly as if the byte value were given as an argument to the java.lang.Byte#toString(byte) method.
[中]返回表示此字节值的字符串对象。该值转换为带符号的十进制表示形式,并作为字符串返回,就像字节值作为java的参数给出一样。lang.Byte#toString(Byte)方法。

代码示例

代码示例来源:origin: skylot/jadx

public static String formatByte(byte b) {
  if (b == Byte.MAX_VALUE) {
    return "Byte.MAX_VALUE";
  }
  if (b == Byte.MIN_VALUE) {
    return "Byte.MIN_VALUE";
  }
  return "(byte) " + Byte.toString(b);
}

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

/**
 * Helper method called by {@link #toString()} in order to convert a single map key into a string.
 * This is protected to allow subclasses to override the appearance of a given key.
 */
protected String keyToString(byte key) {
  return Byte.toString(key);
}

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

/**
 * Represents the supplied {@code boolean} value as a {@link String}.
 *
 * @param value The {@code boolean} value to render.
 * @return An appropriate {@link String} representation.
 */
public String toSourceString(byte value) {
  return Byte.toString(value);
}

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

/**
 * Helper method called by {@link #toString()} in order to convert a single map key into a string.
 * This is protected to allow subclasses to override the appearance of a given key.
 */
protected String keyToString(byte key) {
  return Byte.toString(key);
}

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

@Override
public String prettyPrint()
{
  return Byte.toString( value );
}

代码示例来源:origin: hibernate/hibernate-orm

@Override
public String toString(Byte value) {
  return value == null ? null : value.toString();
}
@Override

代码示例来源:origin: aws/aws-sdk-java

/**
 * Returns the string representation of the specified Byte.
 *
 * @param b
 *            The Byte to represent as a string.
 *
 * @return The string representation of the specified Byte.
 */
public static String fromByte(Byte b) {
  return Byte.toString(b);
}

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

@Override
public void setByte(Text text, Byte value)
{
  text.set(value.toString().getBytes(UTF_8));
}

代码示例来源:origin: spring-projects/spring-framework

public void arrayb(byte... vargs) {
  s = "";
  if (vargs != null) {
    s = "";
    for (Byte v: vargs) {
      this.s += Byte.toString(v);
    }
  }
}

代码示例来源:origin: MovingBlocks/Terasology

@Override
  public String convertToString(Byte value) {
    Preconditions.checkNotNull(value, "'value' must not be null!");
    return value.toString();
  }
};

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

/**
 * Appends byte value.
 */
public StringBand append(byte b) {
  return append(Byte.toString(b));
}

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

/**
 * Obtains the string representation of this object.
 */
public String toString() {
  return Byte.toString(getValue());
}

代码示例来源:origin: spring-projects/spring-loaded

public String setByte() throws Exception {
  Method m = Field.class.getMethod("setByte", Object.class, Byte.TYPE);
  Field f = JLRFSetTheRest.class.getDeclaredField("b");
  m.invoke(f, this, (byte) 123);
  return Byte.toString(b);
}

代码示例来源:origin: org.testng/testng

/**
 * Asserts that two arrays contain the same elements in the same order. If they do not,
 * an AssertionError, with the given message, is thrown.
 *
 * @param actual   the actual value
 * @param expected the expected value
 * @param message  the assertion error message
 */
public static void assertEquals(byte[] actual, byte[] expected, String message) {
 if (checkRefEqualityAndLength(actual, expected, message)) return;
 for (int i = 0; i < expected.length; i++) {
  if (expected[i] != actual[i]) {
   fail(String.format(ARRAY_MISMATCH_TEMPLATE, i, Byte.toString(expected[i]), Byte.toString(actual[i]), message));
  }
 }
}

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

@Override
public void writeInteger( byte value )
{
  append( Byte.toString( value ) );
}

代码示例来源:origin: oblac/jodd

/**
 * Appends byte value.
 */
public StringBand append(final byte b) {
  return append(Byte.toString(b));
}

代码示例来源:origin: apache/zookeeper

public void writeByte(byte b, String tag) throws IOException {
  printBeginEnvelope(tag);
  stream.print("<ex:i1>");
  stream.print(Byte.toString(b));
  stream.print("</ex:i1>");
  printEndEnvelope(tag);
}

代码示例来源:origin: apache/flink

/**
 * Returns the Byte value for the given key. If the key does not exists it will return the default value given.
 * The method fails if the value is not a Byte.
 */
public byte getByte(String key, byte defaultValue) {
  addToDefaults(key, Byte.toString(defaultValue));
  String value = get(key);
  if (value == null) {
    return defaultValue;
  } else {
    return Byte.valueOf(value);
  }
}

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

@Override
public void setByte(int parameterIndex, byte x)
    throws SQLException
{
  checkOpen();
  setParameter(parameterIndex, formatLiteral("TINYINT", Byte.toString(x)));
}

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

@Override
public void writeByteArray( byte[] value )
{
  String sep = "";
  append( "[" );
  for ( byte b : value )
  {
    append( sep );
    append( Byte.toString( b ) );
    sep = ", ";
  }
  append( "]" );
}

相关文章