How can I convert an InputStream to a FileInputStream ???

How can I convert an InputStream to a FileInputStream ???

Thanks for you reply, however, I am still stuck.
I am trying to convert my application (which runs smoothly) to a signed applet. The following is the original (application) code:
private void loadConfig() {
String fileName = "resources/groupconfig";
File name = new File(fileName);
if(name.isFile()) {
try {
     ObjectInputStream in = new ObjectInputStream(new FileInputStream(fileName));
     pAndGConfig = (PAGroupsConfig)in.readObject();
     in.close();
     return;
} catch(ClassNotFoundException e) {
     System.err.println("++ERROR: "+e);
} catch(IOException e) {
     System.err.println("++ERROR: "+e);
System.out.println("Can't find file: " + fileName);
Because all code and resources now reside in a Jar file (for the signed applet), I must use the following line to access the resources:
InputStream is = this.getClass().getResourceAsStream(fileName);
I then need to convert the 'InputStream' to 'ObjectInputStream' or 'FileInputStream' so that I can work with it.
I would be very grateful if you could help shed some light on the matter - Cobram

Similar Messages

  • How can I convert stream to byte and byte to stream

    I got a IInputStream from BackgroundDownloader operation, how can I convert it to byte array? I try to convert it to buffer and after that to bytes, but it's always throw exception.
    function decryptStream(inputStream, totalBytes) {
    var reader = new Windows.Storage.Streams.DataReader(inputStream);
    var iBuffer = reader.readBuffer(totalBytes);
    var bytes = Windows.Security.Cryptography.CryptographicBuffer.copyToByteArray(iBuffer);
    Could I have examples about that?

    Hi Jeft,
    In my program, I have a BackgroundDownloader to download an image. When we have result, I will convert it to bytes array.
    if (p.hasResponseChanged && imageStream == null) {
    imageStream = operation.getResultStreamAt(0);
    if (!p.hasResponseChanged && imageStream != null) {
    decryptStream(imageStream, p['bytesReceived']);

  • How can I convert an int to a string?

    Hi
    How can I convert an int to a string?
    /ad87geao

    Here is some the code:
    public class GUI
        extends Applet {
      public GUI() { 
        lastValue = 5;
        String temp = Integer.toString(lastValue);
        System.out.println(temp);
        showText(temp);
      private void showText(final String text) {
        SwingUtilities.invokeLater(new Runnable() {
          public void run() {
            tArea2.setText(text + "\n");
    }

  • How can I convert an OVM vm (.img) to VDI (virtualbox)?

    Hi,
    how can I convert an OVM vm (.img) to VDI (virtualbox)?
    Is .img format a raw image? If yes can I use "VBoxManage convertdd" to convert from .img to vdi?
    tnx & regards,
    S.

    Hi,
    "VBoxManage convertdd" solved.
    Regards,
    S.

  • How can I convert an AUDIO MPEG-4 to an MPEG3 format? I need it for a Powerpoint Presentation

    How can I convert an AUDIO  MPEG-4 to another type of file, such as MPEG3  or mp3

    Use Handbrake.
    You can download it for free from this site:
    http://www.macupdate.com/info.php/id/12987/handbrake
    Good luck

  • I want to remove the monitor from my 17" Macbook Pro 2008 to use as an external for my Macbook Pro 15" 2012. How can I convert lvds to Thunderbolt and power the monitor?

    I want to remove the monitor from my 17" Macbook Pro 2008 to use as an external for my Macbook Pro 15" 2012. How can I convert lvds to Thunderbolt and power the monitor?

    It's almost impossible.  The new iMacs have a Target Display Mode, but it's built to do that.  Without ripping your screen out, finding an acceptable power supply, frame, and whatever electronics to convert a Thunderbolt signal to the screen, the cost will be much larger than buying a cheaper HiDef monitor that runs with an HDMI to Thunderbolt cable to your MacBook 15.  In fact, you can sell your 17" MBP for a lot of money, unless it's broken or something, buying you a really sweet monitor.
    By the way, I found your answer by searching this forum.  I would suggest using the search function here in the futuere.

  • How can I convert an array off byte into an Object ?

    Hi folks...
    I�m developing an application that comunicates a PDA and a computer via Wi-Fi. I�m using a DataStream ( Input and Output ) to receive / send information from / to the computer. Most off the data received from him is in the byte[] type...
    How can I convert an array off byte ( byte[] ) into an Object using MIDP 2.0 / CLDC 1.1 ?
    I found on the web 2 functions that made this... but it uses a ObjectOutputStream and ObjectInputStream classes that is not provided by the J2ME plataform...
    How can I do this ?
    Waiting answers
    Rodrigo Kerkhoff

    There are no ObjectOutputStream and ObjectInputStream classes in CLDC. You must know what you are writing to and reading from the DataStream. You should write the primitives like int, String to the DataOutputstream at one end and read those in exactly the same sequence at the outher end using readInt(), readUTF() methods.

  • How can I convert a class file to Exe file

    hai
    How can I convert a class file to Exe file

    Please search the forums before asking questions - this has been answered hundreds (really!) of times.

  • How can I convert multiple files at one time and not one at a time

    How can I convert multiple files at one time and not one at a time

    Hi Plissey1950,
    Sorry for the lengthy delay to a response.  Are you trying to convert multiple files to individual PDF files at the same time? (not combine them).  If so, you'll need to use Adobe Acrobat for this function. The CreatePDF service does not have the ability to convert multiple files to multiple individual PDF files.
    Thanks,
    David

  • I recored a video with my ipad, downloaded it to my mac but I cant upload it to Youtube because the format IMG is not a video format. How can I convert it?

    How can I convert a video I took with my ipad on the format IMG to a supported format for Youtube?

    To upload videos to YouTube we have to make sure videos are in a format that YouTube accepts. Here’s the list of some well-known video formats which YouTube supports:
    WebM files (Vp8 video codec and Vorbis Audio codec)
    MPEG4, 3GPP and MOV files – (typically supporting h264 and mpeg4 video codecs and AAC audio codec)
    AVI (Many cameras output this format – typically the video codec is MJPEG and audio is PCM)
    MPEGPS (Typically supporting MPEG2 video codec and MP2 audio)
    WMV)
    FLV (Adobe – FLV1 video codec, MP3 audio)
    But I think you get the wrong video file. iPad recorded video files are in m4v, mp4, mov, avi format but not the img files. Anyway, if you need a video converter, Format factory or iFunia video converter are good choice.
    Good luck!

  • I have two apple id's how can i convert them two one

    I have 2 apple id. How can i convert to one?

    Currently there is no path for that.
    Pick the Apple ID or iTunes account that you want to use and stick to it for all purchases as you cannot consolidate purchases from multiple accounts.
    MJ

  • How can i convert video files from my mac to watch them on my iphone?, how can i convert video files to watch them on my iphone?

    how can i convert video files from my mac to watch them on my iphone?, how can i convert video files to watch them on my iphone?

    Turns out the answer to that question changes if you ask it more than 4 times, so ask it again....
    The answer depends on the type of video files you want to convert.  If they are DRM protected commercial videos, no help can be given here.  Google.

  • I have 13 dollars left on an apple store gift card, how can I convert this into money for my iTunes account?

    I have 13 dollars left on an apple store gift card, how can I convert this into money for my iTunes account?

    You can't.

  • HT3775 how can i convert a mod file (on vlc) to mp4 to work on quicktime

    how can i convert a mod file (on vlc) to mp4 to work on quicktime
    when i connected my video camera and imported the videos, they're default is to play on vlc
    they are mod files
    i want to edit the videos on imovie and for that the videos need to be mp4 and open in quicktime player
    what do i do

    iPhone supports
    Video formats supported: H.264 video up to 1080p, 30 frames per second, High Profile level 4.1 with AAC-LC audio up to 160 Kbps, 48kHz, stereo audio in .m4v, .mp4, and .mov file formats; MPEG-4 video up to 2.5 Mbps, 640 by 480 pixels, 30 frames per second, Simple Profile with AAC-LC audio up to 160 Kbps per channel, 48kHz, stereo audio in .m4v, .mp4, and .mov file formats; Motion JPEG (M-JPEG) up to 35 Mbps, 1280 by 720 pixels, 30 frames per second, audio in ulaw, PCM stereo audio in .avi file format
    If your video is supported, drag it to iTunes and sync it to your iPhone.

  • How can I convert a pdf to OSX10.8 so I can submit a manuscript to the itunes store. I have a windows computer only.

    How can I convert a pdf file to an OSX.10 so I can submit a manuscript to the itunes store?

    Perhaps you want to submit an "ePub" to iTunes?
    If so then revisit the authoring files for the manuscript and go to ePub from there.
    Getting to ePub from PDF is really rather awkward.
    Lotsa "use me", "use me" software that purports to solve this; but, really, it doesn't.
    So, again - - authoring files to ePub.
    One example: use Word and Calibre.
    Might groom with Sigil.
    Pipe out the finalized ePub to iTunes.
    Do the Snoopy dance.
    Be well...

Maybe you are looking for