Results 1 to 3 of 3

Thread: Write first line after execution

  1. #1

    Default Write first line after execution

    Hi,

    I am currently implementing Spring Batch for a project, but I have a problem, I am moving db data with a driving query to a flat file, at the beginning I must leave a blank line before I start processing objects, at the end I must write a summary to the first line in the file, can anybody give me a hint on how to do this?

    thanks,
    Angel

  2. #2
    Join Date
    Dec 2006
    Posts
    1,061

    Default

    Personally, I would probably just create separate file for the summary line and cat it with the output file. However, if you know exactly how long the summary line would be, you could write a blank string at the beginning of the step, then replace it by writing out the correct number of bytes to overwrite your original write. However, if you don't know the length of the line, you pretty much have to cat.

    As a sidenote, a StepExecutionListener can be used to be notified of the step beginning and ending.

  3. #3

    Default

    Thanks Lucas, actually I will know the length of the line before hand, it must be 64 characters in length, could you elaborate a bit on how exactly I can overwrite this line?

    thank you,
    Angel

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •