GZIPOutputStream creating more data that I tried to compress!

According to me, only missing me something simple. I try to use GZIPOutputStream to compress the data to send to my server. I started with a chain of about 3000 characters of random text, hard-coded in my code to test. On the server, I can see that I receive gzipped binary data, and I can decode it the original text by using php. Works a charm.

The only problem is that the data sent to my server is about 4500 bytes long. Much longer than the original!

When I take the same text and gzip on the command line output is approximately 500 bytes, which is what I expected.

GZIPOutputStream is really broken? Many forum posts seem to involve people use successfully.

Here is my code:

String data = «...» "3000 bytes of Lorem Ipsum text... « ;

BOS NoCopyByteArrayOutputStream = new NoCopyByteArrayOutputStream();

GOS GZIPOutputStream is new GZIPOutputStream (bos, GZIPOutputStream.COMPRESSION_BEST);.

try {}

GOS. Write (Data.GetBytes ());

GOS. Close();

}

catch (java.io.IOException e) {}

postBytes Byte [] = bos.getByteArray ();

If you set a breakpoint in your code, see table postBytes as being of 4500 bytes long for?  What is the logic that you use for the upload?

Tags: BlackBerry Developers

Similar Questions

  • My Ipod doesn t work "more after that I tried to update.

    I tried to update my ipod with the latest update of the software then it just crashed. now there's just the connection to the screen of itunes, but when I connect to my computer, nothing. When I ran troubleshoot he continues saying my ipod, a disk is missing, but I have itunes and quicktime updated and intalled

    For problems with the iPod, iTunes and QuickTime, you must find an Apple forum site. Maybe you could try http://forums.ilounge.com/ or http://forums.macrumors.com/forumdisplay.php?f=113 or https://discussions.apple.com/community/ipod?view=overview.

  • Trying to create a script that lists all clusters in a data center

    Hello

    I am trying to create a script that exports a vCenter configuration essentially and imports it in a new vCenter. I want the script to run without specifying a center of data manually. All the scripts I've seen you need to manually enter the data center.

    So, how to do a list of all the data centers with clusters in each of them? I also want to create a variable that contains the groups for the respective data centers. Here's a basic idea of what I want to do:

    $Datacenters = get-data center

    foreach ($Datacenter to $Datacenters)

    {

    $cluster = get-Cluster-location $Datacenter

    Write-Host "list of clusters in $Datacenters.

    Write-Host "$Cluster".

    }

    Who will give me the output like this:

    List cluster Datacenter1

    cluster2 CLUSTER1

    List cluster Datacenter2

    cluster3 cluster4

    But I don't know how I can get so I have variable like this:

    $datacenter1 = cluster1, cluster2

    $datacenter2 = cluster3, cluster4

    Did you mean something like this?

    Get-data center | %{

    New-Variable - Name $_. Name - value ([string]: join ("," (Get-Cluster-location $_ | % {$_.}))) Name})))

    }

  • How can I create a chart that creates new series each year when the data are not collected on a daily basis?

    I collect numbers "occasionally" of my solar system and to create a standardized chart that shows that the generation on an annual basis, so I can compare fall in the fall of each year, etc..

    Because the information is not strictly 'daily' (just whenever I get to it), I don't know how it normalize for several years.

    For example, if I had

    Date - Kw/day

    15/01/10 - 14

    03/04/10 - 18

    18/04/10 - 17

    01/06/10 - 19

    21/09/10 - 15

    03/12/10 - 9

    07/02/11 - 13

    02/05/11 - 16

    17/08/11 - 18

    01/11/11 - 12

    02/11/11 - 12

    05/01/12 - 9

    04/06/12 - 12

    and so on.

    What I'd like to see is a line graph for each year from January to December with these datapoints on it. I have much more "incremental data" that I presented above, but it's on "random dates" during the last 8 years, and I'm just trying to see how each year compared to other years.

    To be at the front, I tried to understand how this in Excel as well, but he could not understand where the other.

    DRM for any tips/tricks/tips!

    Steve

    This might work for you...

    I placed your data in a table named "Data."

    Create a second (in this example, titled 'Table 1')

    In the table 'Table 1' months are in the first column and the first row (which is a header row) contains the years - add columns to add new year:

    B2 = if (SUMIFS (data: $B, data: $A, "> =" & (B$ 1, $A2, 1), DATE data: $A, "<" & EOMONTH(A1,0) will GET (DATE B$ 1, $A2, 1, 0) "" "") > 0, SUMIFS (data: $B, given: $A, "> =" & (B$ 1, $A2, 1), DATE data: $A, "<" & EOMONTH(A1,0) will GET (DATE B$ 1, $A2, 1, 0) "" ""), "")

    It's abbreviation dethrone select cell B2 and type (or copy and paste it here) the formula:

    = IF (SUMIFS (data: $B, data: $A, "> =" & (B$ 1, $A2, 1), DATE data: $A, "<" & EOMONTH(A1,0) will GET (DATE B$ 1, $A2, 1, 0) "" "") > 0, SUMIFS (data: $B, given: $A, "> =" & (B$ 1, $A2, 1), DATE data: $A, "<" & EOMONTH(A1,0) will GET (DATE B$ 1, $A2, 1, 0) "" ""), "")

    Select copy of cell B2

    Select the cells B2 at the end of F13, dough

    now select cells A2 through F13 and add a graphic (the XY scatter diagram)

    Add new year add one (or more) new columns for "table 1", then add the year to the top:

    Now alone, click the chart to activate the chart.  then click on the button 'change data references '.

    now, drag the data reference control handle to the right to add the new year to the table:

    You can add several years to the time, so you don't have to it very often

  • How to create a data base so that PDF forms will populate the database, because they are submitted?

    I am trying to create PDF forms that will be filled by several members of an organization. I want to be transmitted electronically and then complete a database so that the data does not have to be reintegrated into a database.

    I usually use Microsoft access but certainly know how to use the values separated by comma (CSV) or Microsoft Excel.

    Currently, I use Acrobat X Pro.

    Acrobat has a built-in feature that will create a CSV file for a range of responses that you receive, full PDF or data files (FDF). In Acrobat 10 you would select: Tools > forms > more shape Options > manage form data > merge data files into spreadsheet

    If you have distributed the form so that you receive responses in the Tracker, there is an option export to CSV so when displaying answers.

  • I am creating a stamp of Certification of drawing dynamic shop with fields of text 'Name' and 'Date '. I tried different ways within Javascript, but I can't seem to make it work. The Date and time remains static on the stamp when it is inserted and

    I am creating a stamp of Certification of drawing dynamic shop with fields of text 'Name' and 'Date '. I tried different ways within Javascript, but I can't seem to make it work. The Date and time remains static on the stamp when inserted and always reflect when the stamp was created and the name is always my name. I try to have the user name or the username inserted so that he who is the insertion of the postmark of the stamp automatically inserts their name and what day and time the stap is inserted. I can't get this dynamic stamp works like the default Adobe Acrobat Dynamic stamps. Can anyone help with this one. Thank you

    Have you created a page template for your stamp? Did name the template of the page correctly? It's the right format:

    #InternalStampName = display name of stamp

  • I am trying to create a function that would be on the table type returns.

    Gurus,

    I am trying to create a function that returns a table nested with 3
    columns in a table as a guy.

    my query is like

    Select col1, col2, col3 from table_1;

    I am a bit newbie in Oracle and have never used collections.
    Can you please guide?

    >
    I am a bit newbie in Oracle and have never used collections.
    >
    Then you should start with the documentation
    http://docs.Oracle.com/CD/B28359_01/AppDev.111/b28370/TOC.htm

    Chapter 5 is all about collections using PL/SQL and examples
    >
    I am trying to create a function that returns a table nested with 3
    columns in a table as a guy.
    >
    This isn't enough of a description to know what you're trying to do, or how you plan to use the service. The query you provided is completely irrelevant to the question you are asking.

    You ask about functions in pipeline? Here is an example of this

    -- type to match emp record
    create or replace type emp_scalar_type as object
      (EMPNO NUMBER(4) ,
       ENAME VARCHAR2(10),
       JOB VARCHAR2(9),
       MGR NUMBER(4),
       HIREDATE DATE,
       SAL NUMBER(7, 2),
       COMM NUMBER(7, 2),
       DEPTNO NUMBER(2)
      )
      /
    
    -- table of emp records
    create or replace type emp_table_type as table of emp_scalar_type
      /
    
    -- pipelined function 
    
    create or replace function get_emp( p_deptno in number )
      return emp_table_type
      PIPELINED
      as
       TYPE EmpCurTyp IS REF CURSOR RETURN emp%ROWTYPE;
        emp_cv EmpCurTyp;
        l_rec  emp%rowtype;
      begin
        open emp_cv for select * from emp where deptno = p_deptno;
        loop
          fetch emp_cv into l_rec;
          exit when (emp_cv%notfound);
          pipe row( emp_scalar_type( l_rec.empno, LOWER(l_rec.ename),
              l_rec.job, l_rec.mgr, l_rec.hiredate, l_rec.sal, l_rec.comm, l_rec.deptno ) );
        end loop;
        return;
      end;
      /
    
    select * from table(get_emp(20))
    
  • How to create a date field that is fixed at the signing?

    Hello

    I created a series of PDF forms on Adobe Pro XI which are designed to be filled out using Adobe Reader (where are saved as Adobe Reader Extended). Once the form is complete there are fields of signature that the user who digitally sign then it disables the specific form fields of editing more far. Next to the signature field, I have a date field that, at present, is using JavaScript to automatically generate the date of business at the opening. However, the question that I have is that I want this field date which will be fixed when the form is signed, rather than update again when the form is opened. Is this possible?

    The document JavaScript that I use to generate the date currently is:

    this.getField("Date1").value = util.printd ("dd/mmm/yyyy", new Date());

    But obviously, this is independent of the signature field.

    How can I create a date field which is set by the current date at the signing?

    I am very new to Adobe in general so I don't have much of an idea about how to go about doing this. Could someone please help me to do it if possible?

    Thank you

    KC

    Go to the properties of the field of Signature and on the signing tab, add

    Copy the following code in the section previous "this script is run when the field is signed.

  • Tried to restore my computer to an earlier date & it keeps its back indicating it cannot restore to this date. I tried 6 different dates that are bold and assume to work. There is no info on what to do next

    Tried to restore my computer to an earlier date & it keeps its back indicating it cannot restore to this date.  I tried 6 different dates that are bold and assume to work. There is no info on what to do next

    Requel,.
    Thanks for posting on the Microsoft answers Forum.  The first thing I would suggest running a virus scan.  Make sure you have no virus causing problems.  If you do not have an antivirus program, then you can download it free here: http://www.microsoft.com/Security_essentials/

    If there is no virus or it still does not work after virus cleaning, then start in safe mode and test from there.  Here are the instructions for Safe Mode.

    Let us know the results. Mike - Engineer Support Microsoft Answers
    Visit our Microsoft answers feedback Forum and let us know what you think.

  • There was a problem creating the destination folder. If please check the permission of folder or choose a different folder.   What that means, tried to name several different folders, but still the same error message. Would be grateful for the help!

    There was a problem creating the destination folder. If please check the permission of folder or choose a different folder.   What that means, tried to name several different folders, but still the same error message. Would be grateful for the help!

    This means that the folder you want to create is blocked because of file permissions. The drive or folder you are trying to create the destination folder is set to read-only, and your username does not have write permissions.

  • How to get data that are created the or before the last Wednesday

    Hi, can someone please tell me how to write a query to retrieve the data that are created the or before last Wednesday.

    Thanks in advance...

    Hello

    Here's one way:

    WHERE created_date< next_day="" (="" trunc="" (sysdate="" )="" -="">

    , "THURSDAY".

    )

    "Before Thursday' means the same as 'the or before Wednesday '.

    This assumes that NLS_DATE_LANGUAGE is English.  If you are not sure what is NLS_DATE_LANGUAGE, you can do this:

    WHERE created_date< next_day="" (="" trunc="" (sysdate="" )="" -="">

    , TO_CHAR (DATE ' 2014-03-06' - or any Thursday)

    , 'DAY '.

    )

    )

    There is nothing magical about March 6, 2014; will do any Thursday.  To_char will return the translation of 'Thursday' in all that is the current NLS_DATE_LANGIUAGE, and NEXT_DAY can use this value.

  • How do I date stamp photo with the date that it was created?

    How do I date stamp photo with the date that it was created?

    donaldm80418165 wrote:

    How do I date stamp photo with the date that it was created?

    Use the text tool.

    Note that you can select the font, color, size of the pt.

  • LiveCycle ES4. I am trying to move a picture online with a text box to create a header.  I had to create a subform that flows to generate multiple pages of text.  After changing the settings, it seems that I can't place images and text where

    LiveCycle ES4. I am trying to move a picture online with a text box to create a header.  I had to create a subform that flows to generate multiple pages of text.  After changing the settings, it seems that I can't place the images and the text I would like.  I tried moving them to the bottom, but does not work.  Is there a way to encapsulate the images so that they can be places as much as I want?

    Select your photo and text inside the subform flowed. Right-click and select wrap in subform do the positioned Subform subform. This will allow you to move objects in this subform positioned the way you like them.

  • Create a hyperlink that will focus more when I save the photoshop to PDF doc?

    Hello

    I am trying to create a hyperlink that will always work when I save all of the Photoshop document in PDF format. I am able to create the hyperlink by using the slice tool, but then when I save it as a PDF, the hyperlink goes.

    I use CS5 on a Mac.

    Thank you!

    I suspect that Photoshop is not appropriate here, you can consider using Indesign for that.

  • I am trying to create a button that opens a pop-up window with a video player, sensible size. Also, I would like for the page Web of the background go darker when that happens. Is there a way top make in Muse?

    I am trying to create a button that opens a pop-up window with a video player, sensible size. Also, I would like for the page Web of the background go darker when that happens. Is there a way top make in Muse?

    Hello

    I created a video for you in Muse. Here is the link:- lightboxvideo.mp4 - Google Drive

    I hope that it would give you an idea on how to do just.

    Kind regards

    Rohit Nair

Maybe you are looking for