本文整理了Java中java.util.Formatter.out()
方法的一些代码示例,展示了Formatter.out()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Formatter.out()
方法的具体详情如下:
包路径:java.util.Formatter
类名称:Formatter
方法名:out
[英]Returns the output destination of the Formatter.
[中]返回格式化程序的输出目标。
代码示例来源:origin: simpligility/android-maven-plugin
@Override
public void info( @NonNull String s, Object... objects )
{
final Formatter formatter = new Formatter();
if ( verboseInfo )
{
log.debug( formatter.format( s, objects ).out().toString() );
}
else
{
log.info( formatter.format( s, objects ).out().toString() );
}
}
代码示例来源:origin: simpligility/android-maven-plugin
@Override
public void verbose( @NonNull String s, Object... objects )
{
final Formatter formatter = new Formatter();
log.debug( formatter.format( s, objects ).out().toString() );
}
}
代码示例来源:origin: simpligility/android-maven-plugin
@Override
public void warning( @NonNull String s, Object... objects )
{
final Formatter formatter = new Formatter();
log.warn( formatter.format( s, objects ).out().toString() );
}
代码示例来源:origin: com.google.inject/guice
public Errors childBindingAlreadySet(Key<?> key, Set<Object> sources) {
Formatter allSources = new Formatter();
for (Object source : sources) {
if (source == null) {
allSources.format("%n (bound by a just-in-time binding)");
} else {
allSources.format("%n bound at %s", source);
}
}
Errors errors =
addMessage(
"Unable to create binding for %s."
+ " It was already configured on one or more child injectors or private modules"
+ "%s%n"
+ " If it was in a PrivateModule, did you forget to expose the binding?",
key, allSources.out());
return errors;
}
代码示例来源:origin: simpligility/android-maven-plugin
@Override
public void error( @Nullable Throwable throwable, @Nullable String s, Object... objects )
{
if ( ( throwable != null ) && ( s != null ) )
{
final Formatter formatter = new Formatter();
log.error( formatter.format( s, objects ).out().toString(), throwable );
}
else if ( ( throwable == null ) && ( s == null ) )
{
// do nothing.
}
else if ( throwable != null )
{
log.error( throwable );
}
else
{
final Formatter formatter = new Formatter();
log.error( formatter.format( s, objects ).out().toString() );
}
}
代码示例来源:origin: webx/citrus
/** 从第二行开始,对每一行缩进指定空白。 */
public static void indent(Formatter buf, String str, String indent) {
if (buf.out() instanceof StringBuilder) {
indent((StringBuilder) buf.out(), str, indent);
} else {
buf.format("%s", indent(str, indent));
}
}
代码示例来源:origin: webx/citrus
/** 从第二行开始,对每一行缩进指定空白。 */
public static void indent(Formatter buf, String str, String indent) {
if (buf.out() instanceof StringBuilder) {
indent((StringBuilder) buf.out(), str, indent);
} else {
buf.format("%s", indent(str, indent));
}
}
代码示例来源:origin: webx/citrus
/** 从第二行开始,对每一行缩进指定空白。 */
public static void indent(Formatter buf, String str, String indent) {
if (buf.out() instanceof StringBuilder) {
indent((StringBuilder) buf.out(), str, indent);
} else {
buf.format("%s", indent(str, indent));
}
}
代码示例来源:origin: DV8FromTheWorld/JDA
protected void appendFormat(Formatter formatter, int width, int precision, boolean leftJustified, String out)
{
try
{
Appendable appendable = formatter.out();
if (precision > -1 && out.length() > precision)
{
appendable.append(Helpers.truncate(out, precision - 3)).append("...");
return;
}
if (leftJustified)
appendable.append(Helpers.rightPad(out, width));
else
appendable.append(Helpers.leftPad(out, width));
}
catch (IOException e)
{
throw new AssertionError(e);
}
}
代码示例来源:origin: DV8FromTheWorld/JDA
Appendable appendable = formatter.out();
if (precision > -1 && out.length() > precision)
代码示例来源:origin: com.linkedin.pegasus/data
protected void formatSeparator(Formatter formatter, String fieldSeparator)
{
try
{
Appendable out = formatter.out();
out.append(fieldSeparator);
}
catch (IOException e)
{
throw new IllegalStateException(e);
}
}
代码示例来源:origin: com.alibaba.citrus/citrus-webx-all
/** 从第二行开始,对每一行缩进指定空白。 */
public static void indent(Formatter buf, String str, String indent) {
if (buf.out() instanceof StringBuilder) {
indent((StringBuilder) buf.out(), str, indent);
} else {
buf.format("%s", indent(str, indent));
}
}
代码示例来源:origin: org.apache.hadoop/hadoop-mapred-test
@Override
public void configure(JobConf conf) {
nMaps = conf.getNumMapTasks();
((StringBuilder)fmt.out()).append(keyfmt);
}
代码示例来源:origin: org.tinygroup/commons
/** 从第二行开始,对每一行缩进指定空白。 */
public static void indent(Formatter buf, String str, String indent) {
if (buf.out() instanceof StringBuilder) {
indent((StringBuilder) buf.out(), str, indent);
} else {
buf.format("%s", indent(str, indent));
}
}
代码示例来源:origin: org.databene/databene-commons
@Override
public String convert(Object sourceValue) throws ConversionException {
if (sourceValue == null)
return null;
Formatter formatter = new Formatter(locale);
try {
return formatter.format(pattern, sourceValue).out().toString();
} finally {
IOUtil.close(formatter);
}
}
代码示例来源:origin: org.apache.hadoop/hadoop-mapred-test
@Override
public void configure(JobConf conf) {
nMaps = conf.getNumMapTasks();
id = nMaps - conf.getInt(JobContext.TASK_PARTITION, -1) - 1;
Arrays.fill(b, 0, 4096, (byte)'V');
((StringBuilder)fmt.out()).append(keyfmt);
}
代码示例来源:origin: org.jvnet.hudson.hadoop/hadoop-core
private static final void logAuditEvent(UserGroupInformation ugi,
InetAddress addr, String cmd, String src, String dst,
FileStatus stat) {
final Formatter fmt = auditFormatter.get();
((StringBuilder)fmt.out()).setLength(0);
auditLog.info(fmt.format(AUDIT_FORMAT, ugi, addr, cmd, src, dst,
(stat == null)
? null
: stat.getOwner() + ':' + stat.getGroup() + ':' +
stat.getPermission()
).toString());
}
代码示例来源:origin: com.github.dakusui/jcunit
@Override
default void formatTo(Formatter formatter, int flags, int width, int precision) {
try {
formatter.out().append(getName());
} catch (IOException e) {
throw Checks.wrap(e);
}
}
}
代码示例来源:origin: com.github.dakusui/jcunit
@Override
default void formatTo(Formatter formatter, int flags, int width, int precision) {
try {
formatter.out().append(String.format("%s was %s", value(), exitedWith()));
} catch (IOException e) {
throw Checks.wrap(e);
}
}
}
代码示例来源:origin: ch.cern.hadoop/hadoop-mapreduce-client-jobclient
@Override
public void configure(JobConf conf) {
nMaps = conf.getNumMapTasks();
id = nMaps - conf.getInt(JobContext.TASK_PARTITION, -1) - 1;
Arrays.fill(b, 0, 4096, (byte)'V');
((StringBuilder)fmt.out()).append(keyfmt);
}
内容来源于网络,如有侵权,请联系作者删除!