O'Reilly logo

Java I/O, NIO and NIO.2 by Jeff Friesen

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Chapter    11

Formatter

The description of JSR 51 (http://jcp.org/en/jsr/detail?id=51) indicates that a simple printf-style formatting facility was proposed for inclusion in NIO. If you’re familiar with the C language, you’ve probably worked with the printf() family of functions that support formatted output.

One feature that makes the printf() functions useful is varargs, which lets you pass a variable number of arguments to these functions. Because support for varargs wasn’t added to Java until JDK 5, and because this support is very useful for achieving formatted output, the printf-style formatting facility was deferred to JDK 5.

This chapter explores JDK 5’s printf-style formatting facility.

Exploring Formatter

JDK 5 introduced the java.util.Formatter ...

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required