Sending a stream (?)

Hello,
I have a problem:
I'd like to send a pdf file, but I got only an InputStream representing the file. And since it is a report generated by a database, a file per se does not exisit at all.
The question is - how do you send such a thing with java mail?
If it is as simple as:
MimeBodypart mbp = new MimeBodyPart(inputstream), what mime type should I use? application/pdf and application/octet-stream doesn't seem to be supported.
I really don't want to encumber the server any more, so writing the stream to a file would not be a good solution.
best regards
-- rkr

Hi,
In the demo/ direcory from the javamail distribution there is a class called ByteArrayDataSource. It implements DataSource and can be constructed from an InputStream and a String containing the mime type.
You can use this to make a MimeBodyPart containing the file and the proper mime type:
MimeBodyPart mbp2 = new MimeBodyPart();
ByteArrayDataSource bads = new ByteArrayDataSource(stream, type); // stream is the InputStream and type is the mime type
mbp2.setDataHandler(new DataHandler(bads));
mbp2.setFileName(filename); // filename is whatever file name should show up in the attachmentYou also need the JavaBeans Activation Framework(javax.activation) in order to use this.

Similar Messages

  • Can't send photo stream messages on whatsapp

    Hi,
    I can't send 'photo stream' photos on whatsapp however I'm able to send ones from the 'Camera Roll' I've double checked everything and in privacy and restrictions everything seems normal.
    I've recently updated to the latest iOS.
    Any ideas?
    Thanks,
    Lewis

    Hi,
    I also contacted whatsapp directly in regards to this, seems like it's an APP issue from the response I got..
    Hi,
    Thanks for your message.
    Sorry for the delay! We have received many emails recently, and we do our best to answer them all. Thank you for your patience.
    We are very sorry you are experiencing this issue. We are working on a fix for this, and it will be fixed in a future version. We are looking to get this version out as quickly as possible, but we cannot speak for exact timelines. Thanks for your patience.
    In the meantime, please try to delete and reinstall WhatsApp. Alternatively, you can turn on your iCloud Photo Library in iPhone Settings > iCloud > Photos.
    Cheers!
    Mallori
    WhatsApp Support Team

  • PLEASE! Cut a part of a video and send as stream

    Hellow!
    Urgent please!!!!
    Anybody knowns how to cut a part of a video with JMF and the result send as stream for a client? (I don�t want to save this part in a file, but a want to send as stream):
    Thank�s a lot.

    I think RTSP may be a solution, it should allow to choose a time that the sequence starts (and possibly ends) at.
    Hope this helps,
    Stef

  • Send RTP stream to NAT address

    Hi,
    i want to transmit a RTP stream from a server to a host in a LAN.
    This host has a NAT address and it's non real IP address, so i can't send any stream trought usage of SessionManager API because it need to know a public IP.
    The other issue is that in a LAN, in most popular cases, there is a firewall that close the connection from internet to their hosts.
    I think this solution:
    1) LAN's hosts can intiate the connection with server sending a non real RTP data
    2)Server store the SessionManager of this connection
    3)server can send your RTP stream now
    Someone have a more good solution or any suggestion?
    Thank for all
    [email protected]

    I have one appletTransmitter that capture video from webcam and transmit it to other client on internet.
    I try to transmit medialocator from appletTransmitter to servlet1 and then save MedialLocator as servlet attribute, then other client can connect to servlet2 that send saved MediaLocator to appletClient.
    APPLETTRANSMITTER:
    URL url=null;
    MediaLocator media=new MediaLocator("vfw://0");
    try{
    url = new URL("http://localhost:8080/servlet1");
    catch(MalformedURLException mue){mue.printStackTrace();}
    URLConnection conn=null;
    try{
    conn = url.openConnection();
    catch(IOException ioe){ioe.printStackTrace();}
    conn.setDoOutput(true);
    OutputStream os=null;
    ObjectOutputStream oos=null;
    InputStream in=null;
    ObjectInputStream iin=null;
    MediaLocator mResp=null;
    String r=null;
    try{
    os=conn.getOutputStream();
    oos=new ObjectOutputStream(os);
    oos.writeObject(media);
    //oos.writeObject("Prova Servlet");
    oos.flush();
    catch(IOException io){io.printStackTrace();}
    catch(ClassNotFoundException cn){cn.printStackTrace();}
    SERVLET1
    ObjectInputStream objin = new ObjectInputStream(request.getInputStream());
    MediaLocator ml =null;
    try{
    ml = (MediaLocator) objin.readObject();
    context.setAttribute("media",ml);
    catch(ClassNotFoundException e)
    {e.printStackTrace()}
    But on servlet1 there is a ClassNotFoundException: MediaLocator
    What do we think about the solution and exception problem?
    Best Regards,
    Nico from Italy

  • Problem while sending RTP stream to QuickTime player

    Hello,
    I am trying to send a RTP video stream from a local file to a Quicktime player.
    The player is waiting for the stream in its default ports (6970/6971). I archieve this by using my own RTSP server.
    I start the transmission by using a processor and a datasink. It seems that I send one or two RTCP packages to port 6971, but not RTP packages are sent.
    This is my code:
    pr = Manager.createProcessor( new MediaLocator("file:/rootDirectory/file.mpg"));
    pr.configure();
    while(pr.getState()==Processor.Configuring){}
    TrackControl[] tracks = pr.getTrackControls();
    tracks[0].setFormat(new VideoFormat(VideoFormat.JPEG_RTP));
    tracks[0].setEnabled(true);
    pr.realize();
    while(pr.getState()==Processor.Realizing){}
    DataSource ds = null;
    ds = pr.getDataOutput();
    String url1 = "rtp://193.147.59.231:6970/video/10"
    MediaLocator m1 = new MediaLocator(url1);
    DataSink d1 = Manager.createDataSink(ds, m1);
    d1.open();
    d1.start();JMF doesn't show any error, but my application just is not sending RTP packages. What could be wrong in my code?
    Kind regards.

    Any clue please? I am frustrated!!

  • Send live stream from local PC to global server

    hello,
    I'd like to capture audio/video from my local PC, and transmit it to a global server, which will send my content to some audiences.
    Since the local PC has no unique IP, the server can't call RTPManager.addTarget(...) to receive live stream.
    Someone recommends me transfer the stream using servlet. But I have no idea.
    Is it possible using JMF RTP, and how?
    Thanks a lot,
    Derek

    Hi Derek,
    I am working on the same thing. I am not able to improve a bit on how to transmit audio captured from my mic. Can u please help me in doing. It will be of much help for me. I would like to transmit sound to computers in the intranet. My email id is [email protected] I would really appreciate if u can help me on this .
    Regards,
    Firmin Dani.

  • Send same stream to multiple audio outputs

    Hi! I've just unsuccessfully tried to send the same output (an iTunes stream) to *headphones line out* and *usb conected speakers* (harman kardon). I've tried with "Soundflower" feature "aggregate audio devices" but I was only able to play from one single output. I also tried with *Audio Hijack pro* but with no luck, maybe because of my lack of experience with that program. Has anyone any clue about this situation? Thanks a lot!!
    p.s.: I don't know if this is the right forum to post my question, moderators feel free to move it to the appropriate one.

    Audio Hijack Pro will do it. Use "Sound" system preference to set output to one device you want. In Audio Hijack Pro's "Input" tab, set "Source Type" to "Application", select iTunes, click "Hijack", make sure "Mute" is off, go to the 'Effects" tab, click the top-left blank square to insert an effect, choose "Auxiliary Device Output" from "4FX Effect" and set "Device" to the other desired audio output. Use "In" gain on the effect to control its volume.

  • Flex: How to send Microphone Stream Audio data to a Rest API

    Hi,
    I needed to capture audio via a microphone and then sent ths instantanesouly to a REST API  for processing. I do not want to use a media server.
    So is it possible to send instataenous audio stream data to my custom servers.
    Thanks,
    Karan

    well i tried this once for one of my scripts and the final conclusion is its not possible to combine two streams into 1.....how would you time/encode the two voices......there is no know solution to this in flash. If you continue on despite me and find a solution please post it so we can explain to rest of world.

  • Sending byte streams with a String

    Hi all,
    I want to control a GPIB-Camac Interface with java. Therefore I have to send the GPIB-Commands via a method sendCommand(String). The problem is that my GPIB device expects byte streams rather than a String. Now I don't know how exactly bytes are handled by a String. If I construct a String like this
    String StartGateA = new String(new byte[] { 25, 0, 1 });
    I think the bytes are converted to Unicode, e.g. to 16 bit values. There's the problem. I need to have a String representing the { 25, 0, 1 } byte array as real bytes, i.e. a String containing of 3 bytes holding the specified numbers.
    Are there any suggestions?
    Thx in advance, Mathias

    see ur concern i suppose is that u want to send
    for eg 3 bytes ie 25 3 1 in the form of String to the device,
    and that once u send it the device should recieve in proper format,
    Am i right?
    if yes then is there a way through which u can check if the array that u r sending is recieved properly?
    If you constrcut a String with String s = new String(new byte[] { 25, 0, 1 }); and try to retrieve the bytes you will get them in the same order, so if u r sending it then it should similarly,
    only if u can check whether the string that u r sending is recieved properly, if not then what is the string that is recieved
    Regards
    Rohan

  • Recording RTMFP P2P stream by sending simultaneous stream to FMS (and other things...)

    Only just getting started on this whole domain of learning, so go easy!
    If I set up a P2P video/audio chat (similar to the sample VideoPhone thing on the Cirrus site), can I get the stream from both parties to send to a server at the same time so that I can record it? If so, would I have to use a FMS to stream it to and perform the recording (and if so which version could I get away with)? Are there any (preferably free, or just tutorialised) solutions for the recording side of things?
    Currently it seems like the only option for doing the P2P thing is to use Stratus/Cirrus unless I use FMS4 Enterprise. Is that correct? 
    Is there any example code out there that can help? Has anyone got any experience of how effective this kind of situation can be, in terms of quality of the stream and recording? Does any of this make sense?
    The Enterprise version of FMS is "Call for price": can anyone give me ball-park figures?
    Would appreciate any advice or pointers on these very general questions.

    can I get the stream from both parties to send to a server at the same time so that I can record it?
         I really do not know how one can do that - it would be like creating separate stream to server and replicating same data which you send to peer and i do not know how useful it would be - again it will increase the load on server which we are trying to avoid using P2P
    If so, would I have to use a FMS to stream it to and perform the recording (and if so which version could I get away with)?
         I think above answer takes care of this. I am not expert on P2P - so someone can correct me if i am completely off
    Are there any (preferably free, or just tutorialised) solutions for the recording side of things?
         Not something i am aware off.
    Currently it seems like the only option for doing the P2P thing is to use Stratus/Cirrus unless I use FMS4 Enterprise. Is that correct?
         Yes - as of now only FMS4 Enterprise edition supports P2P

  • Send PDF stream in SOAP web service call to server

    Hi,
    I have PDF Application form. We will submit the form by using the submit button in the form. The submit button is calling webservice to talk to the server. It is working. I can send the XML value from the PDF to server via webservice.
    But how should I send the PDF stream to the server via webservice(SOAP) call?.
    PLease help me to fix this problem.

    You'll need to Base64 encode the PDF ReadStream and then submit that as an xsd:base64Binary value in your SOAP request.
    Are you using SOAP.connect or SOAP.request to access your webservice?

  • Sending video stream to another network through vpn

    Hello,
    Am christopher from TANZANIA (EAST AFRICAN COUNTRY).
    Please help me.
    we have our cable tv and we want to stream it to our another office in another region, where we have configured a VPN in this two offices using cisco router RV180. I have tried multicast IP but didn't work.
    Please help me how do i send this video signal to another region with our VPN connection. the video is through/output in UDP.
    Any advice please.

    The problem is routing that multicast IP to another network through VPN, and am using RV180 CISCO ROUTER.

  • Sending Live Stream from one FMS to another FMS

    Hey,
    Here's what I would like to do:
    1. The Flash Media Encoder sends a live stream to FMS 1
    2. On FMS 1, a connection to FMS 2 is set up and the live
    stream is sent to FMS 2.
    3. Every second, a message with metadata is sent to FMS 2
    using Stream.send()
    4. A Client connecting to FMS 2 receives the stream and the
    metadata that was sent along with it.
    I know this sounds pretty confusing, but the main problem is,
    that I don't have access to the FMS 2, so I can't call
    Stream.send() there. First I thought the solution would be using
    Stream.play() with a remote connection, but when I call the
    Stream.send() method nothing happens on the client side.
    Then I thought I could do the whole thing by using a client
    side application that connects to FMS 1, receives the stream,
    embeds the metadata and publishes it to FMS 2. Here's the code I
    used:
    // Connect to FMS 1 to get stream
    client_nc.connect("rtmp://localhost/encoder_stream/room_01",
    "Client");
    // Create input stream
    in_ns = new NetStream(client_nc);
    // Connect to FMS 2
    akamai_nc.connect("rtmp://localhost/akamai/room_01",
    "Client");
    // Create new stream, feed with in_ns and send to FMS2
    out_ns = new NetStream(akamai_nc);
    out_ns.publish("stream");
    out_ns.attachVideo(in_ns);
    Unfortunately the attachVideo method only accepts a camera
    and not a netstream object.
    So this is where I'm standing now... anyone any ideas?
    thanks

    Hello,
    i've asked our Akamai contact and they say it's not possible
    to install any scripts on their servers. I think the only way is to
    push the stream from FMS1 to FMS2, but since FMS doesn't support a
    push method, there i have to find another way *sigh*
    I've heard about FMS version 3 coming up soon, and I'd really
    like to play around with the alpha version. Any idea where you can
    get it from? On Steve Wolkoffs blog it says the new FMS is going to
    support a push method:
    http://blogs.adobe.com/dreaming/2006/10/fmsnext_feature_open_thread.html
    I've also played around with the Red5 server, but I couldn't
    find anything there to achieve a server side push method. Does
    anyone have any experience with Red5 and live streaming?
    Cheers!

  • TCP/IP send character stream

    Hi,
    Is there any experience in sending a character stream using TCP/IP from XI to another system?
    Appreciate any suggestions.
    Paul

    Paul,
    Without having experience with this kind of scenario; I can imagine some possible approaches from the context of XI and Java.
    1) Fist Approach
    You could implement a receiver comm. channel of the type file which will receive the data (either text or binary) to be transported via TCP/IP from the Integration Engine. In the configuration of this comm. channel you will trigger a java program/class that will perform the actual TCP/IP connection, obviously the Java program will use the data earlier received by the comm. channel as input parameter.
    2) Second Approach
    You can generate a Java proxy which will act as receiver and effectively do the TCP/IP call.
    As you can see the second approach apparently requires less effort but implies having more system resources (Web As 6.40) to run the necessary J2EE beans needed for Java proxy communication. Nevertheless,  this approach is more elegant and technically/functionally fits in the XI architecture.
    Hopes this mini-brainstorming will help you decide what to do.
    Thanks,
    Roberto

  • Sending MIDI-stream to from my prg to virtual instrument on my computer

    Anyone out there who can give me the lines it takes to send the three bytes
    144, 60 and 127 (chan1, note ON, full volume) from my prg to one of the Virtual Studio Technique Instruments on my computer?
    there are plenty of code samples of how to receive and play MIDI, but not much said abuot transmitting MIDI to a commercial VSTI.

    Ditto.
    You need to look for your itunes library under Computers and select it, then music.
    Music column is for web based content not local content, just to confuse everyone.
    AC

Maybe you are looking for

  • Issue on column length changing in HANA

    Hi Experts, I encounter the following issues. 1. Try to create a column table with a DATE type column, and insert some values. CREATE COLUMN TABLE test1(D DATE); INSERT INTO test1(D) VALUES (CURRENT_DATE); SELECT D, length(D) FROM test1; The result w

  • 5/13/2014 - Release - Flash Player 13

    The next version of Flash Player is available for immediate download.  In today's release we've updated Flash Player with important security updates and bug fixes.  We recommend users update to the latest version. With today's release, we have also u

  • Customer Balance upload vs Vendor balance upload --- URGENT!!!!!!!!!!!!!

    Hi Peers I want to know the difference between Customer Balance upload and Vendor balance upload. How do you upload transactional data upload. If any boby have any documnets for this plz fwd it to me. My email id is [email protected] Its very very ur

  • Search in google sometimes yields click (GIF Image,1x1 pixels) cusing the browser to fail

    search for Verizon using Google and trying to select a www.verizon.com websire yeilds a page identified as click (GIF Image,1x1 pixels) and no other display is made and blocks any page reference

  • Migrating Address Book from Tiger to Leopard

    I migrated all data from old machine (G4 Powerbook) to new machine (MacBookPro), but my address book is now messed up. Contacts are not organized in the same groups as in old machine, and some contacts have multiple addresses that are not correct. Ca