ibmi-brunch-learn

Announcement

Collapse
No announcement yet.

ByteArrayInputStream (.pdf) not as Emailattachment but as file

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • ByteArrayInputStream (.pdf) not as Emailattachment but as file

    Hello,

    first my JAVA-knowledge is not the best.
    Just enought to handle the most stuff.

    Have a programm here which is filled from AS/400 with datas and create an email with an kuempi.pdf as attachment.

    This works fine.
    The last to codelines are:
    PHP Code:
    ByteArrayInputStream bis =
                                new 
    ByteArrayInputStream(osPdfLGOTF.toByteArray());
                                
    mail.addAttachment("Kuempi.pdf"bis); 
    But now i want to store this .pdf also to the directory.
    Have tried mostly file-output-stuff but either it will not work or i get a error coz NotSerializableException.

    Anyone can help me please?

    kuempi

  • #2
    Re: ByteArrayInputStream (.pdf) not as Emailattachment but as file

    Just a guess, but do you need to bis.mark() before you create the mail attachment then bis.reset() afterwards? I wonder what state mail.addAttachment() leaves the byte array. Maybe you're trying to write your output file from the end of the byte array.

    Comment


    • #3
      Re: ByteArrayInputStream (.pdf) not as Emailattachment but as file

      Hello toeside,

      yesss you are right.
      After i changed the code the file was empty stored.
      With your comment then i found quick the problem.

      Thanxs to all and the Thread is solved.

      kuempi

      Comment

      Working...
      X