~ubuntu-branches/ubuntu/trusty/freeguide/trusty

« back to all changes in this revision

Viewing changes to src/freeguide/plugins/importexport/palmatv/PDBFile.java

  • Committer: Bazaar Package Importer
  • Author(s): Shaun Jackman
  • Date: 2007-09-11 16:52:59 UTC
  • mfrom: (1.2.4 upstream)
  • Revision ID: james.westby@ubuntu.com-20070911165259-4r32oke21i1ezbmv
Tags: 0.10.5-1
* New upstream release.
* Update the watch file.
* Change Debian policy to version 3.7.2.2. No changes necessary.
* Add ant-optional to build dependencies. Closes: #441762.

Show diffs side-by-side

added added

removed removed

Lines of Context:
22
22
import freeguide.common.lib.general.EndianInputStream;
23
23
import freeguide.common.lib.general.EndianOutputByteArray;
24
24
 
25
 
import java.io.BufferedOutputStream;
26
25
import java.io.File;
27
26
import java.io.FileOutputStream;
28
27
import java.io.IOException;
29
 
import java.io.PrintStream;
30
28
 
31
29
import java.util.ArrayList;
32
30
import java.util.Calendar;
41
39
 */
42
40
public class PDBFile
43
41
{
 
42
    protected static final String SPACE_FILLER =
 
43
        "                                     ";
44
44
    protected static final int HEADER_SIZE = 78;
45
45
    protected static final int MAX_RECORD_SIZE = 65000;
46
46
    protected static short dmHdrAttrStream = 0x0080;
104
104
        records = new ArrayList(  );
105
105
 
106
106
        this.PDBName = pdbName;
107
 
        this.creatorID = ( creatorId + "    " ).substring( 0, 4 ).getBytes(  );
108
 
        this.databaseType = ( databaseType + "    " ).substring( 0, 4 )
 
107
        this.creatorID = ( creatorId + SPACE_FILLER ).substring( 0, 4 )
 
108
                           .getBytes(  );
 
109
        this.databaseType = ( databaseType + SPACE_FILLER ).substring( 0, 4 )
109
110
                              .getBytes(  );
110
111
    }
111
112
 
404
405
    /**
405
406
     * DOCUMENT_ME!
406
407
     *
407
 
     * @param fileName DOCUMENT_ME!
408
 
     *
409
 
     * @throws IOException DOCUMENT_ME!
410
 
     */
411
 
    public void dumpToH( String fileName ) throws IOException
412
 
    {
413
 
        PrintStream out =
414
 
            new PrintStream( 
415
 
                new BufferedOutputStream( new FileOutputStream( fileName ) ) );
416
 
 
417
 
        for( int i = 0; i < records.size(  ); i++ )
418
 
        {
419
 
            out.println( 
420
 
                "static signed char record" + i
421
 
                + "[] __attribute__((aligned(2))) = {" );
422
 
 
423
 
            byte[] rec = (byte[])records.get( i );
424
 
 
425
 
            for( int j = 0; j < rec.length; j++ )
426
 
            {
427
 
                if( j > 0 )
428
 
                {
429
 
                    out.print( ", " );
430
 
                }
431
 
 
432
 
                out.print( rec[j] );
433
 
            }
434
 
 
435
 
            out.println( "};" );
436
 
        }
437
 
 
438
 
        out.println( "unsigned char * DBRECORDS[]={" );
439
 
 
440
 
        for( int i = 0; i < records.size(  ); i++ )
441
 
        {
442
 
            if( i > 0 )
443
 
            {
444
 
                out.print( ", " );
445
 
            }
446
 
 
447
 
            out.print( "(unsigned char *)record" + i );
448
 
        }
449
 
 
450
 
        out.println( "};" );
451
 
        out.println( "#define DBRECORDCOUNT " + records.size(  ) );
452
 
        out.flush(  );
453
 
        out.close(  );
454
 
    }
455
 
 
456
 
    /**
457
 
     * DOCUMENT_ME!
458
 
     *
459
408
     * @param data DOCUMENT_ME!
460
409
     * @param pdbName DOCUMENT_ME!
461
410
     * @param creatorId DOCUMENT_ME!