Class FormattingSerializer
All Packages Class Hierarchy This Package Previous Next Index
Class FormattingSerializer
public class netscape.util.FormattingSerializer
extends netscape.util.Serializer
{
/* Constructors
*/
public FormattingSerializer(OutputStream);
/* Methods
*/
public static byte[] formatBytes(byte[]);
public static String serializeObject(Object);
public static boolean writeObject(OutputStream, Object);
public int indentationLength();
public void setIndentationLength(int);
public void writeComment(String, boolean);
public void writeObject(Object);
}
Serializer subclass that formats and indents the
ASCII generated by the Serializer. This class makes it possible to insert
comments into a serialization.
Constructors
FormattingSerializer
public FormattingSerializer(OutputStream outputStream)
- Constructs a FormattingSerializer that writes to outputStream.
Methods
setIndentationLength
public void setIndentationLength(int numberOfSpaces)
- Sets the number of spaces to indent an expression. The default value
is 4.
indentationLength
public int indentationLength()
- Returns the number of spaces currently used to indent an expression.
writeComment
public void writeComment(String aComment,
boolean cStyle) throws IOException
- Writes aComment to the FormattingSerializer's output stream.
Ignores all non-ASCII characters. If cStyle is true,
the FormattingSerializer will use C-style delimiters, otherwise it will
use C++-style delimiters ("//"). aComment should not include
comment delimiters.
writeObject
public void writeObject(Object anObject) throws IOException
- Overridden to produce a formatted serialization of anObject.
- Overrides:
- writeObject in class Serializer
serializeObject
public static String serializeObject(Object anObject)
- Convenience method for generating anObject's ASCII
serialization. Returns null on error.
formatBytes
public static byte[] formatBytes(byte input[])
- Convenience method to format any ASCII serialization produced by a
Serializer. Returns null on error.
writeObject
public static boolean writeObject(OutputStream outputStream,
Object anObject)
- Convenience method for writing anObjectoutputStream. Returns true if the serialization and
writing succeeds, rather than throwing an exception.
All Packages Class Hierarchy This Package Previous Next Index