How do I read stream data or copy it from one PDF document to another?

Q: My application duplicates annots (solved, thanks to your kind
assistance) but it also
needs to transfer the top level (document) JavaScripts from one file
to another.

Being simpler, I can handle the case in which the JS is not contained
in a stream, but
I am still learning how to handle streams. Notice the attached code.
By following one
of the sample programs, I was able to figure out how to extract/decode
a stream and
send it to a file. However, my real objective is not to send the
JavaScript to a file, but:

- To the computer screen (for debugging, etc)

and, most importantly:

- To another PDF document.

My initial guess is that in the second case I will need to copy the
binary object, using its size
as a parameter.

Filter stm = obj.GetDecidedStream();
if (stm != null) {
  FilterReader reader = new FilterReader(stm);
  StdFile f = new StdFile(output_path, StdFile.OpenMode.e_write_mode);
  FilterWriter writer = new FilterWriter(f);
  writer.WriteFilter(reader);
  writer.Flush();
  f.Close();
}
-------------------------
A: You can read data from FilterReader using Read() method in
FilterReader class (similar to file I/O) and then dump the resulting
data in the console window.

To copy a stream from one document to another you could use
pdfdoc.GetSDFDoc().ImportObj(src_stream, false); For example:

Obj stm = pdfdoc.GetSDFDoc().ImportObj(src_stream, false);
...
mydict.Put("My stream", stm);