On 6 Okt., 10:37, Andrey <
py4...@gmail.com> wrote:
> Hello,
> you do not need to load all the documents but you have to use the
> interface which works properly with many documents in the stream. See
> the test:
http://code.google.com/p/snakeyaml/source/browse/src/test/java/org/ya...
>
> As you can see even though the test calls loadAll() the documents are
> parsed only when you ask for it.
Thanks for this hint, that helped a lot to understand, that the
iteator initiates loading the documents actually.
> JavaDoc may be improved. Can you may be suggest a better text ? Is
> this better ?
> Parse the only YAML document in a stream and produce the corresponding
> Java object.
well that sounds better, but dont forget to mention the
ComposerException if it is not the only one ;-)
may be something like this:
/**
* Parse the first and only YAML document in a stream and produce
the corresponding
* JavaBean.
*
* @param io
* data to load from (BOM is respected and removed)
* @return parsed JavaBean
* @throws ComposerException
* in case there are more documents in the stream
*/
All load methods that call getSingleData() should have this additional
hints in their comments
> What the JavaDoc for loadAll() should say ?
may be something like this:
/**
* Parse all YAML documents in a stream and produce corresponding
Java
* objects.
* For optimizational reasons the document iterator actually
triggers the reading and parsing
* of each document as soon its next()-method is called.
*
* @param yaml
* YAML data to load from (BOM is respected and
ignored)
* @return an iterator over the parsed Java objects in this stream
in proper
* sequence
* @throws (what ever Exception if there is something thrown)
*/
Thanks for your help