/** * @return */ public int getSize() { int size = 0; Lyrics3Line line; for (Object line1 : lines) { line = (Lyrics3Line) line1; size += (line.getSize() + 2); } return size; //return size - 2; // cut off the last crlf pair }
/** * @return */ public boolean hasTimeStamp() { boolean present = false; for (Object line : lines) { if (((Lyrics3Line) line).hasTimeStamp()) { present = true; } } return present; }
public void readByteArray(byte[] arr, int offset) throws InvalidDataTypeException { readString(arr.toString(), offset); }
/** * @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); } } }
/** * @param unsync */ public void addLyric(FrameBodyUSLT unsync) { // USLT frames are just long text string; Lyrics3Line line = new Lyrics3Line("Lyric Line", this); line.setLyric(unsync.getLyric()); lines.add(line); }
/** * @return */ private String writeString() { Lyrics3Line line; String str = ""; for (Object line1 : lines) { line = (Lyrics3Line) line1; str += (line.writeString() + Lyrics3v2Fields.CRLF); } return str; //return str.substring(0,str.length()-2); // cut off the last CRLF pair }
public FieldFrameBodyLYR(FieldFrameBodyLYR copyObject) { super(copyObject); Lyrics3Line old; for (int i = 0; i < copyObject.lines.size(); i++) { old = copyObject.lines.get(i); this.lines.add(new Lyrics3Line(old)); } }
newLine.addTimeStamp(timeStamp); newLine = new Lyrics3Line("Lyric Line", this); newLine.setLyric(currentLine); newLine.setTimeStamp(timeStamp); lineMap.put(currentLine.getText(), newLine); lines.add(newLine);
/** * @param unsync */ public void addLyric(FrameBodyUSLT unsync) { // USLT frames are just long text string; Lyrics3Line line = new Lyrics3Line("Lyric Line", this); line.setLyric(unsync.getLyric()); lines.add(line); }
/** * @return */ private String writeString() { Lyrics3Line line; String str = ""; for (Object line1 : lines) { line = (Lyrics3Line) line1; str += (line.writeString() + Lyrics3v2Fields.CRLF); } return str; //return str.substring(0,str.length()-2); // cut off the last CRLF pair }
public FieldFrameBodyLYR(FieldFrameBodyLYR copyObject) { super(copyObject); Lyrics3Line old; for (int i = 0; i < copyObject.lines.size(); i++) { old = copyObject.lines.get(i); this.lines.add(new Lyrics3Line(old)); } }
newLine.addTimeStamp(timeStamp); newLine = new Lyrics3Line("Lyric Line", this); newLine.setLyric(currentLine); newLine.setTimeStamp(timeStamp); lineMap.put(currentLine.getText(), newLine); lines.add(newLine);
/** * @param unsync */ public void addLyric(FrameBodyUSLT unsync) { // USLT frames are just long text string; Lyrics3Line line = new Lyrics3Line("Lyric Line", this); line.setLyric(unsync.getLyric()); lines.add(line); }
/** * @return */ private String writeString() { Lyrics3Line line; String str = ""; for (Object line1 : lines) { line = (Lyrics3Line) line1; str += (line.writeString() + Lyrics3v2Fields.CRLF); } return str; //return str.substring(0,str.length()-2); // cut off the last CRLF pair }
public FieldFrameBodyLYR(FieldFrameBodyLYR copyObject) { super(copyObject); Lyrics3Line old; for (int i = 0; i < copyObject.lines.size(); i++) { old = copyObject.lines.get(i); this.lines.add(new Lyrics3Line(old)); } }
public void readByteArray(byte[] arr, int offset) throws InvalidDataTypeException { readString(arr.toString(), offset); }
/** * @return */ public boolean hasTimeStamp() { boolean present = false; for (Object line : lines) { if (((Lyrics3Line) line).hasTimeStamp()) { present = true; } } return present; }
/** * @return */ public int getSize() { int size = 0; Lyrics3Line line; for (Object line1 : lines) { line = (Lyrics3Line) line1; size += (line.getSize() + 2); } return size; //return size - 2; // cut off the last crlf pair }
/** * @param lineString */ private void readString(String lineString) { // now readString each line and put in the vector; String token; int offset = 0; int delim = lineString.indexOf(Lyrics3v2Fields.CRLF); lines = new ArrayList<Lyrics3Line>(); Lyrics3Line line; while (delim >= 0) { token = lineString.substring(offset, delim); line = new Lyrics3Line("Lyric Line", this); line.setLyric(token); lines.add(line); offset = delim + Lyrics3v2Fields.CRLF.length(); delim = lineString.indexOf(Lyrics3v2Fields.CRLF, offset); } if (offset < lineString.length()) { token = lineString.substring(offset); line = new Lyrics3Line("Lyric Line", this); line.setLyric(token); lines.add(line); } }
public byte[] writeByteArray() { return writeString().getBytes(StandardCharsets.ISO_8859_1); } }