📄 apev2tag.java
字号:
if (header.hasHeader()) {//如果有标头的话,长度还要加32个字节 length += 32; } deleteLength += length; } raf.setLength(raf.length() - deleteLength); log.log(Level.INFO, "APEv2标签删除完毕..."); } public void add(TagField field) throws FieldDataInvalidException { } public void addAlbum(String album) throws FieldDataInvalidException { setAlbum(album); } public void addArtist(String artist) throws FieldDataInvalidException { setArtist(artist); } public void addComment(String comment) throws FieldDataInvalidException { setComment(comment); } public void addGenre(String genre) throws FieldDataInvalidException { setGenre(genre); } public void addTitle(String title) throws FieldDataInvalidException { setTitle(title); } public void addTrack(String track) throws FieldDataInvalidException { setTrack(track); } public void addYear(String year) throws FieldDataInvalidException { setYear(year); } public List<TagField> get(String id) { return null; } public List<TagField> getAlbum() { if (getFirstAlbum().length() > 0) { TagItem field = new TagItem(APEv2FieldKey.Album.name(), getFirstAlbum()); return returnFieldToList(field); } else { return new ArrayList<TagField>(); } } public List<TagField> getArtist() { if (getFirstAlbum().length() > 0) { TagItem field = new TagItem(APEv2FieldKey.Artist.name(), getFirstArtist()); return returnFieldToList(field); } else { return new ArrayList<TagField>(); } } public List<TagField> getComment() { if (getFirstAlbum().length() > 0) { TagItem field = new TagItem(APEv2FieldKey.Comment.name(), getFirstComment()); return returnFieldToList(field); } else { return new ArrayList<TagField>(); } } public List<TagField> getGenre() { if (getFirstAlbum().length() > 0) { TagItem field = new TagItem(APEv2FieldKey.Genre.name(), getFirstGenre()); return returnFieldToList(field); } else { return new ArrayList<TagField>(); } } public List<TagField> getTitle() { if (getFirstAlbum().length() > 0) { TagItem field = new TagItem(APEv2FieldKey.Title.name(), getFirstTitle()); return returnFieldToList(field); } else { return new ArrayList<TagField>(); } } public List<TagField> getTrack() { if (getFirstAlbum().length() > 0) { TagItem field = new TagItem(APEv2FieldKey.Track.name(), getFirstTrack()); return returnFieldToList(field); } else { return new ArrayList<TagField>(); } } public List<TagField> getYear() { if (getFirstAlbum().length() > 0) { TagItem field = new TagItem(APEv2FieldKey.Year.name(), getFirstYear()); return returnFieldToList(field); } else { return new ArrayList<TagField>(); } } public String getFirstAlbum() { return this.album; } public String getFirstArtist() { return artist; } public String getFirstComment() { return comment; } public String getFirstGenre() { return genre; } public String getFirstTitle() { return title; } public String getFirstTrack() { return track; } public String getFirstYear() { return year; } public boolean hasCommonFields() { return true; } public boolean hasField(String id) { throw new UnsupportedOperationException("Not supported yet."); } public boolean isEmpty() { throw new UnsupportedOperationException("Not supported yet."); } public void set(TagField field) throws FieldDataInvalidException { TagFieldKey genericKey = TagFieldKey.valueOf(field.getId()); switch (genericKey) { case ARTIST: setArtist(field.toString()); break; case ALBUM: setAlbum(field.toString()); break; case TITLE: setTitle(field.toString()); break; case GENRE: setGenre(field.toString()); break; case YEAR: setYear(field.toString()); break; case COMMENT: setComment(field.toString()); break; } } public void setAlbum(String s) throws FieldDataInvalidException { this.album = s; map.put(APEv2FieldKey.Album.name(), album); } public void setArtist(String s) throws FieldDataInvalidException { this.artist = s; map.put(APEv2FieldKey.Artist.name(), s); } public void setComment(String s) throws FieldDataInvalidException { this.comment = s; map.put(APEv2FieldKey.Comment.name(), s); } public void setGenre(String s) throws FieldDataInvalidException { this.genre = s; map.put(APEv2FieldKey.Genre.name(), s); } public void setTitle(String s) throws FieldDataInvalidException { this.title = s; map.put(APEv2FieldKey.Title.name(), s); } public void setTrack(String s) throws FieldDataInvalidException { this.track = s; map.put(APEv2FieldKey.Track.name(), s); } public void setYear(String s) throws FieldDataInvalidException { this.year = s; map.put(APEv2FieldKey.Year.name(), s); } public TagField createTagField(TagFieldKey genericKey, String value) throws KeyNotFoundException, FieldDataInvalidException { throw new UnsupportedOperationException("Not supported yet."); } public String getFirst(String id) { throw new UnsupportedOperationException("Not supported yet."); } public String getFirst(TagFieldKey id) throws KeyNotFoundException { throw new UnsupportedOperationException("Not supported yet."); } public TagField getFirstField(String id) { throw new UnsupportedOperationException("Not supported yet."); } public void deleteTagField(TagFieldKey tagFieldKey) throws KeyNotFoundException { throw new UnsupportedOperationException("Not supported yet."); } public Iterator getFields() { throw new UnsupportedOperationException("Not supported yet."); } public int getFieldCount() { throw new UnsupportedOperationException("Not supported yet."); } public boolean setEncoding(String enc) throws FieldDataInvalidException { return false; } public List<TagField> get(TagFieldKey id) throws KeyNotFoundException { throw new UnsupportedOperationException("Not supported yet."); } public static void main(String[] args) throws Exception { System.out.println(0xD2);// APEv2Tag tag = new APEv2Tag(new File("D:\\难道爱一个人有错吗.mp3"));// tag.load();// System.out.println("tag.album:" + tag.getFirstAlbum());// System.out.println("tag.title:" + tag.getFirstTitle());// System.out.println("tag.artist:" + tag.getFirstArtist()); }}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -