示例#1
0
  public LINKID3V2Frame(InputStream oIS) throws ID3Exception {
    try {
      ID3DataInputStream oFrameDataID3DIS = new ID3DataInputStream(oIS);

      // frame identifier (this is probably wrong... it should probably be four
      // bytes.. if anyone ever uses this (?) it might break
      m_abyFrameIdentifier = new byte[4];
      oFrameDataID3DIS.readFully(m_abyFrameIdentifier);

      // url
      m_sURL = oFrameDataID3DIS.readStringToNull();

      // id and additional data
      if (oFrameDataID3DIS.available() > 0) {
        byte[] abyAdditionalData = new byte[oFrameDataID3DIS.available()];
        oFrameDataID3DIS.readFully(abyAdditionalData);
        m_sAdditionalData = new String(abyAdditionalData);
      }
    } catch (Exception e) {
      throw new InvalidFrameID3Exception(e);
    }
  }
示例#2
0
  public USLTID3V2Frame(InputStream oIS) throws ID3Exception {
    // Parse out the text encoding and text string from the raw data
    try {
      ID3DataInputStream oFrameDataID3DIS = new ID3DataInputStream(oIS);

      // text encoding
      m_oTextEncoding = TextEncoding.getTextEncoding(oFrameDataID3DIS.readUnsignedByte());

      // language
      byte[] abyLanguage = new byte[3];
      oFrameDataID3DIS.readFully(abyLanguage);
      m_sLanguage = new String(abyLanguage);

      // content descriptor (read to null)
      m_sContentDescriptor = oFrameDataID3DIS.readStringToNull(m_oTextEncoding);

      // lyrics
      byte[] abyLyrics = new byte[oFrameDataID3DIS.available()];
      oFrameDataID3DIS.readFully(abyLyrics);
      m_sLyrics = new String(abyLyrics, m_oTextEncoding.getEncodingString());
    } catch (Exception e) {
      throw new InvalidFrameID3Exception(e);
    }
  }
示例#3
0
  public COMRID3V2Frame(InputStream oIS) throws ID3Exception {
    // Parse out the text encoding and text string from the raw data
    try {
      ID3DataInputStream oFrameDataID3DIS = new ID3DataInputStream(oIS);

      // text encoding
      m_oTextEncoding = TextEncoding.getTextEncoding(oFrameDataID3DIS.readUnsignedByte());

      // price (read to null)
      m_sPrice = oFrameDataID3DIS.readStringToNull();

      // valid until
      byte[] abyValidUntil = new byte[8];
      oFrameDataID3DIS.readFully(abyValidUntil);
      m_sValidUntil = new String(abyValidUntil);

      // contact url (read to null)
      m_sContactUrl = oFrameDataID3DIS.readStringToNull();

      // received as
      m_byReceivedAs = (byte) oFrameDataID3DIS.readUnsignedByte();

      // name of seller (read to null)
      m_sNameOfSeller = oFrameDataID3DIS.readStringToNull(m_oTextEncoding);

      // description (read to null)
      m_sDescription = oFrameDataID3DIS.readStringToNull(m_oTextEncoding);

      // is there a company logo picture coming?
      if (oFrameDataID3DIS.available() > 0) {
        // company logo mime type (read to null)
        m_sPictureMimeType = oFrameDataID3DIS.readStringToNull();

        // company logo picture data
        m_abySellerLogoData = new byte[oFrameDataID3DIS.available()];
        oFrameDataID3DIS.readFully(m_abySellerLogoData);
      }
    } catch (Exception e) {
      throw new InvalidFrameID3Exception(e);
    }
  }