Пример #1
0
  /**
   * *****************************************************************************************************************
   *
   * <p>Returns the tag values as integers.
   *
   * @param key the tag key
   * @return the integers or null if the tag is not present
   *     <p>****************************************************************************************************************
   */
  @CheckForNull
  public int[] getIntegers(@Nonnull final Object key) {
    final AbstractTag tag = getTag(key);

    if (tag == null) {
      return null;
    }

    int[] intValues = tag.getIntValues();

    if (intValues != null) {
      return intValues;
    }

    final byte[] byteValues = tag.getByteValues();

    if (byteValues != null) {
      intValues = new int[byteValues.length];

      for (int i = 0; i < byteValues.length; i++) {
        intValues[i] = byteValues[i] & 0xff;
      }

      return intValues;
    }

    return null;
  }
Пример #2
0
 /**
  * *****************************************************************************************************************
  *
  * <p>Adds a tag to this <code>Directory</code>.
  *
  * @param tag the tag to add
  *     <p>****************************************************************************************************************
  */
 public void addTag(@Nonnull final AbstractTag tag) {
   if (tag != null) {
     final int key = tag.getCode();
     tagMapByKey.put(tagRegistry.getKey(key), tag);
     keyList.add(tagRegistry.getKey(key));
   }
 }
Пример #3
0
  /**
   * Remove tag from file
   *
   * @param mp3tag
   * @throws FileNotFoundException
   * @throws IOException
   */
  public void delete(AbstractTag mp3tag) throws FileNotFoundException, IOException {
    RandomAccessFile raf = new RandomAccessFile(this.file, "rw");
    mp3tag.delete(raf);
    raf.close();
    if (mp3tag instanceof ID3v1Tag) {
      id3v1tag = null;
    }

    if (mp3tag instanceof AbstractID3v2Tag) {
      id3v2tag = null;
    }
  }
Пример #4
0
 /**
  * *****************************************************************************************************************
  *
  * <p>Returns the tag value as a string.
  *
  * @param key the tag key
  * @return the string or null if the tag has not been found
  *     <p>****************************************************************************************************************
  */
 @CheckForNull
 public String getString(@Nonnull final Object key) {
   final AbstractTag tag = getTag(key);
   return (tag != null) ? tag.getASCIIValue() : null;
 }
Пример #5
0
 /**
  * *****************************************************************************************************************
  *
  * <p>Returns the tag values as floats.
  *
  * @param key the tag key
  * @return the floats or null if the tag is not present
  *     <p>****************************************************************************************************************
  */
 @CheckForNull
 public float[] getFloats(@Nonnull final Object key) {
   final AbstractTag tag = getTag(key);
   return (tag != null) ? tag.getFloatValues() : null;
 }
Пример #6
0
 /**
  * *****************************************************************************************************************
  *
  * <p>Returns the tag values as doubles.
  *
  * @param key the tag key
  * @return the doubles or null if the tag is not present
  *     <p>****************************************************************************************************************
  */
 @CheckForNull
 public double[] getDoubles(@Nonnull final Object key) {
   final AbstractTag tag = getTag(key);
   return (tag != null) ? asDoubles(tag.getRationalValues()) : null;
 }
Пример #7
0
 /**
  * *****************************************************************************************************************
  *
  * <p>Returns the tag values as rationals.
  *
  * @param key the tag key
  * @return the rationals or null if the tag is not present
  *     <p>****************************************************************************************************************
  */
 @CheckForNull
 public TagRational[] getRationals(@Nonnull final Object key) {
   AbstractTag tag = getTag(key);
   return (tag != null) ? tag.getRationalValues() : null;
 }
Пример #8
0
 /**
  * *****************************************************************************************************************
  *
  * <p>Returns the tag values as bytes.
  *
  * @param key the tag key
  * @return the bytes or null if the tag is not present
  *     <p>****************************************************************************************************************
  */
 @CheckForNull
 public byte[] getBytes(@Nonnull final Object key) {
   final AbstractTag tag = getTag(key);
   return (tag != null) ? tag.getByteValues() : null;
 }
Пример #9
0
 /**
  * *****************************************************************************************************************
  *
  * <p>FIXME: This method is only provided for supporting it.tidalwave.image.DirectorySupport, but
  * should be replaced with a more decoupled mechanism. This method returns a plain Number when an
  * enumeration could be expected.
  *
  * <p>****************************************************************************************************************
  */
 @CheckForNull
 public Object getObject(@Nonnull final Object key) {
   final AbstractTag tag = getTag(key);
   return (tag != null) ? tag.getValue() : null;
 }