com.threerings.export
Class BinaryExporter

java.lang.Object
  extended by com.threerings.export.Exporter
      extended by com.threerings.export.BinaryExporter
All Implemented Interfaces:
Closeable

public class BinaryExporter
extends Exporter

Exports to a compact binary format.


Field Summary
static Class<?>[] BOOTSTRAP_CLASSES
          We seed the class map with these class references.
static byte COLLECTION_CLASS_FLAG
          Indicates that a stored class is a (non-Exportable) collection.
static short COMPRESSED_FORMAT_FLAG
          The compressed format flag.
static byte FINAL_CLASS_FLAG
          Indicates that a stored class is final.
static byte INNER_CLASS_FLAG
          Indicates that a stored class is a non-static inner class.
static int MAGIC_NUMBER
          Identifies the file type.
static byte MAP_CLASS_FLAG
          Indicates that the stored class is a (non-Exportable) map.
static short VERSION
          The format version.
 
Constructor Summary
BinaryExporter(OutputStream out)
          Creates an exporter to write to the specified stream with compression.
BinaryExporter(OutputStream out, boolean compress)
          Creates an exporter to write to the specified stream.
 
Method Summary
 void close()
          Writes out any remaining data and closes the underlying stream.
 void finish()
          Writes out any remaining data without closing the underlying stream.
 void write(String name, boolean value)
          Associates a boolean value with the current object.
 void write(String name, byte value)
          Associates a byte value with the current object.
 void write(String name, char value)
          Associates a character value with the current object.
 void write(String name, double value)
          Associates a double value with the current object.
 void write(String name, float value)
          Associates a float value with the current object.
 void write(String name, int value)
          Associates an integer value with the current object.
 void write(String name, long value)
          Associates a long value with the current object.
 void write(String name, short value)
          Associates a short value with the current object.
<T> void
write(String name, T value, Class<T> clazz)
          Associates an object value with the current object.
 void writeObject(Object object)
          Writes the object to the underlying stream.
 
Methods inherited from class com.threerings.export.Exporter
defaultWriteFields, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write, write
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

MAGIC_NUMBER

public static final int MAGIC_NUMBER
Identifies the file type.

See Also:
Constant Field Values

VERSION

public static final short VERSION
The format version.

See Also:
Constant Field Values

COMPRESSED_FORMAT_FLAG

public static final short COMPRESSED_FORMAT_FLAG
The compressed format flag.

See Also:
Constant Field Values

FINAL_CLASS_FLAG

public static final byte FINAL_CLASS_FLAG
Indicates that a stored class is final.

See Also:
Constant Field Values

INNER_CLASS_FLAG

public static final byte INNER_CLASS_FLAG
Indicates that a stored class is a non-static inner class.

See Also:
Constant Field Values

COLLECTION_CLASS_FLAG

public static final byte COLLECTION_CLASS_FLAG
Indicates that a stored class is a (non-Exportable) collection.

See Also:
Constant Field Values

MAP_CLASS_FLAG

public static final byte MAP_CLASS_FLAG
Indicates that the stored class is a (non-Exportable) map.

See Also:
Constant Field Values

BOOTSTRAP_CLASSES

public static final Class<?>[] BOOTSTRAP_CLASSES
We seed the class map with these class references. NOTE: Do not remove any entries or change their order.

Constructor Detail

BinaryExporter

public BinaryExporter(OutputStream out)
Creates an exporter to write to the specified stream with compression.


BinaryExporter

public BinaryExporter(OutputStream out,
                      boolean compress)
Creates an exporter to write to the specified stream.

Parameters:
compress - if true, compress the output.
Method Detail

writeObject

public void writeObject(Object object)
                 throws IOException
Description copied from class: Exporter
Writes the object to the underlying stream.

Specified by:
writeObject in class Exporter
Throws:
IOException

write

public void write(String name,
                  boolean value)
           throws IOException
Description copied from class: Exporter
Associates a boolean value with the current object.

Specified by:
write in class Exporter
Throws:
IOException

write

public void write(String name,
                  byte value)
           throws IOException
Description copied from class: Exporter
Associates a byte value with the current object.

Specified by:
write in class Exporter
Throws:
IOException

write

public void write(String name,
                  char value)
           throws IOException
Description copied from class: Exporter
Associates a character value with the current object.

Specified by:
write in class Exporter
Throws:
IOException

write

public void write(String name,
                  double value)
           throws IOException
Description copied from class: Exporter
Associates a double value with the current object.

Specified by:
write in class Exporter
Throws:
IOException

write

public void write(String name,
                  float value)
           throws IOException
Description copied from class: Exporter
Associates a float value with the current object.

Specified by:
write in class Exporter
Throws:
IOException

write

public void write(String name,
                  int value)
           throws IOException
Description copied from class: Exporter
Associates an integer value with the current object.

Specified by:
write in class Exporter
Throws:
IOException

write

public void write(String name,
                  long value)
           throws IOException
Description copied from class: Exporter
Associates a long value with the current object.

Specified by:
write in class Exporter
Throws:
IOException

write

public void write(String name,
                  short value)
           throws IOException
Description copied from class: Exporter
Associates a short value with the current object.

Specified by:
write in class Exporter
Throws:
IOException

write

public <T> void write(String name,
                      T value,
                      Class<T> clazz)
           throws IOException
Description copied from class: Exporter
Associates an object value with the current object.

Specified by:
write in class Exporter
Throws:
IOException

close

public void close()
           throws IOException
Description copied from class: Exporter
Writes out any remaining data and closes the underlying stream.

Specified by:
close in interface Closeable
Specified by:
close in class Exporter
Throws:
IOException

finish

public void finish()
            throws IOException
Description copied from class: Exporter
Writes out any remaining data without closing the underlying stream.

Specified by:
finish in class Exporter
Throws:
IOException


Copyright © 2011. All Rights Reserved.