Saving a BufferedImage as part of another file

Hi mates !
I have a program in which the documents it produces are based on images .
I want to save the documents in one complete file containing both the image
and the other data.
the problem is less to store the data then reading it .
at first i thought that i will simply create a new temp picture file
with the original image extention copy the image part of the document to him
and then read the image easily from him.
but in cases where the image file is 50 megas or more it will be slow
and besides its simply not elegant.
then i thought about writing the entire image into a byte array
using ImageIO.write(outputStream) ;
saving the array inside my file and then reading it .
but for some reason a byte array can only be at int size .
what about long cases ?!
so my current idea is to extend the class ByteArrayOutputStream
and make it recieve a list of byte arrays.
and then extend the class ByteArrayInputStream so it will know how to
read that list.
then the ImageIO.read(inputStream) could be called.
but thats very abit complexed , so before i start rearraging the world
of java i want to know if someone here has a nicer solution .
thank you.

to my knowledge, none of the images use a long array. If you are using something that is for some reason, make a method to split up the long array into bytes, and when reading them back in, put the longs back together. The bitwise operators should let you do this without much problem.

Similar Messages

  • I did a backup from all my files saved in old external hd to time capsule. After that double checked and recover one file from TC to mac air and it worked just perfect. Today went through TC to recover another file and none of them were there?

    I did a backup from all my files saved in old external hd to time capsule. After that double checked and recover one file from TC to mac air and it worked just perfect. Today went through TC to recover another file and none of them were there?Anybody has a clue what happened?

    renatocremonese wrote:
    I want to use it for backing up my Mac.
    It's good for that . . . 
    But also I don't keep all my stuff in my Mac.
    But not for that. 
    This older and not day-by-day usage files I want to store in the time machine.
    You can do that (see below), but how are you going to back them up?   If your only copies are on the TC, when (not if) it fails, you risk losing your only copy of the data.
    Is it possible to split TC in two partitions.
    No, but there are some workarounds, including making a fixed-size disk image on it to "reserve" some space.  See #Q3 in Using Time Machine with a Time Capsule.
    But you still won't have backups of the stuff you put there.
    You don't say what kind of Mac you have.  If it's a desktop model, just keep the external HD connected to it, and let Time Machine back it up along with your internal HD.
    However, it sounds like you may have a laptop, where that's not going to be convenient.  In that case, your best bet might be to copy the external HD to a disk image on the TC as above, then keep the HD in a safe place.
    To finish, when i enter the TC and go through the Time line how can I get a file from there and move it back to Mac hd.
    Via the "Star Wars" display, per #15 in Time Machine - Frequently Asked Questions.
    You might also want to review the Time Machine Tutorial, and perhaps browse the rest of the FAQ.

  • Swatches saved to library changing when used in another file. Any idea why?

    Hello,
    I have saved a couple of swatches by applying the colors to squares, then saving them to the library and afterwards loading them in another file. One of the squares changes color when imported onto stage. In the library preview it looks ok.
    Any idea why and how to solve this?
    Marko

    Hi Parth,
    I saw the option in the maintenance screen of the datasource "Delivery of Duplicate Data Recs"; it was set to Undefined but following your guide, I changed it to "Allowed" and activated the datasource.
    Remember the problem was not with the datasource, I was able to execute the infopackage to get the data in the PSA. It is when I try to take it from the PSA to the DSO with the DTP that is where I get the error.
    Does't is mean that everything is ok with the datasource?
    Any way, after changing to "Allowed", I deleted the load in the PSA and reloaded.
    The data now looks good in PSA as before.
    Now, a load to the DSO, by executing the DTP gives same error message.
    Any more hints?

  • I have downloaded a trial version of Photoshop. But it says I don't have access or to open it in another file.  What other file should I open it in?

    I have had this trouble before in trying to set up Adobe Photoshop on my iMac.
    I get it all installed and then it tells me I cannot open it.  That I do not have access. To check "Get info" - well I do have access.
    So then it say to copy it in Finder.  I did that.  But it still won't let me in.
    It then says to try "saving it in another file."  What does this mean?

    Your description is vague and confusing, so I'm afraid nobody really knows what's going on. Perhaps try again using proper terminology and including exact error messages, system info and all that?
    Mylenium

  • Part of sender File name at the receiver side?

    Hello All,
    My requirement is like this.
    iam picking the file from FTP server and place the file in another FTP server with out mapping.
    I need to use part of sender file name to create the receiver side along with current date.
    for example.
    sender side file name : LM01000008.txt
    recevier side file name need to generate : LM01dd/mm/yyyy
    Please let me know how to achive this.
    i tried with the blog given below, but partial file name is not possible with that blog.
    http://www.sdn.sap.com/irj/scn/weblogs;jsessionid=(J2EE3417100)ID0229698450DB11989196758750510369End?blog=/pub/wlg/6400
    Thanks and Regards,
    chinna

    Hi Chinna,
    Use this code
    DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File","FileName");
    SimpleDateFormat dateformat = new SimpleDateFormat("yyyyMMdd");
    String timestamp = dateformat.format(new Date());
    String newfilename=fileName+timestamp+".txt";
    // change to new file name
    conf.put(key, newfilename);
    return "";
    Regards
    Suraj

  • Reading a File by Knowing a part of the file name

    Hi Java Gurus,
    Can I copy a file to another location by knowing a part of the file name.I know the extension of the file and part of the file name.Can I copy such a file to another directory?
    Eg :
    0099999999_JAPPLIC_20090320.pdf is the file name.
    I know the file name contains 'JAPPLIC' .Can I use this clue and the extension of the file to copy the file to another directory.
    Please let me know whether it is possible or not.
    Regards,
    Rakesh.

    Hi ,
    I used the below code and I was able to solve the problem.I was able to select the files of the required extension and serach for the file names containing the text I know and use such files and move to another directory.It may be helpfulk to you people
    public class FileDeletion {
    public static void main (String args[]) {
         String e = "";
         String d = "C:\\TCCTouchpoints\\Attachments_Export\\outbound";
         String newFileLoc = "C:\\TCCTouchpoints\\Attachments_Export\\move";
    ExtensionFilter filter = new ExtensionFilter(e);
    File dir = new File(d);
    File newLoc = null;
    String[] list = dir.list(filter);
    if (list.length == 0) return;
    System.out.println("File Length "+list.length);
    ArrayList fileNames = new ArrayList();
    for (int i = 0; i < list.length; i++) {
    /*file = new File(d + list);
    boolean isdeleted = file.delete();
    System.out.print(file);
    System.out.println( " deleted " + isdeleted);*/
         System.out.println(list[i]);
         if(list[i].contains("_F5029.03_")){
              fileNames.add(list[i]);
              //System.out.println(list[i]);
    dir = null;
    for(int i=0;i<fileNames.size();i++){
         dir = new File(d+"\\"+fileNames.get(i));
         newLoc = new File(newFileLoc+"\\"+fileNames.get(i));
         if(dir.renameTo(newLoc)){
              System.out.println(dir + " is moved to "+ newLoc);
         }else {
              System.out.println("***** " dir " is not moved to "+ newLoc);
         dir = null; newLoc = null;
    for(int i=0;i<list.length;i++){
         dir = new File(d+"\\"+list[i]);
         dir.delete();
    class ExtensionFilter implements FilenameFilter {
    private String extension;
    public ExtensionFilter( String extension ) {
    this.extension = extension;
    public boolean accept(File dir, String name) {
    return (name.endsWith(extension));
    Thanks for replying .......

  • Transfer file in application server to another file

    Hello guys I have another major hurdle I am encountering for a little task I am doing.
    I need to send a downloaded file within the SAP application server to another file automatically using ABAP via Background Processing(most preferable a directory in the <b>newtwork</b>).
    What I need to do is, after saving a list from an abap report and saves in the application server (which I have already done), I need it to transport to a the web server. All done in background.
    I really appreciate the help you guys have given to me thus far. Thank you guys and take care.

    Hi
    U have to use unix command for same
    i have seen some function module just check it out
    SXPG_CALL_SYSTEM you can check the user's authorization for the specified command and run the command. The command runs on the host system on which the function module is executed. The function module is RFC capable. It can therefore be run on the host system at which a user happens to be active or on another designated host system at which an R/3 server is active.
    <b>SXPG_COMMAND_CHECK</b> Check whether the user is authorized to execute the specified command on the target host system with the specified arguments.
    <b>SXPG_COMMAND_DEFINITION_GET</b> Read the definition of a single external OS command from the R/3 System's database.
    <b>
    SXPG_COMMAND_EXECUTE</b> Check a user's authorization to use a command, as in SXPG_COMMAND_CHECK. If the authorization check is successful, then execute the command on the target host system.
    <b>SXPG_COMMAND_LIST_GET</b> Select a list of external OS command definitions.
    <b>RZL_READ_DIR_LOCAL</b> Read a directory on the Application Server
    <b>SUBST_GET_FILE_LIST</b> Return table with file list for the given directory (pattern allowed)
    regards
    vinod

  • SSIS - creating part of the file name from an id in the database

    I am trying to figure out how to pull an "id" from my data source to include in the file name. Right now the file name created looks like customer_002_timestamp.txt. I need to add the id to the file name and I need to grab it at the time I get
    the data, so then the file name becomes customer_002_id_timestamp.txt.
    My data source is Oracle and I am using Attunity, so I do not have the capability of using the resultset found in the SQL Task because I have to use the data task.
    Has anyone ever extracted an id from a query against Oracle using the Attunity connector to add as part of the file name? If so, how would I add that to my control flow task?
    Thanks in advance for any assistance.

    Is it a static id value you want
    Then you can just use a SSIS variable to hold value from resultset in execute sql task
    Then inside your data flow you can use an expression for setting value of another variable which can be used for setting filename in your destination task. The expression will include logic to concatenate id variable also which we populated in the previous
    step.
    Please Mark This As Answer if it solved your issue
    Please Vote This As Helpful if it helps to solve your issue
    Visakh
    My Wiki User Page
    My MSDN Page
    My Personal Blog
    My Facebook Page

  • Initialize a global with a global from another file

    hi,
    I know that initialization order for global variables across compilation units is not defined, but if I have
    file1.cpp
      int x0 = 33, x1 = 55;
      extern int y0, y1;
      static int a[] = { y0, y1 };
      void print_a( void ) { printf( "\na[0] = %d\na[1] = %d", a[0], a[1] ); }
      extern void print_b( void );
      main()
        print_a();
        print_b();
    and file2.cpp
      int y0 = 77, y1 = 99;
      extern int x0, x1;
      static int b[] = { x0, x1 };
      void print_b( void ) { printf( "\nb[0] = %d\nb[1] = %d", b[0], b[1] ); }
    I notice that values are displayed correctly and consequently, initialized in the order I need. So what's the secret, coincidence, am I lucky? Does it make any difference if file2.cpp is part of a static library?
    Thanks

    @ Igor Tandetnik: Yes, I chose an example with circular dependency just to show that it was not the situation that, by luck, the "other" file was was initialized first. Yes, I would like a solution for such circular dependency, but I hope that I will
    find, at least, a solution for the case when such circular dependency does not exist. What I want to achieve? As the title says, I want a solution to be able to initialize globals with globals from another file, a solution as general and fault proof and convenient
    as possible.
    @ Wyck: I thought about something like that, problem is that in case of large arrays there is a lot to type. Another solution (it saves a little typing) I saw was something like
    // common_header.h
    #define LIST_A  y0, y1
    #define LIST_B  x0, x1
    // file1.cpp
    #include "common_header.h"
    Number x0(33), x1(55);
    static Number a[] = { LIST_A };  // just to give correct size
    // file2.cpp
    #include "common_header.h"
    Number y0(77), y1(99);
    static Number b[] = { LIST_B }; // just to give correct size
    // init.cpp
    extern Number LIST_A, LIST_B;
    void init()
    {  Number a_[] = { LIST_A };   Number b_[] = { LIST_B }; // stack usage
       for( int i = 0; i <_countof( a_ ); i++ )  a[ i ] = a_[ i ];
       for( int i = 0; i <_countof( b_ ); i++ )  b[ i ] = b_[ i ];
    This still has the problem of using much stack in case of large arrays and if array members are more complex structures (might also contain string literals), there is a bit more difficult.
    Bellow is a solution I came up with using macros but which I don't really like because is a bit cumbersome. I'm looking for something better/more elegant/safer or simply I want to see what other solutions people see here.
    // file1.cpp -------------------------------------------
    #define MEMBER_LIST( Usage ) \
    Usage( x1 ) \
    Usage( x2 )
    #define IMPORT( ext_member ) extern Number ext_member;
    #define COUNT( member ) 1 +
    #define LOAD( member_val ) a[ i++ ] = member_val;
    Number y1 = 77, y2 = 99;
    MEMBER_LIST( IMPORT )
    static Number a[ MEMBER_LIST( COUNT ) 0 ];
    static void InitGlobals_a( void ) { uint8 i = 0; MEMBER_LIST( LOAD ) }
    extern void InitGlobals_b( void );
    int _tmain(int argc, _TCHAR* argv[])
    { InitGlobals_a();  InitGlobals_b();
    return 0;
    // file2.cpp -------------------------------------------
    #define MEMBER_LIST( Usage ) \
    Usage( y1 ) \
    Usage( y2 )
    #define IMPORT( ext_member ) extern Number ext_member;
    #define COUNT( member ) 1 +
    #define LOAD( member_val ) b[ i++ ] = member_val;
    Number x1 = 33, x2 = 55;
    MEMBER_LIST( IMPORT )
    static Number b[ MEMBER_LIST( COUNT ) 0 ];
    void InitGlobals_b( void ) { uint8 i = 0;  MEMBER_LIST( LOAD ) }
    Of course, something like
    #define MEMBER_LIST( Usage ) Usage( x1 ) Usage( x2 )
    could be further simplified using other macros so you can simple use
    #define MEMBER_LIST x1, x2
    but those additional macros will add up to the complexity.

  • Send from file to http server and save http/xml response to another file

    Hallo,
    is there anybody who made running simple think. Read xml file, send it to http server using plain HTTP adapter and then wait for response which is to be saved as another file?
    ThanX a lot.
    Honza Vrzak

    Hello Honza,
    I've made running these two asynchronous scenario. Maybe that might help you?
    1.a) FileAdapter picks up XML and sends it to XI2.0
    1.b) XI uses PlainHTTP-Adapter to sends the message to Webserver
    1.c) HTTPRequestHandler (written in C#) receives the XML and writes it to HD.
    2.a) JavaScript sending an XML to PlainHTTP adapter of XI2.0.
    2.b) XI sends the message to FileAdapter
    2.c) FileAdapter writes the XML to HD
    What you need is an synchrounus scenario and I think I remember that the fileadapter is not able to work synchrounus. So I think you have to combine these two scenarious to one.
    Regards Björn

  • One photo's document size says 60M at the left bottom of the image I saved it, became 2.8M. Another photo's doc size 50M, I saved it , became 12M. Why?

    One photo's document size says 60M at the left bottom of the image, I saved it, became 2.8M. Another photo's doc size 50M, I saved it , became 12M. Why?

    You're looking at several different things.
    File size is the size of the compressed image data plus file format overhead for whatever format you select.
    Flat document size is the size of the document if flattened, but not compressed.
    The document size in memory is how much RAM is used by the document, including all layers and other data it needs.

  • My links don't work when I combine another file with the pdf

    My internal bookmarked links don't work when I combine another file with the pdf.
    The external links continue to work fine, though.
    This doesn't make any sense to me at all ... but I'm hoping one of you kind folk can help?

    I opened my file and instead of merging files I used insert pages and inserted all of the pages from the file I wanted.  Then I saved the file with
    the same name.  Attached is a rough draft of some helpful hints I put together.  This has been a very painful process for us to discover how to handle
    this and there really is not much help from Adobe.
    Instead of merging files you inset pages. In Acrobat select Document - Insert pages -From file. You can select all pages or some and where you want them inserted. After you do that save the file not save as and all of your links should work. If you combine files or merge files all of the links will break.
                                                                                    GillHarley <[email protected]>                                                                              
    05/07/2009 09:54 AM                                                                                To
                                                                        "Christine Salmon" <[email protected]>                                                                              
    cc
                                Please respond to                                                                              
    [email protected]                                                                                 Subject
                                    dobe.com                            Acrobat Windows My links don't work when I combine another file with the pdf
                                                                        29k833-1Kp0-8ahk                                                                              
    I think it's something to do with naming, but I can't figure out what. This is because it asks to be saved and gives me a Binder no as the name. If I
    press Cancel at that point, I keep the file and the links. But as soon as I need to close it, it asks me again 'Do you want to save this file' and if
    I say 'Yes', I lose all the links, and if yet if I say 'No', I lose the whole file. So at some point it has to be saved but whether I keep the Binder
    no name when I save it, or use the original name, it makes no difference ... it is in the saving of it that it looks the functionality, and yet, if I
    don't save it, I lose the file.
    This makes no sense to me....I hope it does to one of you.
    For instance, Christine, how did you keep your file if you couldn't save it?
    Or have I misunderstood?

  • Everytime i try and download any apps i get an error message telling me that part of the file seems to be corrupted.  How do i resolve this issue

    Everytime i try and download any apps i get an error message telling me that part of the file seems to be corrupted.  How do i resolve this issue

    Could be.
    This may be hard to believe, but I think my problem was that the built-in WiFi adapter on my HP desktop had
    gotten flaky. I switched to a Buffalo USB WiFi and the problem immediately disappeared. I never saw any errors, etc. from the Ralink adapter. Strange.  Might try another type of connection to the Internet.

  • Can you reference another file within a grid in financial Reporting Studio.

    I'm trying to calculate % of Revneue with in grid. Rather than making the file larger by adding another grid with the Revenue values, I'd like to know if there's a way to reference another file which already includes the revenue data. Thanks

    My issue is that the spreadsheet won't fit on a page - it's several worksheets and the margins aren't the same. What I'd like to do is imbed the numbers (or excel or pfd or jpg) icon as part of a summary paragraph. If the reader wants to see the spreadsheet/document/photo, he/she can click on it and open the spreadsheet (or pdf file). I've done this with LotusNotes (yes, I'm dating myself) and believe that it can be done in Word. So I am hopeful that there is a way to do it in Pages.

  • Parts of AVCHD files

    hi - i have some old footage from a sony handycam, which is saved to my imac as an avchd file.  it is a large file - around 60gb. 
    unfortunately, i don't have all the related files/folders that are usually appended to the AVCHD file (i believe it normally comes in 4 parts?).  i just have the AVCHD file itself. 
    i am able to get some use out of the AVCHD file.  i can click on the file and it opens in quicktime and displays all of the 200 "clips" that are sitting in the file.  i can then play any one of the individual clips that sit in the AVCHD file. 
    however, i would like to be able to break the file up to be able to edit / email different clips separately.  however, when i drag the file into iphoto it inevitably crashes due to its large size. 
    any tips as to how i might be able to process this file would be much appreciated.
    thanks. 

    The AVCHD file structure is shown in:
    http://commons.wikimedia.org/wiki/File:AVCHD_actual_file_structure.jpg
    The actual movie clips are in the subfolder "STREAM".  You can import these indivdually or in groups directly into iMovie 10.  (In iMovie 9 you have to convert them first).  I don't know about iPhoto since I don't use it.
    In iMovie 10  you can then sort them how you like into into different events.  In each event they will appear in chronolgical order and If you select View - Show separate days in events  they will be grouped into each day's shoots.
    Geoff

Maybe you are looking for

  • Do I Need Airport Express If Both My iMac and MacBook Have Airport Cards

    Just ordered a new MacBook that has a built-in airport card. Also will be using my good old iMac (both running Leopard 10.5.6). Since both computers have the built-in airport cards, do I still need Airport Express so I can use a WiFi network? I've al

  • RE: how can two Forte installtion communicate

    Hi, I have similar arrangement here but for "user acceptence test". However, may I remind you that when some objects/codes got checked out --> overwrite with new import --> integrate --> check out again. Some funny things ( I would say corruption ) m

  • InDesign CC Server 2014 app.open() File does not exist.

    I've set up InDesign CC Server 2014 trial on a Windows Server 2008 R2 and trying to run a simple script that converts a idml to PDF. Here's the code document = app.open(File("C:\inetpub\wwwroot\presentation\Documents\Resumes.idml")); document.exportF

  • Running zul application in Oracle AS 10g

    Hi All, While I am running zul application in Oracle Application Server 10.1.2, I am getting the following error... java.lang.NoClassDefFoundError: javax/servlet/jsp/el/VariableResolver     at org.zkoss.zk.ui.http.DHtmlLayoutServlet.init(DHtmlLayoutS

  • LMS 4.2.3 - C6500 VSS - Issue with inline card on secondary chassis

    Hello, We are currently setting up a fresh new LMS 4.2.3 server to administrate a 90 LAN-device-perimiter. Installation is OK (on a Windows Server), devices are up, monitored and their configurations archived. The core switches are Catalyst 6506 VSS