|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||
java.lang.Objectezvcard.io.json.JCardReader
public class JCardReader
Parses VCard objects from a JSON data stream (jCard format).
Example:
File file = new File("vcards.json");
JCardReader jcardReader = new JCardReader(file);
VCard vcard;
while ((vcard = jcardReader.readNext()) != null){
...
}
jcardReader.close();
| Constructor Summary | |
|---|---|
JCardReader(File file)
Creates a reader that parses jCards from a file. |
|
JCardReader(InputStream in)
Creates a reader that parses jCards from an input stream. |
|
JCardReader(Reader reader)
Creates a reader that parses jCards from a reader. |
|
JCardReader(String json)
Creates a reader that parses jCards from a JSON string. |
|
| Method Summary | |
|---|---|
void |
close()
|
ScribeIndex |
getScribeIndex()
Gets the scribe index. |
List<String> |
getWarnings()
Gets the warnings from the last vCard that was unmarshalled. |
VCard |
readNext()
Reads the next vCard from the data stream. |
void |
registerScribe(VCardPropertyScribe<? extends VCardProperty> scribe)
Registers a property scribe. |
void |
setScribeIndex(ScribeIndex index)
Sets the scribe index. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Constructor Detail |
|---|
public JCardReader(String json)
json - the JSON stringpublic JCardReader(InputStream in)
in - the input stream to read the vCards from
public JCardReader(File file)
throws FileNotFoundException
file - the file to read the vCards from
FileNotFoundException - if the file doesn't existpublic JCardReader(Reader reader)
reader - the reader to read the vCards from| Method Detail |
|---|
public VCard readNext()
throws IOException
IOException - if there's a problem reading from the streampublic void registerScribe(VCardPropertyScribe<? extends VCardProperty> scribe)
Registers a property scribe. This is the same as calling:
getScribeIndex().register(scribe)
scribe - the scribe to registerpublic ScribeIndex getScribeIndex()
public void setScribeIndex(ScribeIndex index)
index - the scribe indexpublic List<String> getWarnings()
public void close()
throws IOException
close in interface CloseableIOException
|
||||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | |||||||||