Compressed String (GZIPOutputStream) is not equal to the source string

Hello,
I would like to compress the contents of a String (XML data) with the GZIPOutput/InputStream classes. Unfortunately I'm facing a problem - my source and result strings do not equal after the compression and decompression (I hope this is the correct sub-forum for this kind of question).
Here is a example code that reads data from a file (test.xml), compresses it via a GZIPOutputStream into compressed byte array and decompresses it back into a String:
public class CompressedStringTest {
     private static final String     FILENAME     = "test.xml";
     public CompressedStringTest() throws IOException {
          File file = new File( FILENAME );
          String xml = FileUtil.readFile( file );
          // COMPRESS
          ByteArrayOutputStream out = new ByteArrayOutputStream();
          GZIPOutputStream zipout = new GZIPOutputStream( out );
          zipout.write( xml.getBytes() );
          zipout.close();
          out.close();
          // DECOMPRESS
          byte[] result = new byte[ xml.getBytes().length ];
          ByteArrayInputStream in = new ByteArrayInputStream( out.toByteArray() );
          GZIPInputStream zipin = new GZIPInputStream( in );
          zipin.read( result );
          zipin.close();
          in.close();
          String xml2 = new String( result );
          System.out.println( "xml.equals( xml2 ): " + xml.equals( xml2 ) );
     public static void main( String[] args ) throws IOException {
          new CompressedStringTest();
}The length of the source and result strings are the same, but they are not equal. When I print out the lines which do not equal, I get this:
'</sysConfig>'
'</sxxxxxxxxx'where "x" are those small boxes, characters that can't be printed.
This is the source XML file I use:
<?xml version="1.0" encoding="UTF-8"?>
<sysConfig xid="0" version="0.1" id="1" xmlns:r2="http://....">
    <addresses class="java.util.ArrayList" xid="1">
        <address xid="2" id="1">
            <config xref="0"/>
            <addressType xid="3">NURSING_SERVICE</addressType>
            <externalId xid="4">0</externalId>
            <name xid="5">This is the name containing fourtyeight chars!!!</name>
            <street xid="6">street</street>
            <city xid="7">city</city>
            <zip xid="8">zip</zip>
            <telephone xid="9">12345</telephone>
            <fax xid="10">(123) 12345612345454597745</fax>
        </address>
     </addresses>
    <lastModified class="java.util.GregorianCalendar" xid="8167">2009-09-17 10:38:59.0 MESZ</lastModified>
    <customerNr xid="8168">FB-IK-01001</customerNr>
    <customerName xid="8169">A Customer</customerName>
    <logProtocolChanges>false</logProtocolChanges>
    <useHomeAsStartAddress>false</useHomeAsStartAddress>
    <sendMailEnabled>false</sendMailEnabled>
    <sendFaxEnabled>true</sendFaxEnabled>
</sysConfig>When I remove just one arbitrary line, the source and result strings do equal. This may have to do with some kind of buffer-length-problem, but I just can't figure out where the problem is.
I really appreciate your help
Thanks a lot!

The javadoc reads for "FilterInputStream.read(byte[] b)":I've read it. You're the one who needs to read it.
Reads up to* byte.length bytes of data from this input stream into an array of bytesSo I thought it just reads all available data.Why? That's not what it says, is it?
But when I print the return code of "read", it is not -1, meaning not the whole data has been read.If that is supposed to be 'meaning that the whole data has been read', you are mistaken. What was the return value? compared to the buffer length? You might find it interesting ...
I assume I just do not understand the read method completely.The return value is -1 for EOS, otherwise the number of bytes that were read. Just like it says in the Javadoc actually.
You have to use a loop, increment the offset, etc.

Similar Messages

  • Invoice tax amount is not equal to the calculated tax amount

    Hi All,
    I'm importing AP invoices through Open Interface R12.
    Lines includes Tax lines as well. But Invoices become held when I try to validate.
    I'm getting this hold reason: "Invoice tax amount is not equal to the calculated tax amount"
    Can anybody advise please ?
    Thanks,

    Use T. code SM30 and give table name J_1IT030K_V and click on maintain button give your chart of account, press enter here assign appropriate G/L A/C against Tax code MK.

  • FIXED type Attribute value not equal to the default

    Hi
    I am in the processing of doing AP Inbound process. During My process I have created Invoice XML and XSD and mapped with XML Gateway OAG XSD.
    BPEL able to pool the directory and process the XML file. But I am getting below error at XML Gateway error log.
    FIXED type Attribute value not equal to the default
    value ''.
    Could any body let me know when do I get normally this kind of error.
    Regards
    Kiran Akkiraju

    If you have imported the source code you could use a workaroud i have found. Create a new workspace and a new Project. In it create with the wizard a new Struts Controller Page Flow. After, create a action class, and some jsp pages.Then put some Struts components with the Components Palette.Be sure that in the newly created pages, jdeveloper has put the struts taglib. Now you can rebuild your project.
    It seems that jdeveloper does some internal libraries configuration, but when you import the source code, it doesn't do it.
    Hope it helps
    Nicolas Fonnegra M.

  • Adobe Media Encoder for CS4 error Could not read from the source

    Hello,
    I get an error when I try to export from Premiere CS4. It doesn't matter how I export. Seems like an easy fix, but I can't figure it out. Any help is appreciated:
    - Source File: C:\DOCUME~1\ARTWHI~1\LOCALS~1\Temp\extra and b roll.prproj
    - Output File: E:\Living Accused Movie Transfers\video\Cindy at table.avi
    - Preset Used: NTSC DV
    - Video:
    - Audio:
    - Bitrate:
    - Encoding Time: 16:10:34
    1/21/2009 9:50:25 PM : Encoding Failed
    Could not read from the source. Please check if it has moved or been
    deleted.
    Thank you
    Art

    When you attempt to encode media with Adobe Media Encoder CS4 on Windows, the following error message appears in the text file (AMEEncodingErrorLog.txt) that opens when you click the error icon: "Encoding Failed. Could not read from the source. Please check if it has moved or been deleted."
    If it's that correct, you removed an earlier version of Adobe Premiere Pro or Adobe Creative Suite on the same computer.
    Do one or both of the following solutions:
    Solution 1: Create a shortcut to the Premiere Pro executable file, rename the shortcut to Premiere, and move the shortcut to C:\Program Files\Common Files\Adobe\dynamiclink.
    Close all Adobe applications.
    In Windows Explorer, navigate to C:\Program Files\Adobe\Adobe Premiere Pro CS4. (If you installed Premiere Pro CS4 in a location other than the default of C:\Program Files\Adobe, then navigate to your custom installation location.)
    Right-click on Adobe Premiere Pro.exe (which might appear without the .exe extension) and choose Create Shortcut.
    Rename the newly created shortcut to just Premiere.
    Important: The name of the shortcut must be exactly Premiere with no other characters.
    Open a second Windows Explorer window, and navigate to C:\Program Files\Common Files\Adobe\dynamiclink.
    Move the Premiere shortcut that you created into the dynamiclink folder.
    Solution 2: Remove and reinstall all Premiere Pro CS4 components or all Adobe Creative Suite 4 components.
    Do one of the following:
    Windows XP: Choose Start > Control Panel > Add or Remove Programs.
    Windows Vista: Choose Start > Control Panel > Programs and Features.
    In the list of installed programs, select Adobe Premiere Pro CS4, Adobe Creative Suite 4 Production Premium, or Adobe Creative Suite 4 Master Collection.
    Click Change/Remove (Windows XP) or Uninstall (Windows Vista).
    Follow the on-screen instructions to remove all components of Premiere Pro CS4 (including Adobe Encore CS4 and Adobe OnLocation CS4) or to remove all components of your edition of Adobe Creative Suite 4.
    Re-install your Adobe software.

  • Data Source Z*** is not defined in the source system

    Hello All,
    I am facing a well known problem extracting data from R3 to the BI side. On both sides I've got SAP ALL.
    I created data source on R3 DEV side, tested it and it extracts data. I've replicated metadata on BI side and activated the data source. The problem starts once I create the info package as no data is availble in PSA.
    I went to extractor checker and tried to start the extraction and I could see the message: data source Z**** not defined in the source system.
    I tried to locate the data source through RSA5 and I cannot see that it is availble there.
    Can you please help and advise where the problem is?

    Hi Neb,
    It can be related to many issues, one of them can be RFC connection issue. Please check the link below :-
    Datasource xxx is not defined in the source system
    It might give you some of ideas. Also if possible can you tell what Datasource are you having problem with.
    Regards
    Sunny

  • Could not place because the source rectangle is empty

    Up until about 3pm yesterday, illustrator CS6 and Photoshop CS6 worked without a hitch however at 3pm, I all of a sudden get the message 'Could not place because the source rectangle is empty'. All I was doing was dragging one of our company logos into Photoshop from Illustrator from the .eps file that holds all our graphics. I have done this hundreds of timnes before and ALWAYS either do it this way or highlight an image in Illustrator and paste into Photoshop. Either way I am still getting this error message.
    Nothing has happened in the settings (that I am aware of) and google gives me numerous results all of which point at the fact that i may have a corrupt .eps file. However that is not the case. If i try and drag and drop or copy and paste various different fiele from .jpg to .png and .eps or .ai I have the same issue.
    I uninstalled Photoshop this morning then re-installed to see if that would fix the issue but no such luck.
    As it is, it is affecting my work and sure there are workarounds ie. if I go to file/open and open any file that way then that works but that is no good with an eps file that holds many seperate graphics as once that is opened in Photoshop, all those seperate images become one image.
    Can anyone help with this?

    Thanks for the heads up. To be honest, I don't recall ever setting any preferences so shouldn't be a problem resetting them. You do mean the Photoshop preferences don't you?
    FYI, the version of photoshop I had in my other office (where I didn't encounter this issue) was one below the version I had (not as in CS5 but the software version I was running) the issue on and there was an update so did that update so now both machines are identical and running exactly the same OS and Photoshop version but still have the issue.
    Willtry resetting the preferences tomorrow when I'm in the office.
    Will keep you updated.
    Thanks for the help so far.

  • InfoSource 8ODS_SLS is not defined in the source system

    Hi Guys,
        When I tried to load data from ODS to Infocube, I am getting the following error.
    “InfoSource 8ODS_SLS is not defined in the source system”
          Source System is not R/3. It is just a flat file and data was uploaded into ODS. When transferring the data from ODS to Infocube, I get this problem. And I have defined the update rules for infocube and also given the infosource name as ODS.
          But the data is not getting uploaded in the Infocube.

    First replicate your BWSELF system.
    Then, Run this program in SE38:
    rs_transtru_activate_all
    Enter the source system (your BW system)
    Enter the datasource (8ODS_SLS).
    If you get an error message immediately, the datasource doesn't exist. If it runs, check and make sure you get no error messages.
    /smw

  • Error Infosource is not defined in the source system

    I am extracting data into ODS. It was running perfectly till now. But today i am getting this error.and for all packages i run. whether it is transaction data or master data.
    I replicated the DataSource and activated all the objects and transfer structure.but still getting the same error.
    I even created a new DataSource and infosource but still the error persists. please help me in this matter.
    Thanks

    the data is extracted from BW system itself (Self System).
    there are three tables linked to each other.I have created an infoset query and creted datasource on that infoset query.
    the source system is the same bw system.
    The detailed error report is -
    InfoSource  is not defined in the source system.
    Message no. R3005 
    Diagnosis
    The InfoSource  specified in the data request, is not defined in the source system.
    System response
    The data transfer is terminated.
    Procedure
    In the Administrator Workbench of the Business Information Warehouse, update the metadata for this source system, and delete the InfoPackages belonging to InfoSources that no longer existing .

  • Infosource 8ZISCMS10 is not defined in the source system

    Hi Gurus,
    I got an issue when loading the data with in SAP BW (Info source is ODS),It threw an error message stating "Infosource 8ZISCMS10 is not defined in the source system",
    Could any one of you help me in this regrad plz,
    N:B: I have activated the transfer structure through RS_TRANSTRU_ACTIVATE_ALL  and replicated the data sources before loading...

    When u activate DSO/ODS (say ZISCMS10) it creates datasource (8ZISCMS10) & Infosource (8ZISCMS10)
    U can check these at ...... Modeling --> Datasources -> BI -> BI source system name. If it is missing .. reactivate DSO/ODS.
    If the load is failing in QA, u should rereactivate DSO/ODS in DEV and transport that to QA.. After transport.. make sure datasource (8ZISCMS10) & Infosource (8ZISCMS10) appears in QA (Modeling --> Datasources -> BI -> BI source system name)

  • Error: Infoobject is not defined in the source system

    hi
    (I posted this in other forums as well - but wondering, it it should be here in BCT/Extractors - I could use more help).
    this is my issue:
    I am trying to load master data (attr) for an infoobject.
    But, it fails with the following error message (when I click on the "Error message" button on the "monitor" screen.
    "Infoobject is not defined in the source system"
    "Erros in source system".
    (I did rsa3 and find it has some data + i checked on the base table as well, it has data; the datasource is from an SRM system) Why is it complaining like this.
    any help on what could be wrong here? Pl let me know,
    thanks

    Thanks Ricardo,
    I have tried that b4. and it says the "source system connection is OK".
    any other idea?
    Do I have to install the infoobjects on the source system as well? SRM is my source system.. I am not sure on that, but If I have to, how do I do that?
    thanks
    Message was edited by: Esan

  • InfoSource  is not defined in the source system

    Hi,
        We are getting error 'InfoSource  is not defined in the source system' while extracting data from Planning book to Cube in APO.
    Data is coming up to Extrack checker ( RSA3 ) but not comming to PSA.
    Please help me.
    Thanks
    Subba Rao

    Hello Subba,
    Have you replicated the datasource on the BW side? If you use the 3.x data flow then you also need to assign the datasource to and infosource.
    Best Regards,
    Des

  • DataSource 0HR_ATT is not defined in the source system

    Hi Gurus,
    When I am trying load data for HR Master data Attribute it is not loading any anything. I checked that datasource in Rsa3 at R/3 side there it is showing
    "DataSource 0HR_xx_attr is not defined in the source system", can anybody give me the solution.
    I will assign full points.
    Thanks in advance.

    Hi Sergio,
    I have replicated the datasource in BW. Still It is showing the same.
    Kindly advice.
    Maruthi

  • Encoding Failed- Could Not Read from the Source

    I have a quickly approaching deadline for the short film I am working on, and it would be greatly appreciated if anyone knew anything of my predicament.  Everytime I try to export anything from Premiere Pro (CS4 of course), when I start the queue it says "Could Not Read from the Source.  Please check if it has been moved or deleted."  The files, of course, have not been moved or deleted, and the raw footage for the film is in the same place as everything else.  All my scratch disks are set to the same folder, etc.  I don't understand, and it won't even let me export to my camera.  It says it does, but when I check my camera, it's nothing but blank tape.  Any (quick) help would be very much appreciated!
    Thank you.

  • Could not read from the source. Please check if it has moved or been deleted

    hi all,
    when i try to render a afx project from media encoder i get the following message
    "Could not read from the source. Please check if it has moved or been deleted"
    i've read on the forum that this is due to an old installation of Premiere.
    I'm using a brand new computer. the only software installed is my cs5 master collection and the updates from adobe website.
    win7 pro
    i7
    16 gig ram
    cheers
    s

    Hello, this is terrible problem, which i found in CS 6 softwares ...
    solution i found only working, is uninstall and reinstall full package.. but it is not all,
    you need to do BRAND NEW admin account in windows, and install it there.
    that means, i could not export after repair from encoder in my original account never more (!!)   .. this is really terrible way how to repair this issue, because :
    1.by reinstalling of software, client WASTE HIS TIME
    2.by necessity to begin work in another windows profile you again WASTE YOUR TIME because of learning and migrating all other profile modifications, which i see really unaccpetable. Adobe means, this solution of repair is ok, and they did not do till today any steps of creating some "clever" solution.
    I ask everybody, who will meet this issue in future, guys, please, complain about this situation, give "BUG Report" to them, and write "feature request" to them , in the way of creating some repair tool, which check actual  "broken" connections between encoder and premiere, which refuses to "take material" from it and encode, and REPAIR it automatically..  
       I am not IT, but ..does it seems so hard to create this ? Adobe IT developers should know their systems, and should create such utility tool really easy.
    Steps to reproduce bug:
    1. i export anything by button "queue" from premiere to Encoder
    2. Encoder will start encoding
    3. Encoder does not show the window of media encoding (down left )
    Results: sound of sheep occur,
    in encoding error file is this reason of canceling the encoding :
    01/02/2014 10:10:48 AM : Encoding Failed
    Could not read from the source. Please check if it has moved or been deleted.
    History of this problem and detailed description, HOW i did "repair" this. With wasting of app 2,5 days of my working time :
    1. after repairing "error 5" problem , i solved it by reinstalling the suite from the new admin user profile (profile B) . 
    I continued my work on my normal working windows profile . (profile A)
    Every cooperation (AE+Pr, export media via "queue" to Encoder) was working fine . . .
    2. suddenly it stop working (without knowing any possible reason - i did not do installations )
    and showed in error export log file :
    "Could not read from the source. Please check if it has moved or been deleted."
    3.repair via procedure(procedure "a"):
    i did this procedure on the profile B (profile from last time installation of repairing problem error 5)
    I did these steps :
    a-uninstall master coll suite
    b-i used Adobe cleaner tool (remove ALL)
    c-removed raw directories in locations
    •C:\Program Files\Adobe
    •C:\Program Files(x86)\Adobe
    •C:\Program Files\Common Files\Adobe
    •C:\Program Files(x86)\Common Files\Adobe
    •C:\ProgramData\Adobe
    d-removed these links from registry file
    •HKEY_LOCAL_MACHINE\SOFTWARE\Adobe
    •HKEY_CURRENT_USER\Software\Adobe
    •HKEY_LOCAL_MACH INE\SOFTWARE\Wow6432Node\Adobe
    •HKEY_CURRENT_USER \Software\Wow6432Node\Adobe
    e-restarted the PC
    f- newly installed the Master Coll CS6
    g-update the software
    result of repair of "3" : problem still exists
    4.Ok i find out after coordination with support, it should have been created  ANOTHER NEW admin account.
    4a:so i did the same procedure (uninstalling) in profile B
    4b: and then i created brand new admin profile (profile C)for INSTALLATION of software
    4c: restarted the pc (and did not updated it yet)
    result :
    ==exporting of any sequence/raw/AE link video material from premiere via "queue" (Encoder) (profile C) : export WORKS
    ==exporting of any sequence/raw/AE link video material from premiere via "queue" (Encoder) (profile B) : export WORKS
    ==exporting of any sequence/raw/AE link video material from premiere via "queue" (Encoder) (profile A) : export DOES NOT WORK ! ! !
    (in profile A, is possible to export some raw video material in encoder which is imported to it via "drag and drop)
    problem i see:, i have my basic profile A, which i am interested to work, because of all my directory modifications are in there..
    this issue should be some "broken" connections between encoder and premiere, which refuses to "take material" from it and encode.
    what i expect :
    to get from Adobe some repair tool, which automatically checks these connections and repair if necessary, without necessity of founding the new profile and reinstallation of whole software.. this is madness !
    what i do NOT expect from Adobe:
    to get from Adobe advice of kind : you have to reinstall full software in new admin profile. sorry , we do not know the solution, because we do not know, how do behave our software.

  • CS4 Pr-Encoder: "Encoding failed/Could not read from the source..."

    When i start queueing it apears to be loading fine but then after a few minutes it gives me the yellow hazard triangle on the status column. I have tryied changing settings and still the same.
    "Could not read from the source. Please check if it has moved or been deleted."
    ...is what the details notepad displays
    This is my first Pr CS4 editing, Please help.
    Thanx!

    latest versions of CS4 and snow leopard 10.6.1.
    May have no part in your problem, but many are having real issues with almost anything Adobe with Snow Leopard. There has been a lot of chatter saying that Apple is aware of this, and is working on an OS update to be released soon.
    While I have not seen this particular issue with Snow Leopard, there have been so many more, that I'd certainly put the OS into the list of "usual suspects." In the Encore forum, some had great success by rolling back the OS to whatever was prior to Snow Leopard, just plain old "Leopard?"
    Wish I had a definite cure for your ills, but the best that I can offer is that it does not seem that you are alone.
    Good luck, and I hope that the Mac OS update does fix things for you.
    Hunt

Maybe you are looking for

  • Connect a DVD player through SPDIF? (Audigy 2

    Hi I have a SB Audigy 2 ZS and a Cambridge Soundworks 550 set. I often watch DVD movies using the PC DVD-dri've, but since it's impossible to get widescreen TV output from nVidia cards, I've been thinking about getting an external DVD player. The one

  • DATABASE CREATION PROBLEM

    I followed the oracle press dba 8 book 2. I create the password file with password a. I also create the database with instance u16. When i start with my database using svrmgrl the said password does not work. what may be the possible reason. null

  • Reporting Services Unicode Parameters Cause Performance Issues

    When I create a report using string parameters,  reporting services sends the SQL to SQL Server with an N prefix on the string parameters.  This is the behavior even when the underlying data table has no unicode datatypes.  This causes SQL Server to

  • How to use HR Administrative Service sample (HCM prossess and form)?

    Hi Expert, How do we use HR Administrative Service sample( HCM prossess and form)? I already configured the ADS, now when i click HCM Process and From in the MSS (start process) a new screen pop up with nothing on it, just a header without content. C

  • How do I address SSL security issue on iPad 1

    This new security issue discovered recently had my wife and I getting busy updating our phones, great now I have a possible bigger issue. How do I address this SSL issue on my iPad 1 running iOS 5.1.1 . So far apple does not seem to be releasing anyt