Class ResponseStreamIteratorWithHistory<GenerateContentResponse> (1.2.0)

publicclass ResponseStreamIteratorWithHistory<GenerateContentResponse>implementsIterator<GenerateContentResponse>

Iterator of the ResponseStream that holds the response chunks.

Inheritance

java.lang.Object > ResponseStreamIteratorWithHistory<GenerateContentResponse>

Type Parameter

Name Description
GenerateContentResponse

Constructors

ResponseStreamIteratorWithHistory(Iterator serverStreamIterator)

publicResponseStreamIteratorWithHistory(IteratorserverStreamIterator)
Parameter
Name Description
serverStreamIterator Iterator

Methods

getHistory()

publicList<GenerateContentResponse>getHistory()

Retrieves all the chunks in a stream of responses.

Returns
Type Description
List<GenerateContentResponse>

hasNext()

publicbooleanhasNext()
Returns
Type Description
boolean

isConsumed()

publicbooleanisConsumed()

Whether the whole stream has been consumed.

Here "consumed" means we have reached the end of the stream.

Returns
Type Description
boolean

next()

publicGenerateContentResponsenext()
Returns
Type Description
GenerateContentResponse

Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.

Last updated 2025年11月19日 UTC.