summaryrefslogtreecommitdiff
path: root/src/com/google/wireless/gdata/client/GDataParserFactory.java
blob: 37a28999f6a7c9283056fce488c098db1b3d1c9c (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
// Copyright 2007 The Android Open Source Project

package com.google.wireless.gdata.client;

import com.google.wireless.gdata.parser.GDataParser;
import com.google.wireless.gdata.parser.ParseException;
import com.google.wireless.gdata.data.Entry;
import com.google.wireless.gdata.serializer.GDataSerializer;

import java.io.InputStream;

/**
 * Factory that creates {@link GDataParser}s and {@link GDataSerializer}s.
 */
public interface GDataParserFactory {
  /**
   * Creates a new {@link GDataParser} for the provided InputStream.
   *
   * @param entryClass Specify the class of Entry objects that are to be parsed. This
   *   lets createParser know which parser to create. 
   * @param is The InputStream that should be parsed. @return The GDataParser that will parse is.
   * @throws ParseException Thrown if the GDataParser could not be created.
   * @throws IllegalArgumentException if the feed type is unknown.
   */
  GDataParser createParser(Class entryClass, InputStream is)
      throws ParseException;

  /**
   * Creates a new {@link GDataParser} for the provided InputStream, using the
   * default feed type for the client.
   *
   * @param is The InputStream that should be parsed.
   * @return The GDataParser that will parse is.
   * @throws ParseException Thrown if the GDataParser could not be created.
   *         Note that this can occur if the feed in the InputStream is not of
   *         the default type assumed by this method.
   * @see #createParser(Class,InputStream)
   */
  GDataParser createParser(InputStream is) throws ParseException;

  /**
   * Creates a new {@link GDataSerializer} for the provided Entry.
   *
   * @param entry The Entry that should be serialized.
   * @return The GDataSerializer that will serialize entry.
   */
  GDataSerializer createSerializer(Entry entry);
}