com.github.andyshao.lang.Convert Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of Gear Show documentation
Show all versions of Gear Show documentation
Enhance and formating the coding of JDK
The newest version!
package com.github.andyshao.lang;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Objects;
import java.util.function.Consumer;
import java.util.function.Function;
import java.util.function.Supplier;
/**
* General convert interface.
* Title:
* Descript:
* Copyright: Copryright(c) Jun 14, 2014
* Encoding:UNIX UTF-8
*
* @author Andy.Shao
*
* @param the input
* @param the output
*/
@FunctionalInterface
public interface Convert {
/**byte to string*/
public static final Convert BYTE_2_STR = ConvertByte2Str.byte2Char(ConvertByte2Str.BYTE_HEX);
/**bytes to hex*/
public static final Convert BYTES_2_HEX = (Byte[] in) -> {
StringBuilder builder = new StringBuilder();
for (Byte b : in)
builder.append(Convert.BYTE_2_STR.convert(b));
return builder.toString();
};
/**bytes to hex*/
public static final Convert BYTES_TO_HEX = (byte[] in) -> {
StringBuilder builder = new StringBuilder();
for (Byte b : in)
builder.append(Convert.BYTE_2_STR.convert(b));
return builder.toString();
};
/**hex to bytes*/
public static final Convert HEX_2_BYTES = new ConvertStr2Byte();
/**hex to bytes*/
public static final Convert HEX_TO_BYTES = (String in) -> ConvertStr2Byte.hexStringTobytes(in);
/**object to {@link BigDecimal}*/
public static final Convert
© 2015 - 2025 Weber Informatics LLC | Privacy Policy