de.undercouch.bson4jackson
Enum BsonGenerator.Feature

java.lang.Object
  extended by java.lang.Enum<BsonGenerator.Feature>
      extended by de.undercouch.bson4jackson.BsonGenerator.Feature
All Implemented Interfaces:
java.io.Serializable, java.lang.Comparable<BsonGenerator.Feature>
Enclosing class:
BsonGenerator

public static enum BsonGenerator.Feature
extends java.lang.Enum<BsonGenerator.Feature>

Defines toggable features


Enum Constant Summary
ENABLE_STREAMING
          Enables streaming by setting the document's total number of bytes in the header to 0.
 
Method Summary
 int getMask()
           
static BsonGenerator.Feature valueOf(java.lang.String name)
          Returns the enum constant of this type with the specified name.
static BsonGenerator.Feature[] values()
          Returns an array containing the constants of this enum type, in the order they are declared.
 
Methods inherited from class java.lang.Enum
clone, compareTo, equals, finalize, getDeclaringClass, hashCode, name, ordinal, toString, valueOf
 
Methods inherited from class java.lang.Object
getClass, notify, notifyAll, wait, wait, wait
 

Enum Constant Detail

ENABLE_STREAMING

public static final BsonGenerator.Feature ENABLE_STREAMING

Enables streaming by setting the document's total number of bytes in the header to 0. This allows the generator to flush the output buffer from time to time. Otherwise the generator would have to buffer the whole file to be able to calculate the total number of bytes.

ATTENTION: By enabling this feature, the BSON document generated by this class will not be compatible to the specification! However, if you know what you are doing and if you know that the document will be read by a parser that ignores the total number of bytes anyway (like BsonParser or org.bson.BSONDecoder from the MongoDB Java Driver do) then this feature will be very useful.

Method Detail

values

public static BsonGenerator.Feature[] values()
Returns an array containing the constants of this enum type, in the order they are declared. This method may be used to iterate over the constants as follows:
for (BsonGenerator.Feature c : BsonGenerator.Feature.values())
    System.out.println(c);

Returns:
an array containing the constants of this enum type, in the order they are declared

valueOf

public static BsonGenerator.Feature valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name. The string must match exactly an identifier used to declare an enum constant in this type. (Extraneous whitespace characters are not permitted.)

Parameters:
name - the name of the enum constant to be returned.
Returns:
the enum constant with the specified name
Throws:
java.lang.IllegalArgumentException - if this enum type has no constant with the specified name
java.lang.NullPointerException - if the argument is null

getMask

public int getMask()
Returns:
the bit mask that identifies this feature