Reading in a multi dimension binary array

Greetings,
I am attempting to read in a binary file which contains data in a 1440x320x7x2 array. The method I am currently attempting to use is DataInputStream. But, it seems this method can only return a single dimensional array. Any tips?
TIA

It depends how it was written. If it was written by calling writeObject() on the whole 4D array, then calling readObject() will give you that whole array back.
If it was written by writing out individual elements with writeData, then you'll have to use readData and build up the array piecemeal.
If it was something inbetween, like calling writObject 1440 times on the 3D arrays, then you'll have to do the inverse of that.
See the pattern?

Similar Messages

  • Multi-dimensioned global arrays

    I'm using a couple of global multi-dimensioned string arrays (they're used in multiple functions throughout the program) and I don't know the boundaries of either dimension until run-time.
    It works fine to use the "new" on a single-dimensioned array, but I'm getting a compiler error when I try:
    std::string* dta = new std::string[x][y];
    Any ideas what the problem is?

    It works fine to use the "new" on a single-dimensioned array, but I'm getting a compiler error when I try:
    std::string* dta = new std::string[x][y];
    How do I declare a 2d array in C++ using new?
    http://stackoverflow.com/questions/936687/how-do-i-declare-a-2d-array-in-c-using-new
    - Wayne

  • DAQ vi to perform digital write and read measurements using 32 bits binary data saved in a file

    Hi
    DAQ vi to perform digital write and read measurements using 32 bits binary data saved in a file
    Two main
    sections:
    1)     
    Perform
    write and read operations to and fro different spread sheet files, such that
    each file have a single row of 32bits different binary data (analogous to 1D
    array) where the left most bit is the MSB. I don’t want to manually enter the
    32 bits binary data, I want the data written or read just by opening a file
    name saves with the intended data.
          2)     
    And
    by using test patterns implemented using the digital pattern generator or  build digital data functions or otherwise, I need to
    ensure that the     
                binary data written to a spreadsheet file or any supported file type
    then through the NI-USB 6509 is same as the data read.
    I’m aware I can’t use the simulated
    device to read data written to any port but if the write part of the vi works I
    ‘m sure the read part will work on the physical device which I’ll buy later.
    My Plan
    of action
    I’ve
    created a basic write/read file task and a write/read DAQ task for NI USB 6509
    and both combine in a while loop to form a progress VI which I’m confuse of how
    to proceed with the implementation.
    My
    greatest problem is to link both together with the correct functions or operators
    such that there are no syntax/execution errors and thus achieve my intended
    result.
    This
    project is one of my many assignments for my master thesis, so please i’ll
    appreciate every help as I’m not really efficient with LabVIEW programming but
    I prefer it because is fun and interesting if I get to know it.
    Currently I’m
    practicing with LabVIEW 8.6/NI DAQmx 8.8 Demo versions and NI USB 6509
    simulated device.
    Please see
    the attached file for my novice progress, thanks in
    advance for the support
    Rgds
    Paul
    Attachments:
    DIO_write_read DAQ from file.vi ‏17 KB

    What does your file look like?  The DAQmx write is expecting a single U32 value, not an array of I64. 
    Message Edited by vt92 on 09-16-2009 02:42 PM
    "There is a God shaped vacuum in the heart of every man which cannot be filled by any created thing, but only by God, the Creator, made known through Jesus." - Blaise Pascal

  • Regarding Dimensions of Array

    Hi ..well i am just wondering wht is the limit to Dimension of Array in Java. my ultimate goal is to handle large matrices.
    Looking forward for your response..thanking u ..!!

    Hmmm... that question could be interpreted in at least two ways.
    1. How many dimensions can an array type have? I believe the answer is around 255.
    2. How many levels of arrays can be stored in any array? This is limited only by available memory.
    Remember that "multidimensional arrays" are really just arrays of arrays, and that arrays are objects. Thus, you could have an array of objects whose elements are actually arrays:
    Object[] deep = new Object[10];
    deep[0] = new Object[10];
    ((Object[]) deep[0])[0] = new Object[10];
    ((Object[]) ((Object[]) deep[0])[0])[0] = new Object[10];
    // etc.Actually, an element of an array can be a reference to the array itself:
    Object[] recursive = new Object[1];
    recursive[0] = recursive;so in a sense that is a "bottomless" array!
    If you're willing to code the array accesses with lots of casts, you can handle any number of dimensions, and even arrays of "ragged" dimension.

  • I can't choose multi dimension member for report and summary by quarter

    Dear Masters in SAP BPC,
    I am a newbie on BPC Netweaver, I am doing  practices follow by SAP BussinessObjects Planning and consolidation (Sridhar Srinivasan and Kumar Srivinasan) .
    At chapter 5 , I made a report as below:
    create a report : click BUILD A REPORT USING A DYNAMIC TEMPLATE
    select SUBTOTAL BY ACCOUNTS(TREND) and open it
    I can not  choose multi dimension and ALL RB Products, I chose 2009.TOTAL
    and then : I choose CY7000, 2009.TOTAL
    when I show reports but no value to show on report, I check on BI , data is ok
    I ignore  this case, I continue with other report, using EVDRE,
    in colume: TIME,
    in ROW : RB_ACCT
    member set : SELF, DEP
    but the  result the same before report.
    Please help me the way that I can show data on my report.
    Thank you so much for you help
    Best regards
    Chinh

    This is my data when I set memberset of TIME  dimension:
    TOTREV     Total Revenue               28,000.00      72,000.00                          20,000.00                80,000.00
    REVENUE     Revenue               28,000.00      72,000.00                          20,000.00                80,000.00
    REVADJ     Adjusted Revenue
    Edited by: Pham Chinh Thi on Jan 11, 2012 10:23 AM
    Edited by: Pham Chinh Thi on Jan 11, 2012 10:24 AM

  • Two dimension string array in teststand

    Hello,
    I want to pass a two dimension string array from a labWindows dll into Teststand. My labwindows dll:
    #define NR_columns 12
    #define NR_rows  1200
    #define NR_hight   1024
    int__declspec(dllexport) __stdcall  sort( char pspec[NR_columns][NR_rows][NR_hight])
    The call of the dll in teststand looks like the attached picture in the doc file.
    and I got the error message which shows the attached second picture in the doc file
    what is the problem?
    regards
    samuel
    Attachments:
    Error1.doc ‏94 KB

    Hello Samuel,
    I'm not experienced in LabWindows but I think the reason for this Error is the dimension of FileGlobals.loadspec in TestStand. The Error Dialog displays for this String Array [0..11][0..1200]. That's an array of 12 and 1201 elements but function is expecting 12 and 1200 elements.
    I hope this helps.
    Kind regards
    C. Dietz
    Test Engineering
    digades GmbH
    www.digades.com

  • Can PQO been used in DML statements to speed up multi-dimension query ?

    We have
    limit dim1 to var1 ne na
    where dim1 is a dimension.
    var1 is a variable dimensioned by dim1.
    This is pretty much like SQL table scan to find the records. Is there a PQO (parallel query option)-like option in DML to speed up multi-dimension query ?

    This is one of the beauties of the OLAP Option, all the query optimisation is managed by the engine itself. It resolves the best way to get you the result set. If you have partitioned your cube the query engine will perform the same way as the relational query engine and employ partition elimination.
    Where things can slow down is where you used compression, since to answer a question such as "is this cell NA?" all rows in the cube need to be uncompressed before the query can be answered and result set generated. Compression technology works best (i.e. is least intrusive in terms of affecting query performance) where you have a very fast CPU. However, the overall benefits of compression (smaller cubes) nearly always outweigh the impact of having to uncompress data to answer a specific question. Usually the impact is minimal if you partition your cube, since the un-compress function only needs to work on a specific partition.
    In summary, the answer to your question is "No", because the OLAP engine automatically optimises the allocation of resources to return the result-set as fast as possible.
    Is there a specific problem you are experiencing with this query?
    Keith Laker
    Oracle EMEA Consulting
    OLAP Blog: http://oracleOLAP.blogspot.com/
    OLAP Wiki: http://wiki.oracle.com/page/Oracle+OLAP+Option
    DM Blog: http://oracledmt.blogspot.com/
    OWB Blog : http://blogs.oracle.com/warehousebuilder/
    OWB Wiki : http://wiki.oracle.com/page/Oracle+Warehouse+Builder
    DW on OTN : http://www.oracle.com/technology/products/bi/db/11g/index.html

  • Reading HDD Temperature from a RAID Array (nForce4)

    Hello all!
    does anybody know of a program that can read the HDD temperature from a RAID Array?
    I'm using Speedfan at the moment but the author doesn't seem to like nVidia at all, thus no support for us.

    I read:
    Quote
    To sum it up : The nvidia raid controller doesn't support it .
    That's not true really, because the nVidia utilities support reading the SMART status from the array. So it can be done, it's only matter of having the documentation or doing some research. However Speedfan's author doesn't like nVidia so he's not going to do anything, unless a doc is handed to him.
    I wonder whether the linux community has worked it out 

  • Read file into multi-dimensional array - ideal world...

    Hello all, would be very grateful if you could help me...
    I have a file which has a format...
    string1a,string1b
    string2a,string2bi need to read this file, which will have a variable length, into a two dimensional array.
    the code below is just demonstrating my approach...
              List lines = new ArrayList();
              BufferedReader in = new BufferedReader(new FileReader(filename));
              String str;
              while ((str = in.readLine()) != null) {
                   lines.add(str.split(","));
              in.close();but when i later try and invoke the toArray() method of lines it complains about unsafe or unchecked operations.
    does any have any pointers about the best way to read a file into a multi-dimensional array? is it best practice to use the interface List?
    thanks in advance
    poncenby

    This is just a List of Lists - no worries there.
    Sounds like your toArray code is incorrect. Post that.
    %

  • Trying (and failing) to read XML multi-dimensional data array

    i.e.
    <mpp:Vehicle>
      <mpp:Vehicle_Rgtrn_Ref>?</mpp:Vehicle_Rgtrn_Ref>
      <mpp:Vehicle_Model_Code>?</mpp:Vehicle_Model_Code>
      <mpp:DrivingRestrictionCode>?</mpp:DrivingRestrictionCode>
      <mpp:Object_Mnfct_Year>?</mpp:Object_Mnfct_Year>
      <mpp:Building_Number_const>1</mpp:Building_Number_const>
      <mpp:Building_Name>The Slums</mpp:Building_Name>
      <mpp:Sub_Building_Name>Flat 1</mpp:Sub_Building_Name>
      <mpp:Postcode_Area_Ref>???? ???</mpp:Postcode_Area_Ref>
      <mpp:Covers>
        <mpp:Cover>?</mpp:Cover>
        <mpp:Cover>?</mpp:Cover>
        <mpp:Cover>?</mpp:Cover>
      </mpp:Covers>
    </mpp:Vehicle>
    <mpp:Vehicle>........
    I'm currently trying to create a web service to read a SOAP message containing such XML. When reading the message, EDQ converts the singleton nodes in each Vehicle node group to a stringarray but only provides the last Cover node in each Vehicle in a stringarray. I'm not in control of the XML structure so trying to get the supplier to concatenate each vehicles covers into a delimited list within a single node may be a battle.
    Anybody else ever encountered this? Is it possible or am I flogging a dead horse trying to achieve this.
    Thanks in advance.
    Jon

    Hi Richard,
    Thank you for your suggestion to my colleague Jon regarding -multi in option. As he said, w
    hat we currently get when we have a SOAP message containing <Covers><Cover>A</Cover><Cover>B</Cover><Cover>C</Cover></Covers> is an EDQ stringarray containing the value {C}.
    I've tried your suggestion
    and ran the wsdlizer with the -multi in option but the wsdlizer fails with the following error:
    H:\Workspaces\svn\edqTrunk\EDQ\WebServices\WSDL>java -jar wsdlizer.jar -o lv-mpp-query-request-ws.jar -multi in MPP_Query_Request_Service.wsdl
    INFO: 10-Sep-2013 13:24:07: wsimport succeeded
    Problem encountered during annotation processing;
    see stacktrace below for more information.
    com.datanomic.director.webservices.apt.ScannerException: multi-record request element must contain single nested list
    com.datanomic.director.webservices.apt.Scanner$Processor$Servicer.makeDef(Scanner.java:747)
    etc.
    SEVERE: 10-Sep-2013 13:24:07: APT scan failed
    Unfortunately, the error message is not very helpful to me.  Do you know what it is whingeing about?  I've also tried running the wsdlizer on our old wsdl files, i.e. before we introduced the parent tag <Covers> around <Cover>, but this failed with the same result when running with the -multi in option
    The wsdl file, with most of the XML tags removed for clarity and brevity, looks like this:
    <wsdl:definitions xmlns:schema="http://xxxx/MppService" xmlns:soap="http://schemas.xmlsoap.org/wsdl/soap/" xmlns:tns="http://xxxx/MppService" xmlns:wsdl="http://schemas.xmlsoap.org/wsdl/" name="LV" targetNamespace="http://xxxx/MppService">
       <wsdl:types>
          <xsd:schema xmlns="http://xxxx/MppService" xmlns:xsd="http://www.w3.org/2001/XMLSchema" attributeFormDefault="qualified" elementFormDefault="qualified" targetNamespace="http://xxxx/MppService">
             <xsd:element name="request">
                <xsd:complexType>
                   <xsd:sequence>
                      <xsd:element minOccurs="1" name="CorrelationUID" type="xsd:string"/>
                      <xsd:element minOccurs="1" name="RequestorName" type="xsd:string"/>
                      <xsd:element minOccurs="1" name="Brands" type="brandType"/>
                      <xsd:element minOccurs="1" name="Parties" type="partiesType"/>
                      <xsd:element minOccurs="1" name="InsuredObjects" type="insuredObjectsType"/>
                   </xsd:sequence>
                </xsd:complexType>
             </xsd:element>
             <xsd:element name="response">
                <xsd:complexType>
                   <xsd:sequence>
                      <xsd:element name="CorrelationUID" type="xsd:string"/>
                      <xsd:element name="MPPResponseUID" type="xsd:string"/>
                      <xsd:element maxOccurs="unbounded" minOccurs="1" name="Brand" type="schema:brandsType"/>
                   </xsd:sequence>
                </xsd:complexType>
             </xsd:element>
             <xsd:complexType name="brandsType">
                <xsd:sequence>
                   <xsd:element name="BrandCode" type="xsd:string"/>
                   <xsd:element name="ResponseMPD">
                      <xsd:complexType>
                         <xsd:sequence>
                            <xsd:element minOccurs="0" name="FunctionAvailable" type="xsd:string"/>
                            <xsd:element minOccurs="0" name="MessageCode" type="xsd:string"/>
                         </xsd:sequence>
                      </xsd:complexType>
                   </xsd:element>
                   <xsd:element name="ResponseCI">
                      <xsd:complexType>
                         <xsd:sequence>
                            <xsd:element minOccurs="0" name="FunctionAvailable" type="xsd:string"/>
                            <xsd:element minOccurs="0" name="MessageCode" type="xsd:string"/>
                         </xsd:sequence>
                      </xsd:complexType>
                   </xsd:element>
                </xsd:sequence>
             </xsd:complexType>
             <xsd:complexType name="brandType">
                <xsd:sequence>
                   <xsd:element maxOccurs="2" minOccurs="1" name="BrandCode" type="xsd:string"/>
                </xsd:sequence>
             </xsd:complexType>
             <xsd:complexType name="partiesType">
                <xsd:sequence>
                   <xsd:element maxOccurs="unbounded" minOccurs="1" name="Party" type="schema:partyType"/>
                </xsd:sequence>
             </xsd:complexType>
             <xsd:complexType name="partyType">
                <xsd:sequence>
                   <xsd:element minOccurs="0" name="PartyUID" type="xsd:string"/>
                   <xsd:element minOccurs="1" name="RoleCode" type="xsd:string"/>
                </xsd:sequence>
             </xsd:complexType>
             <xsd:complexType name="insuredObjectsType">
                <xsd:sequence>
                   <xsd:element maxOccurs="1" minOccurs="0" name="Properties" type="schema:propertiesType"/>
                   <xsd:element maxOccurs="1" minOccurs="0" name="Vehicles" type="schema:vehiclesType"/>
                </xsd:sequence>
             </xsd:complexType>
             <xsd:complexType name="propertiesType">
                <xsd:sequence>
                   <xsd:element maxOccurs="unbounded" minOccurs="0" name="Property" type="schema:propertyType"/>
                </xsd:sequence>
             </xsd:complexType>
             <xsd:complexType name="vehiclesType">
                <xsd:sequence>
                   <xsd:element maxOccurs="unbounded" minOccurs="0" name="Vehicle" type="schema:vehicleType"/>
                </xsd:sequence>
             </xsd:complexType>
             <xsd:complexType name="propertyType">
                <xsd:sequence>
                   <xsd:element minOccurs="0" name="BuildingNumber" type="xsd:string"/>
                   <xsd:element minOccurs="0" name="BuildingName" type="xsd:string"/>
                   <xsd:element maxOccurs="1" minOccurs="0" name="Covers" type="schema:coversType"/>
                </xsd:sequence>
             </xsd:complexType>
             <xsd:complexType name="coversType">
                <xsd:sequence>
                   <xsd:element minOccurs="1" name="Cover" type="xsd:string"/>
                </xsd:sequence>
             </xsd:complexType>
             <xsd:complexType name="vehicleType">
                <xsd:sequence>
                   <xsd:element minOccurs="0" name="VehicleRegistrationMark" type="xsd:string"/>
                   <xsd:element minOccurs="1" name="ABIBrokernetCode" type="xsd:string"/>
                </xsd:sequence>
             </xsd:complexType>
          </xsd:schema>
       </wsdl:types>
       <wsdl:message name="request">
          <wsdl:part name="parameters" element="schema:request"/>
       </wsdl:message>
       <wsdl:message name="response">
          <wsdl:part name="parameters" element="schema:response"/>
       </wsdl:message>
       <wsdl:portType name="LVEI">
          <wsdl:documentation>Operations</wsdl:documentation>
          <wsdl:operation name="process">
             <wsdl:documentation>Process a query request</wsdl:documentation>
             <wsdl:input message="schema:request"/>
             <wsdl:output message="schema:response"/>
          </wsdl:operation>
       </wsdl:portType>
       <wsdl:binding name="LVBinding" type="tns:LVEI">
          <soap:binding style="document" transport="http://schemas.xmlsoap.org/soap/http"/>
          <wsdl:operation name="process">
             <soap:operation soapAction="http://xxxx/MppService"/>
             <wsdl:input>
                <soap:body use="encoded"/>
             </wsdl:input>
             <wsdl:output>
                <soap:body use="literal"/>
             </wsdl:output>
          </wsdl:operation>
       </wsdl:binding>
       <wsdl:service name="LV-MPPQRS-v01">
          <wsdl:port name="LVEndpoint" binding="tns:LVBinding">
             <soap:address location="https://xxxx/LV-MPPQRS-v01"/>
          </wsdl:port>
       </wsdl:service>
    </wsdl:definitions>
    A colleague created the wsdl, it's been checked a number of times but no one can find anything dodgy that might account for the wsdlizer error we're getting.  So we're a bit lost now, the data coming in to our EDQ process is incomplete, which makes further development of out EDQ processes somewhat challenging.
    Any help would be greatly received.  Also happy to send any more information you may require.
    Jules

  • Binary String to numerical binary array

    Hello,
    I initially created binary strings from numerical numbers using the
    "%03b" command on the 'Format into String' block. I then concatenated
    the various strings into one string that is now composed of 16bits.
    However, I need to convert this string that I created back to a binary
    numerical array for further processing.
    Can you help me with this?
    Thanks,
    Rajesh.

    triniboy wrote:
    I initially created binary strings from numerical numbers using the
    "%03b" command on the 'Format into String' block. I then concatenated
    the various strings into one string that is now composed of 16bits.
    In general, you are out of luck, because the number of characters for each value when formatted to binary with "%03b", will be variable. Any number greater than 7 will use more than 3 digits. (since you use "03" instead of 3", smaller numbers will have three digits with possible leading zeroes for padding).
    After you concatenated all the formatted strings, you loose all boundary information unless ALL numbers are less than 8, but in this case they result would be a multiple of 3 and would not add up to 16 bits, right?
    My best suggestion would be to NOT create a binary formatted string in this way, because it is a one-way operation and cannot be undone because you loose information in the process.
    Back to square one!
    Maybe we can backup a few steps and you can explain to us what you really want to do with your original numbers. Why would you even consider formatting them this way? Do you need to save them to a file for later retrieval, for example?
    LabVIEW Champion . Do more with less code and in less time .

  • Which JDK doc to read up for more info on array ?

    The title says it all. I need to know what other properties does an array has. For instance, we can use "x_array.length" to find out no.of elements in x_array. Is there a property to tell how many dimension does the array has ? The ".length" only gives size of one dimension. To find the size of another dimension, I need to do something as below :-
    int two_D_array[][] = new int[20][30];
    out.printf("1) two_D_array size %d\n", two_D_array.length);
    out.printf("2) two_D_array size %d\n", two_D_array[0].length);
    Output :
    1) two_D_array size 20
    2) two_D_array size 30
    Is there any better way to improve the above codes ? Thank you.

    TKH wrote:
    The title says it all. I need to know what other properties does an array has. That's easy. There are none ;)
    Is there a property to tell how many dimension does the array has ? The ".length" only gives size of one dimension. To find the size of another dimension, I need to do something as below :-
    Nope, you can't know. Or rather you have to know when declaring the array so there's no way to change it on the fly.
    As a result there's no need to know...
    Something like
    int[] arr = getIntArr();
    private int[] getIntArr() {
        return new int[1][2][3][4][5] {};
    }won't even compile.

  • Dimension an array with BigInteger?

    Hi,
    I'm wondering if it is possible to dimension an HUGE array with BigInteger..
    my idea is if it is possible to the equivalent of e.g.
    boolean b[] = new boolean[new BigInteger("12345678987654322346567")];Thanks!

    No. The number in [] must be of type int (or promoted to int):
    See: http://java.sun.com/docs/books/jls/second_edition/html/expressions.doc.html#46168
    "The type of each dimension expression within a DimExpr must be an integral type, or a compile-time error occurs. Each expression undergoes unary numeric promotion (�5.6.1). The promoted type must be int, or a compile-time error occurs; this means, specifically, that the type of a dimension expression must not be long."

  • Why does Read from Text file default to array of 9 elements

    I am writing to a text file starting with a type def. cluster (control) of say 15 dbl numeric elements, that works fine I open the tab-delimited text file and all of the elements appear in the file.  However when I read from the same text file back to the same type def. cluster (indicator), the read from text file defaults to 9 elements?? Is there a way to control how many elements are read from the file.  This all works great when I initially use a cluster of 9 elements and read back to a cluster of 9 elements.
    Solved!
    Go to Solution.

    From the LabVIEW Help: http://zone.ni.com/reference/en-XX/help/371361G-01/glang/array_to_cluster/
    Converts a 1D array to a cluster of elements of the same type as the array elements. Right-click the function and select Cluster Size from the shortcut menu to set the number of elements in the cluster.
    The default is nine. The maximum cluster size for this function is 256.
    Aside: so, how many times has this question been asked over the years?

  • How do I read directly from file into byte array

    I am reading an image from a file into a BuffertedImage then writing it out again into an array of bytes which I store and use later on in the program. Currently Im doing this in two stages is there a way to do it it one go to speed things up.
    try
                //Read File Contents into a Buffered Image
                /** BUG 4705399: There was a problem with some jpegs taking ages to load turns out to be
                 * (at least partially) a problem with non-standard colour models, which is why we set the
                 * destination colour model. The side effect should be standard colour model in subsequent reading.
                BufferedImage bi = null;
                ImageReader ir = null;
                ImageInputStream stream =  ImageIO.createImageInputStream(new File(path));
                final Iterator i = ImageIO.getImageReaders(stream);
                if (i.hasNext())
                    ir = (ImageReader) i.next();
                    ir.setInput(stream);
                    ImageReadParam param = ir.getDefaultReadParam();
                    ImageTypeSpecifier typeToUse = null;
                    for (Iterator i2 = ir.getImageTypes(0); i2.hasNext();)
                        ImageTypeSpecifier type = (ImageTypeSpecifier) i2.next();
                        if (type.getColorModel().getColorSpace().isCS_sRGB())
                            typeToUse = type;
                    if (typeToUse != null)
                        param.setDestinationType(typeToUse);
                    bi = ir.read(0, param);
                    //ir.dispose(); seem to reference this in write
                    //stream.close();
                //Write Buffered Image to Byte ArrayOutput Stream
                if (bi != null)
                    //Convert to byte array
                    final ByteArrayOutputStream output = new ByteArrayOutputStream();
                    //Try and find corresponding writer for reader but if not possible
                    //we use JPG (which is always installed) instead.
                    final ImageWriter iw = ImageIO.getImageWriter(ir);
                    if (iw != null)
                        if (ImageIO.write(bi, ir.getFormatName(), new DataOutputStream(output)) == false)
                            MainWindow.logger.warning("Unable to Write Image");
                    else
                        if (ImageIO.write(bi, "JPG", new DataOutputStream(output)) == false)
                            MainWindow.logger.warning("Warning Unable to Write Image as JPEG");
                    //Add to image list
                    final byte[] imageData = output.toByteArray();
                    Images.addImage(imageData);
                  

    If you don't need to manipulate the image in any way I would suggest you just read the image file directly into a byte array (without ImageReader) and then create the BufferedImage from that byte array.

Maybe you are looking for