diff options
Diffstat (limited to 'src/com/google/wireless/gdata/serializer/GDataSerializer.java')
-rw-r--r-- | src/com/google/wireless/gdata/serializer/GDataSerializer.java | 56 |
1 files changed, 56 insertions, 0 deletions
diff --git a/src/com/google/wireless/gdata/serializer/GDataSerializer.java b/src/com/google/wireless/gdata/serializer/GDataSerializer.java new file mode 100644 index 0000000..971d624 --- /dev/null +++ b/src/com/google/wireless/gdata/serializer/GDataSerializer.java @@ -0,0 +1,56 @@ +// Copyright 2007 The Android Open Source Project + +package com.google.wireless.gdata.serializer; + +import com.google.wireless.gdata.parser.ParseException; + +import java.io.IOException; +import java.io.OutputStream; + +/** + * Interface for serializing GData entries. + */ +public interface GDataSerializer { + + // TODO: I hope the three formats does not bite us. Each serializer has + // to pay attention to what "mode" it is in when serializing. + + /** + * Serialize all data in the entry. Used for debugging. + */ + public static final int FORMAT_FULL = 0; + + /** + * Serialize only the data necessary for creating a new entry. + */ + public static final int FORMAT_CREATE = 1; + + /** + * Serialize only the data necessary for updating an existing entry. + */ + public static final int FORMAT_UPDATE = 2; + + /** + * Returns the Content-Type for this serialization format. + * @return The Content-Type for this serialization format. + */ + String getContentType(); + + /** + * Serializes a GData entry to the provided {@link OutputStream}, using the + * specified serialization format. + * + * @see #FORMAT_FULL + * @see #FORMAT_CREATE + * @see #FORMAT_UPDATE + * + * @param out The {@link OutputStream} to which the entry should be + * serialized. + * @param format The format of the serialized output. + * @throws IOException Thrown if there is an issue writing the serialized + * entry to the provided {@link OutputStream}. + * @throws ParseException Thrown if the entry cannot be serialized. + */ + void serialize(OutputStream out, int format) + throws IOException, ParseException; +} |