Big endian - Little endian conversion

Hi all, I'm a new user!
I'm working with As400 and java using jtopen.
With this code:
PrintObjectTransformedInputStream is = spoolFile.getTransformedInputStream(printParms);           
BufferedInputStream bufIn = new BufferedInputStream(is);                       
BufferedOutputStream bufOut = new BufferedOutputStream(new FileOutputStream("c:/x.tif"));
int c;
while ((c = bufIn.read()) != -1) {
     bufOut.write(c);
bufIn.close();
bufOut.close();I'm getting a tiff stream and then write it to a file. The tiff stream is in Big endian format, but I need a tiff in Little endian format.
How can I convert the stream from Big endian to Little endian?
Thanks

Tiff is a complex format, containing fields of different lengths, so you aren't likely to succeed just by reversing every pair of bytes in the stream without following the TIF format.
You could look at the JAI (Java Advanced Imaging), which can read and write TIFF files in a variety of modes.

Similar Messages

  • Help: Any one can advice, CVI software is using Big or little endian?

    Help: Any one can advice, CVI is using Big or little endian? 
    or is depend on the processors my HW is using?

    The correct answer it the third one: CVI adapts to the hardware architecture you are running on. In the Programmer's Toolbox you have functions to detect the hardware architecture: HostIsBigEndian and HostIsLittleEndian. In the group you have functions to convert data between architectures.
    Proud to use LW/CVI from 3.1 on.
    My contributions to the Developer Zone Community
    If I have helped you, why not giving me a kudos?

  • Big to Little Endian

    http://download.oracle.com/docs/cd/B14117_01/server.101/b10770/rcmsynta18.htm#87809
    DB Version : 10.1
    We are going across platform, different endianness.
    1. We cannot use CONVERT Database as it is supported only across same platform.
    2. We are planning to use CONVERT Datafile, without transportable tablespace.
    3. Any idea on how much time it would take to copy a 10g File ?
    When there is a endian difference, could you please provide a high level successful methodology to use.
    We are planning to do an OS cold backup, subsequent restore of the entire database on Target, run convert datafile and synchronizing the data from there on. BTw, we are going from Big to Little Endian.
    Can any one provide a estimate on how much time it would take to convert a 10 Gig datafile?
    Also once datafile is converted and brought up, can we apply the archivelog’s I am thinking no, but wanted to know your opinion.
    Edited by: user11986212 on Nov 30, 2009 8:13 PM

    Hi,
    I wrote blog post recently about cross platform migration from big to little endian platform:
    [Cross-platform migration - large Oracle 9i db from Solaris 64 to Linux 64|http://msutic.blogspot.com/2009/11/cross-platform-migration-large-oracle.html]
    First part is upgrade process and you can ignore that part - next is migration across platforms.
    Maybe this post could be helpful for you.
    Regards,
    Marko

  • TCP Programming / Why do not need to worry about Big and little Endian?

    Please help, I do not understand this concept please explain.
    The architecture of a CPU is either little-endian or big-endian; some modern CPU's allow a choice via software.
    The TCP/IP protocol standard specifies that all the bytes that make up an item must be sent in "network order", which happends to be big-endian. Intel Pentium CPU's are little-endian.
    This implies that on an Intel machine the TCP software will have to chop an int into bytes and then reverse the bytes before transmitting them.
    Why does the JAVA TCP software does not need to perform the reversal?
    Thanks,
    Alex

    But why would I need to use the DataOutputStream,You don't have to.
    But that's what the Java API provides for sending java primitives over a stream. You wouldn't have to use that. You could chop the int into bytes yourself, and send the bytes, and your Java code still wouldn't have to worry about the endiannes of it, because the VMs handle that.
    DataOutputStream just does the chopping and reassembling for you, so it's easier than doing it yoursefl.

  • Why do not need to worry about Big and little Endian in Java

    Please help, I do not understand this concept please explain.
    The architecture of a CPU is either little-endian or big-endian; some modern CPU's allow a choice via software.
    The TCP/IP protocol standard specifies that all the bytes that make up an item must be sent in "network order", which happends to be big-endian. Intel Pentium CPU's are little-endian.
    This implies that on an Intel machine the TCP software will have to chop an int into bytes and then reverse the bytes before transmitting them.
    Why does the JAVA TCP software does not need to perform the reversal?
    Thanks,
    Alex

    Java doesn't give you direct access to the individual bytes of a larger data item such as an integer. For this reason you don't have the usual endian problems that occur in C. The actual handling of this is in the DataOutputStream and DataInputStream where the integer is coverted to and from bytes using arithmetic, not by fiddling with the internal structure.
    Note that regardless of the machine architecture the operation value%256 will return the low order 8 bits. It's less efficient than assigning an int* to a char*, but it's not fraught with the endian problems or any of the other hardware baggage.

  • Big endian, little endian, and converting to another datatype.

    Hi all,
    I'm working on a sound visualization program. I'm putting the sound into byte arrays, and I then need to convert those bytes into ints to draw onto the screen. This is easy if the soulds are 8-bit, because you don't have the endian issue. How do I take a byte[] and pull ints from it that represent the waveform that the bytes were pulled from? Is it something like this (where soundBytes is the byte[] pulled from a sound file):
    int sampleFirstPart = (int)soundBytes[0];
    int sampleSecondPart = (int)soundBytes[1];
    int putTogether = sampleFirstPart + sampleSecondPart * 128;
    That's just a wild guess, and I'm not really sure what order these things should go in. How do you do it if it's big-endian? What about if it's little-endian? Is there a preference of one over the other? Does the fact that I'm working with wav files make a difference.
    I'm just full of questions, but any ammount of help you can give is very very much appreciated.
    thanks,
    Matt

    int value = soundBytes[x] + (soundBytes[x+1] << 8); // LE
    or
    int value = (soundBytes[x] << 8) + soundBytes[x+1]; // BE
    I think the LE and BE labels are right, but the calculation part is correct for one or the other.
    However, you need to know the format of the file to know if it's one or the other. You can't really tell from the bytes whether it's one or the other. There should, presumably, be some way to know from the audio format header. Either there'd be a flag to incidate which, or it would be assumed one way or the other because it's of format X. I think that wav files would be LE, but don't quote me on that.

  • Little endian & big endian format system

    Hi,
    I have code which works fine for Little endian format system, can somebady please tell how to get data from big endian format system.
    or is sap has setting where i can turn on and than run my code on that system.
    Thanks,
    John.

    hi
    chk this
    OPEN DATASET dset IN LEGACY TEXT MODE [(BIG|LITTLE) ENDIAN] [CODE PAGE cp]
    Effect
    Data is read or written in a form which is compatible to BINARY MODE in Releases <= 4.6. This addition is primarily used to convert a file into the code page format specified already when it is opened. At runtime, the system uses the format of the system code page of the application server. The system saves the file then again in the code page specified. This procedure is important if data is exchanged between systems using different code pages. For more information, see READ DATASET and TRANSFER.
    Notes
    on BIG ENDIAN, LITTLE ENDIAN
    These additions specify the byte sequence in which to store numbers (ABAP types I, F, and INT2) in the file.
    These additions may only be used in combination with the additions IN LEGACY BINARY MODE and IN LEGACY TEXT MODE. If these are not specified, the system assumes that the byte sequence determined by the hardware of the application server is used in the file.
    If the byte sequence specified differs from that determined by the hardware of the application server, READDATASET and TRANSFER make the corresponding conversions.
    These additions replace the language element TRANSLATE ... NUMBER FORMAT ... which must not be used in Unicode programs.
    on CODE PAGE cp
    This addition specifies the code page which is used to represent texts in the file.
    This addition may only be used in combination with the additions IN LEGACY BINARY MODE and IN LEGACY TEXT MODE. If this addition is not specified, the system uses the code page defined by the text environment current at the time a READ or TRANSFER command is executed (see SET LOCALE LANGUAGE).
    This addition replaces the language element TRANSLATE ... CODE PAGE ... which must not be used in Unicode programs.
    open datset ... IN LEGACY BINARY MODE [(BIG|LITTLE) ENDIAN] [CODE PAGE cp]
    Effect
    Data is read or written in a form which is compatible to BINARY MODE in Releases <= 4.6. This addition is primarily used to convert a file into the code page format specified already when it is opened. At runtime, the system uses the format of the system code page of the application server. The system saves the file then again in the code page specified. This procedure is important if data is exchanged between systems using different code pages. For more information, see READ DATASET and TRANSFER.

  • Big Endian and Little Endian formats.

    How can I read numbers from file in both big and little endian formats?

    Not without reading them a byte at a time and doing
    bit-shifting arithmetic yourself.I was hoping I will not get that kind of answer :) Well, if that's the only way,
    can you tell me what kind of format is used in Java? Big or Little endian?

  • Any need for conversation from big endian and little endian?

    Hi,
    I am planning to migrate an Oracle 9i Database on AIX 5.3 to Oracle 11g R2 Windows 2008, and have planned to use transportable tablespace. But prior to that task is the conversation required from big endian and little endian using RMAN?
    Appreciate any suggestions, comments and hints
    Thanks

    Hi,
    Check V$TRANSPORTABLE_PLATFORM, it shows the ending for each supported platform. Given the results on my 11g, I suspect that you'll have to convert the tablespaces...
    SYSTEM@oracle11 SQL>select *
      2   from V$TRANSPORTABLE_PLATFORM
      3  ;
    PLATFORM_ID PLATFORM_NAME                                                                                         ENDIAN_FORMAT
              7 Microsoft Windows IA (32-bit)                                                                         Little
              6 AIX-Based Systems (64-bit)                                                                            Big
              8 Microsoft Windows IA (64-bit)                                                                         Little
             12 Microsoft Windows x86 64-bit                                                                          LittleHtH
    Johan

  • What is Little Endian / Big Endian in Sound settings for Apple Intermediate

    Hi.
    In Final Cut Express, I am trying to splice together multiple video clips, combining footage from:
    1) HDV camcorder imported into iMovie 08 as 960 x 540 (the "lower resolution" option from iMovie '08 import), 16-bit @ 48 KHz (Big Endian), 25 FPS
    2) AVI files (DiVX 512 x 384, MP3 at 44.1 KHz, 23.98 FPS)
    3) Canon Camera "movie" files (Apple OpenDML JPEG 640 x 480, 16-bit Little Endian, Mono @ 44.1 KHz, 30 FPS)
    Questions
    1) What is this little endian / big endian thing?
    2) What is the best codec for me to edit in? My targets are NTSC DVD and also a HD version served via iPod connected to HDTV.
    I am not sure what codec to convert everything to, so that I can edit without having to RENDER every time I do something. I tried to export using QuickTime Pro to convert to Apple Intermediate Codec but am not sure about the option for "Little Endian" (I am using an Intel Mac; I assume I do NOT use little endian? Can someone help clarify?)
    Many thanks!!!

    1. They're compression formats. Different codec use different compression schemes.
    2. You should convert your material to QuickTime using the appropriate DV codec and frame rate.
    None of your material is HD. Some of it is low resolution, lower than even DV. There is no good way to make this material HD.

  • How do I swap 64-bit and 32-bit floats from little-endian to big-ending

    I am trying to read a file that could contain a list of 64-bit floats or 32-bit floats that were written on a PC so they are little-endian.
    I need to convert the float values to big-endian so that I can process the values. I know that straight swapping each byte with the adjacent byte doesn't work (especially since their floating point values). I've tried swapping them end for end (i.e., byte 15 from the file becomes byte 0 in my array) and that didn't work either.
    I know that if I were to read the little-endian float into the big-endian float type (float or double) that the format is pretty much lost (from little I understand about how floating point values are stored in memory).
    So, what I need is a way to read in a series of little-endian floating point values (64-bit and 32-bit) into a big-endian array of floating point values.
    Anyone have any ideas on how to do this? Any help would be much appreciated.

    A 64-bit double is represented by the sign bit, an 11-bit (biased) exponent
    followed by a 52-bit mantissa. Both x86 and SPARC use the exact same
    representation for 64-bit double. The only difference is the endianness
    when stored to memory, as you observed.
    A 32-bit float is represented by the sign bit, an 8-bit (biased) exponent
    followed by a 23-bit mantissa. Again, both x86 and SPARC use the exact
    same representation for 32-bit float modulo endianness.
    As you can see, a 64-bit double is not merely a pair of 32-bit float.
    You need to know exactly how the floating-point data was written:
    if a 32-bit float was written, you must endian-swap it as a 32-bit float;
    if a 64-bit double was written, you must endian-swap it as a 64-bit double.

  • How to find machine is Big/little endian?

    Hi,
    Can any one tell me that how to find machine on which we are working i.e. Big/Little Endian in using java?
    One of my friend told me that in C Programming we can find this by using following code:
    #include <stdio.h>
    #include <arpa/inet.h>
    int main() {
        if (htons(1) == 1) puts("big endian");
        else puts("little endian");
        return 0;
    }Can any one help me in solving this mystery?
    Cheers,
    Ram

    java.nio.ByteOrder.nativeOrder();~D

  • VDI 3.1 Big Endian vs Little Endian: VDI Cluster to Remote mysql server

    Hello,
    We are implementing a Dual Data center VDI environment and with that, will be using VCS to Cluster a remote Mysql instance. My question, if the VDI Cluster is on x86 (Little Endian), can the remote Mysql DB be on Sparc (Big Endian)?
    Thanks,

    The endian matching is only a requirement for the management and data nodes of a MySQL cluster. If you are going to be using a remote MySQL DB, the VDI servers will be connecting to that remote MySQL DB as a client connection, and there is no requirement for clients to match the endian type.
    http://dev.mysql.com/doc/refman/5.1/en/mysql-cluster-limitations-exclusive-to-cluster.html

  • OPEN DATASET Big/Little Endian

    Thread opened on behalf of colleague:
    SOURCE
    I want to create a file on a system that is Big Endian with codepage 4102.
    TARGET
    I want to read this file in a system that is Little Endian with codepage
    4103.
    What is the exact 'open dataset' syntax on the SOURCE and TARGET?
    The file on the little endian system is not being read correctly. It shortdumps with CONVT_CODEPAGE.
    Thanks.

    Hi Wang,
    Check thie following link:
    http://www.s001.org/ABAP-Hlp/abapopen_dataset.htm
    Hope this helps you.
    Regards,
    Chandra Sekhar

  • Linear PCM - Big Little Endian

    Sorry - I'm at a loss.
    Assumptions:
    Linear PCM is the correct format for exporting audio for FCP - ie Lossless
    Ok...
    Big Endian seems to be a default with Little Endian wanting a checkbox.
    IS there a reason FCP wouldn't accept one or the other?
    CaptM

    Drew13 had this to say:
    Little Endian and Big Endian is how the data is stored with the most signifcant byte on one end or the other (taken from Gulliver's Travels and how the egg should be cracked.(ETA) One of the conflicts in the book is between people who preferred cracking open their soft-boiled eggs from the little end, and the people who preferred the big end.). For the most part you do not need to concern yourself with this (unless you like finding out about those things more) it is transparent in your workflow on the Mac using these apps.(FCP, FCE etc.)
    PPC Mac > Big Endian (default)
    WIndows PC > Little Endian (default)
    • Endianness
    This is all well and good except when it comes to the Intel Macs and Dolby AC3 creation with Compressor.
    At the moment there's a byte-order compatability Problem mixing UB versions of AC3 with PPC versions of AC3 within the same DVD SP 4.1 project.
    Read this:
    http://discussions.apple.com/thread.jspa?messageID=3130608&#3130608
    MaxR says:
    Apple's developer site specifically cites byte-order as a concern for developers of Universal binaries, but seems to have let this slip out anyway. Shame, shame, Apple.
    G5 1.8 DP (PCI-X)   Mac OS X (10.4.8)   ATI X800 XT, 4GB RAM, 20" & 23" ACDs, M-Audio Revolution 5.1, Fostex D15 DAT

Maybe you are looking for

  • Adobe Muse APTEE Licensing NOT WORKING!!

    Hi, I am an IT Professional working for a major University in Missouri. We have an Apple computer lab of 26 20" iMacs, all running Adobe Creative Cloud with an Enterprise license. This license includes Adobe Muse (with its own serial number). We use

  • Gray hourglass shows instead of my pictures

    When I downloaded my files from Adobe Photoshop elements 12 to 13 some of them never showed and instead had an hourglass showing. When I tried to add pictures from my files only an hourglass shows and if I try to edit a picture when I finish the edit

  • LR not exporting images with proper presets

    how come I can edit an image and then save it by exporting it with preset it looks way different when I reopen the file. and I am not talking little changes I mean crops through peoples faces and super contrasty. it there a better way to save the ima

  • Downloaded movie can't see video

    I downloaded a movie, but can't see the video

  • Facebook Notifications & uploading pictures

    I've noticed since i updated to version 4.1, I have not been able to receive any notifications for Facebook or upload pics to my facebook page. And i have already uninstalled & installed FB on to my iphone 4. Message was edited by: DreEZ