Skip to content

Instantly share code, notes, and snippets.

@kasramp
Created April 7, 2020 15:12
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save kasramp/4dafb2aeca0b65adafa86992dbcfa27a to your computer and use it in GitHub Desktop.
Save kasramp/4dafb2aeca0b65adafa86992dbcfa27a to your computer and use it in GitHub Desktop.
val file = Files.createTempFile("students", ".json").toFile() // new file
val sequenceWriter = objectMapper.writerWithDefaultPrettyPrinter().writeValuesAsArray(file)
var pageNumber = 0
do {
val result = getStudentsDetailsByPage(pageNumber)
sequenceWriter.writeAll(result.content)
pageNumber += 1
} while (result.hasNext())
sequenceWriter.close()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment