public class Write
extends java.lang.Object
Constructor and Description |
---|
Write() |
Modifier and Type | Method and Description |
---|---|
static java.lang.String |
getQuotedString(java.lang.String s)
Converts a String to a double-quoted format.
|
static void |
writeClassAndObject(java.io.PrintWriter pw,
java.lang.Object obj,
NumberFormat fmt,
java.lang.Object ref)
Writes a Scannable object, preceeded by its class identifier ( name or
alias).
|
static void |
writeColor(java.io.PrintWriter pw,
java.awt.Color color) |
static void |
writeColor(java.io.PrintWriter pw,
java.awt.Color color,
boolean newline)
Writes A Color to a PrintWriter.
|
static void |
writeDoubles(java.io.PrintWriter pw,
double[] vals,
int n,
NumberFormat fmt)
Writes a set of double values, enclosed in square brackets
[
] ,
to a PrintWriter. |
static void |
writeDoubles(java.io.PrintWriter pw,
double[] vals,
NumberFormat fmt)
Writes a set of double values, enclosed in square brackets
[
] ,
to a PrintWriter. |
static void |
writeFloats(java.io.PrintWriter pw,
float[] vals,
int n,
NumberFormat fmt)
Writes a set of float values, enclosed in square brackets
[
] ,
to a PrintWriter. |
static void |
writeFloats(java.io.PrintWriter pw,
float[] vals,
NumberFormat fmt)
Writes a set of float values, enclosed in square brackets
[
] ,
to a PrintWriter. |
static void |
writeFont(java.io.PrintWriter pw,
java.awt.Font font) |
static void |
writeInts(java.io.PrintWriter pw,
int[] vals,
int n,
NumberFormat fmt)
Writes a set of integer values, enclosed in square brackets
[
] ,
to a PrintWriter. |
static void |
writeInts(java.io.PrintWriter pw,
int[] vals,
NumberFormat fmt)
Writes a set of integer values, enclosed in square brackets
[
] ,
to a PrintWriter. |
static void |
writeLongs(java.io.PrintWriter pw,
long[] vals,
int n,
NumberFormat fmt)
Writes a set of long integer values, enclosed in square brackets
[ ] , to a PrintWriter. |
static void |
writeLongs(java.io.PrintWriter pw,
long[] vals,
NumberFormat fmt)
Writes a set of long integer values, enclosed in square brackets
[ ] , to a PrintWriter. |
static void |
writeShorts(java.io.PrintWriter pw,
short[] vals,
int n,
NumberFormat fmt)
Writes a set of short integer values, enclosed in square brackets
[ ] , to a PrintWriter. |
static void |
writeShorts(java.io.PrintWriter pw,
short[] vals,
NumberFormat fmt)
Writes a set of short integer values, enclosed in square brackets
[ ] , to a PrintWriter. |
static void |
writeString(java.io.PrintWriter pw,
java.lang.String s)
Writes out a String enclosed in double quotes
" , formatted
using the routine getQuotedString . |
public static void writeColor(java.io.PrintWriter pw, java.awt.Color color)
public static void writeColor(java.io.PrintWriter pw, java.awt.Color color, boolean newline)
[ ]
.pw
- PrintWriter to which the output is writtencolor
- color to writenewline
- if true, place a newline at the end of the outputpublic static void writeDoubles(java.io.PrintWriter pw, double[] vals, int n, NumberFormat fmt) throws java.io.IOException
[
]
,
to a PrintWriter.pw
- PrintWriter to which values are writtenvals
- values to be writtenn
- number of values to writefmt
- (optional) numeric formatter for each valuejava.io.IOException
public static void writeDoubles(java.io.PrintWriter pw, double[] vals, NumberFormat fmt) throws java.io.IOException
[
]
,
to a PrintWriter.pw
- PrintWriter to which values are writtenvals
- values to be writtenfmt
- (optional) numeric formatter for each valuejava.io.IOException
public static void writeFloats(java.io.PrintWriter pw, float[] vals, int n, NumberFormat fmt) throws java.io.IOException
[
]
,
to a PrintWriter.pw
- PrintWriter to which values are writtenvals
- values to be writtenn
- number of values to writefmt
- (optional) numeric formatter for each valuejava.io.IOException
public static void writeFloats(java.io.PrintWriter pw, float[] vals, NumberFormat fmt) throws java.io.IOException
[
]
,
to a PrintWriter.pw
- PrintWriter to which values are writtenvals
- values to be writtenfmt
- (optional) numeric formatter for each valuejava.io.IOException
public static void writeInts(java.io.PrintWriter pw, int[] vals, int n, NumberFormat fmt) throws java.io.IOException
[
]
,
to a PrintWriter.pw
- PrintWriter to which values are writtenvals
- values to be writtenn
- number of values to writefmt
- (optional) numeric formatter for each valuejava.io.IOException
public static void writeInts(java.io.PrintWriter pw, int[] vals, NumberFormat fmt) throws java.io.IOException
[
]
,
to a PrintWriter.pw
- PrintWriter to which values are writtenvals
- values to be writtenfmt
- (optional) numeric formatter for each valuejava.io.IOException
public static void writeShorts(java.io.PrintWriter pw, short[] vals, int n, NumberFormat fmt) throws java.io.IOException
[ ]
, to a PrintWriter.pw
- PrintWriter to which values are writtenvals
- values to be writtenn
- number of values to writefmt
- (optional) numeric formatter for each valuejava.io.IOException
public static void writeShorts(java.io.PrintWriter pw, short[] vals, NumberFormat fmt) throws java.io.IOException
[ ]
, to a PrintWriter.pw
- PrintWriter to which values are writtenvals
- values to be writtenfmt
- (optional) numeric formatter for each valuejava.io.IOException
public static void writeLongs(java.io.PrintWriter pw, long[] vals, int n, NumberFormat fmt) throws java.io.IOException
[ ]
, to a PrintWriter.pw
- PrintWriter to which values are writtenvals
- values to be writtenn
- number of values to writefmt
- (optional) numeric formatter for each valuejava.io.IOException
public static void writeLongs(java.io.PrintWriter pw, long[] vals, NumberFormat fmt) throws java.io.IOException
[ ]
, to a PrintWriter.pw
- PrintWriter to which values are writtenvals
- values to be writtenfmt
- (optional) numeric formatter for each valuejava.io.IOException
public static void writeString(java.io.PrintWriter pw, java.lang.String s)
"
, formatted
using the routine getQuotedString
.pw
- PrintWriter to which string is writtens
- String to be writtengetQuotedString(java.lang.String)
public static java.lang.String getQuotedString(java.lang.String s)
"
, and double quotes themselves are
escaped using backslash \
. The characters \b
,
\t
, \n
, \f
,
\r
, and \
(corresponding to backspace, tab,
linefeed, formfeed, carriage return, and backslash) are written using
their canonical escape sequences. Any other character <=
0x1f or >=
0x7f
is written by a backslashed octal number.s
- String to be converted to quoted formatpublic static void writeFont(java.io.PrintWriter pw, java.awt.Font font)
public static void writeClassAndObject(java.io.PrintWriter pw, java.lang.Object obj, NumberFormat fmt, java.lang.Object ref) throws java.io.IOException
Scan.scanClassAndObject(maspack.util.ReaderTokenizer, java.lang.Object)
.pw
- PrintWriter to which object should be writtenobj
- object to writefmt
- numeric formating informationref
- optional reference object which can be used for producing references to
other objectsjava.io.IOException
- if an I/O error occured