Examples of Header


Examples of gps.garmin.img.structure.Header

    protected abstract void seek(long offset) throws ParseException;
   
    protected abstract void skipBytes(int length) throws ParseException;
   
    protected void parseHeader() throws ParseException {
        Header imgHeader = new Header();
        img.setImgHeader(imgHeader);

        parseXorByte(imgHeader);

        // 0x00 x9
        skipBytes(9);

        // Update month
        imgHeader.setUpdateMonth(nextByte());

        // Update year
        nextByte();
        if (currentByte <= 0x62) {
            imgHeader.setUpdateYear(currentByte + 2000);
        } else // >= 0x63
            imgHeader.setUpdateYear(currentByte + 1900);
        }

        // 0x00 x3
        skipBytes(3);

        // Checksum
        imgHeader.setChecksum(nextByte());

        // Signature
        imgHeader.setSignature(parseString(7));

        // 0x02 x1
        skipBytes(1);

        // Sector? x2
        skipBytes(2);

        // Heads? x2
        skipBytes(2);

        // Cylinders? x2
        skipBytes(2);

        // 0x00 x2
        skipBytes(2);

        // 0x00 x25
        skipBytes(25);
       
        // Creation date
        imgHeader.setCreationDate(parseDate());

        // 0x02 x1
        skipBytes(1);

        // Map file identifier
        imgHeader.setMapFileIdentifier(parseString(7));

        // 0x00 x1
        skipBytes(1);

        // Description (first)
        imgHeader.setDescription(parseString(20));

        // Heads? x2
        skipBytes(2);

        // Sectors? x2
        skipBytes(2);

        // Exponent1
        imgHeader.setBlockSizeExponent1(nextByte());

        // Exponent2
        imgHeader.setBlockSizeExponent2(nextByte());

        // FAT block size
        imgHeader.setFatBlockSize(
            (int)
            Math.pow(
                2, imgHeader.getBlockSizeExponent1() + imgHeader.getBlockSizeExponent2()));

        // ???
        skipBytes(2);

        // Description (second)
        imgHeader.setDescription(imgHeader.getDescription() + parseString(31));

        // 0x00 x314
        skipBytes(314);

        // Partition table
        PartitionTable imgPartitionTable = new PartitionTable();
        imgHeader.setPartitionTable(imgPartitionTable);

        // Boot
        imgPartitionTable.setBoot(nextByte());

        // Start head
        imgPartitionTable.setStartHead(nextByte());

        // Start sector
        imgPartitionTable.setStartSector(nextByte());

        // Start cylinder
        imgPartitionTable.setStartCylinder(nextByte());

        // System type
        imgPartitionTable.setSystemType(nextByte());

        // End head
        imgPartitionTable.setEndHead(nextByte());

        // End sector
        imgPartitionTable.setEndSector(nextByte());

        // End cylinder
        imgPartitionTable.setEndCylinder(nextByte());

        // Rel sectors
        imgPartitionTable.setRelSectors(getLittleEndianDWord(4));

        // Number of sectors
        imgPartitionTable.setNumberOfSectors(getLittleEndianDWord(4));

        // 0x00 x48
        skipBytes(48);

        // 0x55
        if (nextByte() != 0x55) {
            throw new IllegalStateException()// fixme
        }

        // 0xAA
        if (nextByte() != 0xAA) {
            throw new IllegalStateException()// fixme
        }

        // End of partition table

        // 0x00 x512
        skipBytes(512);

        // 0x01 x1
        skipBytes(1);

        // 0x20 x11
        skipBytes(11);

        // First subfile offset
        imgHeader.setFirstSubfileOffset(getLittleEndianWord(4));

        // 0x03 x 1
        skipBytes(1);

        // 0x00 x 15
        skipBytes(15);
       
        // Block sequence numbers
        int blockSequenceCounter = 0;
        for (int i = 0; i < 240; i++) {
            int blockSequence = getLittleEndianWord(2);

            if (blockSequence == blockSequenceCounter) {
                imgHeader.getBlockSequence().add(blockSequence);

                blockSequenceCounter++;
            } else {
                // Fill block sequence
                // fixme, que debo hacer acá?
            }
        }

        // Header size
        imgHeader.setHeaderSize(
            imgHeader.getFatBlockSize() * imgHeader.getBlockSequence().size());

        // FAT blocks total size within header
        imgHeader.setFatBlocksTotalSize(imgHeader.getFirstSubfileOffset() - 0x600);
       
        // FAT Blocks
        while (getBytePointer() < imgHeader.getFirstSubfileOffset()) {
            FATBlock fatBlock = new FATBlock();
            imgHeader.getFatBlocks().add(fatBlock);

            // Block type
            if (nextByte() == 0x01) {
                fatBlock.setType(FATBlockType.TRUE);
            } else {
                fatBlock.setType(FATBlockType.DUMMY);
            }

            if (fatBlock.getType() == FATBlockType.TRUE) {
                // Subfile name
                fatBlock.setSubfileName(parseString(8));

                // Subfile type
                fatBlock.setSubfileType(SubfileType.valueOf(parseString(3)));

                // Subfile size
                fatBlock.setSubfileSizeInBytes(getLittleEndianWord(4));

                // Subfile part
                fatBlock.setSubfilePart(getLittleEndianDWord(2));

                // Subfile offset
                if (fatBlock.getSubfilePart() == 0) {
                    fatBlock.setSubfileOffset(
                        blockSequenceCounter * imgHeader.getFatBlockSize());
                }

                // 0x00 x14
                skipBytes(14);

View Full Code Here

Examples of javax.mail.Header

//--------------------------------------------------------------------------------dumpHeaders
    public String dumpHeaders() throws IOException, MessagingException{
        String s = "";

        for (Enumeration e = message.getAllHeaders(); e.hasMoreElements(); )
        {     Header header = (Header) e.nextElement();
           s += "\n" + header.getName() + ": " + header.getValue();
        }
     return s;            
    
    }
View Full Code Here

Examples of javax.sip.header.Header

                request.addHeader(contactHeader);

                // You can add extension headers of your own making
                // to the outgoing SIP request.
                // Add the extension header.
                Header extensionHeader = headerFactory.createHeader("My-Header",
                        "my header value");
                request.addHeader(extensionHeader);

                String sdpData = "v=0\r\n"
                        + "o=4855 13760799956958020 13760799956958020"
                        + " IN IP4  129.6.55.78\r\n" + "s=mysession session\r\n"
                        + "p=+46 8 52018010\r\n" + "c=IN IP4  129.6.55.78\r\n"
                        + "t=0 0\r\n" + "m=audio 6022 RTP/AVP 0 4 18\r\n"
                        + "a=rtpmap:0 PCMU/8000\r\n" + "a=rtpmap:4 G723/8000\r\n"
                        + "a=rtpmap:18 G729A/8000\r\n" + "a=ptime:20\r\n";
                byte[] contents = sdpData.getBytes();

                request.setContent(contents, contentTypeHeader);
                // You can add as many extension headers as you
                // want.

                extensionHeader = headerFactory.createHeader("My-Other-Header",
                        "my new header value ");
                request.addHeader(extensionHeader);

                Header callInfoHeader = headerFactory.createHeader("Call-Info",
                        "<http://www.antd.nist.gov>");
                request.addHeader(callInfoHeader);

                // Create the client transaction.
                ClientTransaction inviteTid = sipProvider.getNewClientTransaction(request);
View Full Code Here

Examples of javazoom.jl.decoder.Header

        try
        {
            Bitstream m_bitstream = new Bitstream(pis);
            int streamPos = m_bitstream.header_pos();
            aff_properties.put("mp3.header.pos", new Integer(streamPos));
            Header m_header = m_bitstream.readFrame();
            // nVersion = 0 => MPEG2-LSF (Including MPEG2.5), nVersion = 1 => MPEG1
            nVersion = m_header.version();
            if (nVersion == 2) aff_properties.put("mp3.version.mpeg", Float.toString(2.5f));
            else aff_properties.put("mp3.version.mpeg", Integer.toString(2 - nVersion));
            // nLayer = 1,2,3
            nLayer = m_header.layer();
            aff_properties.put("mp3.version.layer", Integer.toString(nLayer));
            nSFIndex = m_header.sample_frequency();
            nMode = m_header.mode();
            aff_properties.put("mp3.mode", new Integer(nMode));
            nChannels = nMode == 3 ? 1 : 2;
            aff_properties.put("mp3.channels", new Integer(nChannels));
            nVBR = m_header.vbr();
            af_properties.put("vbr", new Boolean(nVBR));
            aff_properties.put("mp3.vbr", new Boolean(nVBR));
            aff_properties.put("mp3.vbr.scale", new Integer(m_header.vbr_scale()));
            FrameSize = m_header.calculate_framesize();
            aff_properties.put("mp3.framesize.bytes", new Integer(FrameSize));
            if (FrameSize < 0) throw new UnsupportedAudioFileException("Invalid FrameSize : " + FrameSize);
            nFrequency = m_header.frequency();
            aff_properties.put("mp3.frequency.hz", new Integer(nFrequency));
            FrameRate = (float) ((1.0 / (m_header.ms_per_frame())) * 1000.0);
            aff_properties.put("mp3.framerate.fps", new Float(FrameRate));
            if (FrameRate < 0) throw new UnsupportedAudioFileException("Invalid FrameRate : " + FrameRate);
            // Remove heading tag length from real stream length.
            int tmpLength = mLength;
            if ((streamPos > 0) && (mLength != AudioSystem.NOT_SPECIFIED) && (streamPos < mLength)) tmpLength = tmpLength - streamPos;
            if (mLength != AudioSystem.NOT_SPECIFIED)
            {
                aff_properties.put("mp3.length.bytes", new Integer(mLength));
                nTotalFrames = m_header.max_number_of_frames(tmpLength);
                aff_properties.put("mp3.length.frames", new Integer(nTotalFrames));
            }
            BitRate = m_header.bitrate();
            af_properties.put("bitrate", new Integer(BitRate));
            aff_properties.put("mp3.bitrate.nominal.bps", new Integer(BitRate));
            nHeader = m_header.getSyncHeader();
            encoding = sm_aEncodings[nVersion][nLayer - 1];
            aff_properties.put("mp3.version.encoding", encoding.toString());
            if (mLength != AudioSystem.NOT_SPECIFIED)
            {
                nTotalMS = Math.round(m_header.total_ms(tmpLength));
                aff_properties.put("duration", new Long((long) nTotalMS * 1000L));
            }
            aff_properties.put("mp3.copyright", new Boolean(m_header.copyright()));
            aff_properties.put("mp3.original", new Boolean(m_header.original()));
            aff_properties.put("mp3.crc", new Boolean(m_header.checksums()));
            aff_properties.put("mp3.padding", new Boolean(m_header.padding()));
            InputStream id3v2 = m_bitstream.getRawID3v2();
            if (id3v2 != null)
            {
                aff_properties.put("mp3.id3tag.v2", id3v2);
                parseID3v2Frames(id3v2, aff_properties);
            }
            if (TDebug.TraceAudioFileReader) TDebug.out(m_header.toString());
        }
        catch (Exception e)
        {
            if (TDebug.TraceAudioFileReader) TDebug.out("not a MPEG stream:" + e.getMessage());
            throw new UnsupportedAudioFileException("not a MPEG stream:" + e.getMessage());
View Full Code Here

Examples of javazoom.jlme.decoder.Header

  }

  public void play() throws Exception {
    boolean first = true;
    int length;
    Header header = bitstream.readFrame();
    decoder = new Decoder(header, bitstream);
    while (playable)
    {
      try
      {
View Full Code Here

Examples of net.ivoa.fits.Header

   * @exception FitsException
   *                if the object does not contain valid image data.
   */
  public static Header manufactureHeader(Data d) throws FitsException {

    Header h = new Header();
    d.fillHeader(h);

    return h;
  }
View Full Code Here

Examples of net.javazoom.jl.decoder.Header

    try
    {
      AudioDevice out = audio;
      if (out == null) return false;

      Header h = bitstream.readFrame();
      if (h == null) return false;

      // sample buffer set when decoder constructed
      SampleBuffer output = (SampleBuffer) decoder.decodeFrame(h, bitstream);
View Full Code Here

Examples of net.sourceforge.align.util.bind.tmx.Header

  }

  public void format(List<Alignment> alignmentList) {
    Tmx tmx = new Tmx();
    tmx.setVersion(TMX_VERSION);
    Header header = new Header();
    header.setAdminlang(TMX_ADMINLANG);
    header.setSrclang(sourceLanguageCode);
    header.setCreationtool(TMX_CREATIONTOOL);
    header.setCreationtoolversion(TMX_CREATIONTOOLVERSION);
    header.setSegtype(TMX_SEGTYPE);
    header.setDatatype(TMX_DATATYPE);
    header.setOTmf(TMX_OTMF);
    header.setCreationdate(DateParser.getIsoDateNoMillis(new Date()));
    tmx.setHeader(header);
    Body body = new Body();
    for (Alignment alignment : alignmentList) {
      Tu tu = new Tu();
      createTuv(tu, sourceLanguageCode, alignment.getSourceSegmentList());
View Full Code Here

Examples of net.sourceforge.marathon.checklist.CheckList.Header

        FailureNote failureNote = checkList.createFailureNote(label);
        builder.append(failureNote.getPanel(mode.isSelectable(), mode.isEditable()));
    }

    public void addHeader(String label) {
        Header header = checkList.createHeader(label);
        builder.append(header.getPanel(mode.isSelectable(), mode.isEditable()));
    }
View Full Code Here

Examples of nom.tam.fits.Header

    private double retrieveJDReference(BasicHDU[] hdus) {
      double jdRef = 0;

      for (BasicHDU hdu : hdus) {
        // Get reference JD.
        Header header = hdu.getHeader();
        Double value = header.getDoubleValue("JD_REF");
        if (value != null) {
          jdRef = value;
          if (jdRef > 0)
            break;
        }
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.