I'm trying to read rasters rows through java, but it doesn't always work.
The rows are compressed one by one through zlib (deflate) and put in the file
(the header knows where they start).
The reading works for me if the data is something like
10.0 20.0 30.0
but it can't recognise the compression method when I have something like:
10.123 20.321 30.0
In the code I only found the Z_DEFAULT_COMPRESSION used, so I really can't
understand what goes on. It should compress always the same way.
Any hint?
Andrea
--
____________________________________________________________________________
"Let it be as much a great honour to take as to give learning,
if you want to be called wise."
Skuggsja' - The King's mirror - 1240 Reykjavik
University of Trento
Department of Civil and Environmental Engineering
Via Mesiano, 77 - Trento (ITALY)
Andrea Antonello
tel: +393288497722
fax: +390461882672
____________________________________________________________________________
Andrea Antonello wrote:
I'm trying to read rasters rows through java, but it doesn't always work.
The rows are compressed one by one through zlib (deflate) and put in the file
(the header knows where they start).
The reading works for me if the data is something like
10.0 20.0 30.0
but it can't recognise the compression method when I have something like:
10.123 20.321 30.0
In the code I only found the Z_DEFAULT_COMPRESSION used, so I really can't
understand what goes on. It should compress always the same way.
Any hint?
Are you getting an error from the zlib decompressor, or is the
uncompressed data just not what you were expecting?
--
Glynn Clements <glynn.clements@virgin.net>
It complains about the fact that it doesn't recognise the compression method.
"java.util.zip.DataFormatException: unknown compression method"
It doesn't even start to decompress...
Andrea
On Wednesday 28 April 2004 17:57, Glynn Clements wrote:
Andrea Antonello wrote:
> I'm trying to read rasters rows through java, but it doesn't always work.
> The rows are compressed one by one through zlib (deflate) and put in the
> file (the header knows where they start).
>
> The reading works for me if the data is something like
> 10.0 20.0 30.0
> but it can't recognise the compression method when I have something like:
> 10.123 20.321 30.0
>
> In the code I only found the Z_DEFAULT_COMPRESSION used, so I really
> can't understand what goes on. It should compress always the same way.
>
> Any hint?
Are you getting an error from the zlib decompressor, or is the
uncompressed data just not what you were expecting?
--
____________________________________________________________________________
"Let it be as much a great honour to take as to give learning,
if you want to be called wise."
Skuggsja' - The King's mirror - 1240 Reykjavik
University of Trento
Department of Civil and Environmental Engineering
Via Mesiano, 77 - Trento (ITALY)
Andrea Antonello
tel: +393288497722
fax: +390461882672
____________________________________________________________________________
Andrea Antonello wrote:
It complains about the fact that it doesn't recognise the
compression method. "java.util.zip.DataFormatException: unknown
compression method"
Do you need to tell java.util.zip what the compression method is?
Note that the compressed data doesn't include any kind of signature
(unlike a .gz file, which has a gzip header preceding the compressed
data). GRASS knows when the data is zlib compressed (i.e. if the map
is floating-point and the "compressed:" field in the cellhd file has a
positive value).
BTW, there is also a flag byte at the beginning of each row (either
'0' or '1', i.e. 48 or 49), which indicates whether the compressed
data is actually compressed.
--
Glynn Clements <glynn.clements@virgin.net>
Thanks Glynn, your hint helped to get the stuff running. I was reading some
byte wrong.
Cheers
Andrea
On Wednesday 28 April 2004 19:33, Glynn Clements wrote:
Do you need to tell java.util.zip what the compression method is?
Note that the compressed data doesn't include any kind of signature
(unlike a .gz file, which has a gzip header preceding the compressed
data). GRASS knows when the data is zlib compressed (i.e. if the map
is floating-point and the "compressed:" field in the cellhd file has a
positive value).
BTW, there is also a flag byte at the beginning of each row (either
'0' or '1', i.e. 48 or 49), which indicates whether the compressed
data is actually compressed.
--
____________________________________________________________________________
"Let it be as much a great honour to take as to give learning,
if you want to be called wise."
Skuggsja' - The King's mirror - 1240 Reykjavik
University of Trento
Department of Civil and Environmental Engineering
Via Mesiano, 77 - Trento (ITALY)
Andrea Antonello
tel: +393288497722
fax: +390461882672
____________________________________________________________________________