Class MP3File


  • public class MP3File
    extends java.lang.Object
    This class represents an MP3 file.
    Author:
    Richard Rudek
    • Constructor Summary

      Constructors 
      Constructor Description
      MP3File​(byte[] mp3Bytes)
      This constructs an MP3File object with the given bytes.
    • Method Summary

      All Methods Instance Methods Concrete Methods 
      Modifier and Type Method Description
      boolean findAllFrames()
      Attempts to find frames by searching for MP3 frame headers and saves their information in this MP3File.
      int getFrameCount()
      Returns the number of frames in this MP3 file.
      java.util.List<steganography.audio.mp3.Frame> getFrames()
      Returns the information of each frame in this MP3 file.
      java.util.List<java.lang.Integer> getModifiablePositions()
      Returns the positions of bytes that are safe to modify.
      byte[] getMP3Bytes()
      Returns the byte array this class was given.
      • Methods inherited from class java.lang.Object

        clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
    • Constructor Detail

      • MP3File

        public MP3File​(byte[] mp3Bytes)
        This constructs an MP3File object with the given bytes.
        Parameters:
        mp3Bytes - the byte array containing the bytes of an MP3 file
    • Method Detail

      • getMP3Bytes

        public byte[] getMP3Bytes()
        Returns the byte array this class was given.
        Returns:
        the byte array this class was given
      • getFrameCount

        public int getFrameCount()
        Returns the number of frames in this MP3 file.
        Returns:
        int - Number of frames,
        -1 if there was no prior search for headers
      • getFrames

        public java.util.List<steganography.audio.mp3.Frame> getFrames()
        Returns the information of each frame in this MP3 file. The header is included in each frame.
        Returns:
        - null, if findAllFrames() has not been called or there are no frames
        - List containing Frames
      • getModifiablePositions

        public java.util.List<java.lang.Integer> getModifiablePositions()
                                                                 throws java.lang.IllegalArgumentException
        Returns the positions of bytes that are safe to modify.
        Returns:
        List of Integers - all positions of modifiable bytes in this MP3 file
        Throws:
        java.lang.IllegalArgumentException - if there are no frames.
        This can happen when findAllFrames has not been called prior to this method or this file is not an MP3 file.
      • findAllFrames

        public boolean findAllFrames()
        Attempts to find frames by searching for MP3 frame headers and saves their information in this MP3File.
        Returns:
        true, if frames have been found
        false, if there are none