List of usage examples for java.util Formatter Formatter
public Formatter(OutputStream os)
From source file:org.apache.bookkeeper.bookie.BookieShell.java
static String bytes2Hex(byte[] data) { StringBuilder sb = new StringBuilder(data.length * 2); Formatter formatter = new Formatter(sb); for (byte b : data) { formatter.format("%02x", b); }//from www. ja va 2 s . co m formatter.close(); return sb.toString(); }
From source file:net.sourceforge.fenixedu.domain.student.Registration.java
public void exportValues(StringBuilder result) { Formatter formatter = new Formatter(result); final Student student = getStudent(); formatter.format("%s: %s\n", BundleUtil.getString(Bundle.ACADEMIC, "label.ingression"), getIngression() == null ? " - " : getIngression().getFullDescription()); formatter.format("%s: %d\n", BundleUtil.getString(Bundle.ACADEMIC, "label.studentNumber"), student.getNumber());//from ww w . java 2s .co m formatter.format("%s: %s\n", BundleUtil.getString(Bundle.ACADEMIC, "label.Student.Person.name"), student.getPerson().getName()); formatter.format("%s: %s\n", BundleUtil.getString(Bundle.ACADEMIC, "label.degree"), getDegree().getPresentationName()); formatter.close(); }