I know that the header file tells me the size of the blob is 35904 and
I have already read the first line. I have been told by the author of
the binary file that all I have to figure out in java is a way to read
the pointer that tell me x image is coming up and its this many out of
the entire 35904 bytes. Once I collect them, all I have to do is
output it with a .jpeg extension. I just do not think its that system.
He has sent me some C code, but I am new to Java and I do not know C
so I am constantly search for comparable methods and objects in Java to
do what the C code is doing. It looks like it reads the file, gets
some additional image header data and then extracts them 1 at a time
vPdExtractSingleImage(
CS_FILE fhInFile,
ULONGWORD ulLength,
UCHAR *sOutFile
){
UCHAR sBuffer[ 4096 ];
RETCODE rCode;
ULONGWORD ulWriteBytes = 0;
ULONGWORD ulReadBytes = 0;
ULONGWORD ulRemainBytes = ulLength;
size_t stCount;
CS_FILE fhOutFile;
/*
* Return if there is zero length
*/
if ( ulLength == 0 ){
CS_LPRINTF("No image data found for %s", sOutFile );
return;
}
fhOutFile = CsIoOpen(sOutFile, Write, CSIO_FILE );
if ( fhOutFile ){
do {
if ( ulRemainBytes < sizeof( sBuffer ) ){
ulReadBytes = ulRemainBytes;
}
else {
ulReadBytes = sizeof( sBuffer );
}
rCode = rCsIoRead( &sBuffer, sizeof(UCHAR),
ulReadBytes, &stCount, fhInFile);
if ( !CS_SUCCESS( rCode ) ) {
LOGRCODE( "rCsIoRead() failed", rCode );
}
rCode = rCsIoWrite( &sBuffer, sizeof( UCHAR ),
ulReadBytes, &stCount, fhOutFile );
if ( !CS_SUCCESS( rCode ) ) {
LOGRCODE( "rCsIoWrite() failed.", rCode );
}
ulWriteBytes += ulReadBytes;
ulRemainBytes -= ulReadBytes;
} while( CS_SUCCESS( rCode ) && ulWriteBytes < ulLength );
rCsIoClose(fhOutFile);
CS_LPRINTF("Image data(%lu) extracted into %s", ulWriteBytes,
sOutFile );
}
else {
CS_LPRINTF("Unable to open output file:%s", sOutFile );
}
}
Nigel Wade - 17 Feb 2006 12:12 GMT
> I know that the header file tells me the size of the blob is 35904 and
> I have already read the first line. I have been told by the author of
[quoted text clipped - 6 lines]
> do what the C code is doing. It looks like it reads the file, gets
> some additional image header data and then extracts them 1 at a time
[snipped C code]
The C code doesn't help at all. We don't know what the functions CsIoOpen,
rCsIoRead or rCsIoWrite do (and I don't particularly want to know).
Instead of using C code which you don't understand, you need to get the author
to send you a proper definition of the format of the data file.

Signature
Nigel Wade, System Administrator, Space Plasma Physics Group,
University of Leicester, Leicester, LE1 7RH, UK
E-mail : nmw@ion.le.ac.uk
Phone : +44 (0)116 2523548, Fax : +44 (0)116 2523555
Chris Uppal - 17 Feb 2006 12:58 GMT
> Instead of using C code which you don't understand, you need to get the
> author to send you a proper definition of the format of the data file.
That's to say: a definition of the format in terms of the /bytes/ that make it
up.
-- chris