Added java.util.Formatter implementation. Basic/common formats work,

such as %s, %d, %x... also width, left justify, zerofill flags are
implemented. Many of the other formats do not work, see the comments in
avian.FormatString javadoc and look for FIXME and TODO items for more
information on features that are known to not work correctly.
This commit is contained in:
BCG
2015-03-15 00:28:45 -04:00
parent cacc099987
commit a8bed52097
7 changed files with 1544 additions and 1 deletions

View File

@ -78,6 +78,25 @@ public class PrintStream extends OutputStream {
print(String.valueOf(s));
}
public synchronized void printf(java.util.Locale locale, String format, Object... args) {
// should this be cached in an instance variable??
final java.util.Formatter formatter = new java.util.Formatter(this);
formatter.format(locale, format, args);
}
public synchronized void printf(String format, Object... args) {
final java.util.Formatter formatter = new java.util.Formatter(this);
formatter.format(format, args);
}
public void format(String format, Object... args) {
printf(format, args);
}
public void format(java.util.Locale locale, String format, Object... args) {
printf(locale, format, args);
}
public synchronized void println(String s) {
try {
out.write(s.getBytes());