public Lyrics3Image(Lyrics3Image copy) { super(copy); this.time = new Lyrics3TimeStamp(copy.time); this.description = copy.description; this.filename = copy.filename; }
/** * @return */ public int getSize() { int size = 0; for (Object aTimeStamp : timeStamp) { size += ((Lyrics3TimeStamp) aTimeStamp).getSize(); } return size + lyric.length(); }
public void readByteArray(byte[] arr, int offset) throws InvalidDataTypeException { readString(arr.toString(), offset); }
/** * @param lineString * @param offset * @throws NullPointerException * @throws IndexOutOfBoundsException */ public void readString(String lineString, int offset) { if (lineString == null) { throw new NullPointerException("Image is null"); } if ((offset < 0) || (offset >= lineString.length())) { throw new IndexOutOfBoundsException("Offset to line is out of bounds: offset = " + offset + ", line.length()" + lineString.length()); } int delim; Lyrics3TimeStamp time; timeStamp = new LinkedList<Lyrics3TimeStamp>(); delim = lineString.indexOf("[", offset); while (delim >= 0) { offset = lineString.indexOf("]", delim) + 1; time = new Lyrics3TimeStamp("Time Stamp"); time.readString(lineString.substring(delim, offset)); timeStamp.add(time); delim = lineString.indexOf("[", offset); } lyric = lineString.substring(offset); }
/** * @return */ public String writeString() { String str = ""; Lyrics3TimeStamp time; for (Object aTimeStamp : timeStamp) { time = (Lyrics3TimeStamp) aTimeStamp; str += time.writeString(); } return str + lyric; }
/** * @param sync */ public void addLyric(FrameBodySYLT sync) { // SYLT frames are made of individual lines Iterator<ID3v2LyricLine> iterator = sync.iterator(); Lyrics3Line newLine; ID3v2LyricLine currentLine; Lyrics3TimeStamp timeStamp; HashMap<String, Lyrics3Line> lineMap = new HashMap<String, Lyrics3Line>(); while (iterator.hasNext()) { currentLine = iterator.next(); // createField copy to use in new tag currentLine = new ID3v2LyricLine(currentLine); timeStamp = new Lyrics3TimeStamp("Time Stamp", this); timeStamp.setTimeStamp(currentLine.getTimeStamp(), (byte) sync.getTimeStampFormat()); if (lineMap.containsKey(currentLine.getText())) { newLine = lineMap.get(currentLine.getText()); newLine.addTimeStamp(timeStamp); } else { newLine = new Lyrics3Line("Lyric Line", this); newLine.setLyric(currentLine); newLine.setTimeStamp(timeStamp); lineMap.put(currentLine.getText(), newLine); lines.add(newLine); } } }
/** * @return */ public String toString() { String str; str = "filename = " + filename + ", description = " + description; if (time != null) { str += (", timestamp = " + time.toString()); } return str + "\n"; }
/** * @param obj * @return */ public boolean equals(Object obj) { if (!(obj instanceof Lyrics3Image)) { return false; } Lyrics3Image object = (Lyrics3Image) obj; if (!this.description.equals(object.description)) { return false; } if (!this.filename.equals(object.filename)) { return false; } if (this.time == null) { if (object.time != null) { return false; } } else { if (!this.time.equals(object.time)) { return false; } } return super.equals(obj); }
/** * @param imageString * @param offset * @throws NullPointerException * @throws IndexOutOfBoundsException */ public void readString(String imageString, int offset) { if (imageString == null) { throw new NullPointerException("Image string is null"); } if ((offset < 0) || (offset >= imageString.length())) { throw new IndexOutOfBoundsException("Offset to image string is out of bounds: offset = " + offset + ", string.length()" + imageString.length()); } if (imageString != null) { String timestamp; int delim; delim = imageString.indexOf("||", offset); filename = imageString.substring(offset, delim); offset = delim + 2; delim = imageString.indexOf("||", offset); description = imageString.substring(offset, delim); offset = delim + 2; timestamp = imageString.substring(offset); if (timestamp.length() == 7) { time = new Lyrics3TimeStamp("Time Stamp"); time.readString(timestamp); } } }
/** * @return */ public String toString() { return writeString(); }
timeStamp = new Lyrics3TimeStamp("Time Stamp", this); timeStamp.setTimeStamp(currentLine.getTimeStamp(), (byte) sync.getTimeStampFormat());
/** * @return */ public String toString() { String str; str = "filename = " + filename + ", description = " + description; if (time != null) { str += (", timestamp = " + time.toString()); } return str + "\n"; }
if (!this.time.equals(object.time))
/** * @param lineString * @param offset * @throws NullPointerException * @throws IndexOutOfBoundsException */ public void readString(String lineString, int offset) { if (lineString == null) { throw new NullPointerException("Image is null"); } if ((offset < 0) || (offset >= lineString.length())) { throw new IndexOutOfBoundsException("Offset to line is out of bounds: offset = " + offset + ", line.length()" + lineString.length()); } int delim; Lyrics3TimeStamp time; timeStamp = new LinkedList<Lyrics3TimeStamp>(); delim = lineString.indexOf("[", offset); while (delim >= 0) { offset = lineString.indexOf("]", delim) + 1; time = new Lyrics3TimeStamp("Time Stamp"); time.readString(lineString.substring(delim, offset)); timeStamp.add(time); delim = lineString.indexOf("[", offset); } lyric = lineString.substring(offset); }
/** * @return */ public String toString() { return writeString(); }
timeStamp = new Lyrics3TimeStamp("Time Stamp", this); timeStamp.setTimeStamp(currentLine.getTimeStamp(), (byte) sync.getTimeStampFormat());
public Lyrics3Image(Lyrics3Image copy) { super(copy); this.time = new Lyrics3TimeStamp(copy.time); this.description = copy.description; this.filename = copy.filename; }
/** * @return */ public int getSize() { int size = 0; for (Object aTimeStamp : timeStamp) { size += ((Lyrics3TimeStamp) aTimeStamp).getSize(); } return size + lyric.length(); }
/** * @return */ public String toString() { String str; str = "filename = " + filename + ", description = " + description; if (time != null) { str += (", timestamp = " + time.toString()); } return str + "\n"; }
public void readByteArray(byte[] arr, int offset) throws InvalidDataTypeException { readString(arr.toString(), offset); }