-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathMusicFile.java
More file actions
88 lines (69 loc) · 1.93 KB
/
Copy pathMusicFile.java
File metadata and controls
88 lines (69 loc) · 1.93 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
import java.io.Serializable;
/* MusicFile objects are used to store the Mp3File's information.
* The strings trackName, artistName, albumInfo, genre are extracted from
* the Id3v1Tag of the mp3 file that the consumer wants to receive.
* The byte[] musicFileExtract is extracted from the mp3 file itself.
*/
public class MusicFile implements Serializable{
private static final long serialVersionUID = 1L;
private String trackName;
private String artistName;
private String albumInfo;
private String genre;
private byte[] musicFileExtract; //The chunk of data that is going to be sent from the Publisher -> Broker -> Consumer.
//Class constructor.
public MusicFile(String trackName, String artistName, String albumInfo, String genre, byte[] musicFileExtract) {
if(trackName != null) {
this.trackName = trackName;
}else {
this.trackName = "";
}
if(artistName != null) {
this.artistName = artistName;
}else {
this.artistName = "";
}
if(albumInfo != null) {
this.albumInfo = albumInfo;
}else {
this.albumInfo = "";
}
if(genre != null) {
this.genre = genre;
}else {
this.genre = "";
}
this.musicFileExtract = musicFileExtract;
}
//Setters and getters of this class.
public void setTrackName(String trackName){
this.trackName = trackName;
}
public void setArtistName(String artistName){
this.artistName = artistName;
}
public void setAlbumInfo(String albumInfo){
this.albumInfo = albumInfo;
}
public void setGenre(String genre){
this.genre = genre;
}
public void setMusicFileExtract(byte[] musicFileExtract){
this.musicFileExtract = musicFileExtract;
}
public String getTrackName(){
return this.trackName;
}
public String getArtistName(){
return this.artistName;
}
public String getAlbumInfo(){
return this.albumInfo;
}
public String getGenre(){
return this.genre;
}
public byte[] getMusicFileExtract(){
return this.musicFileExtract;
}
}