2 * Sonitus - BlockType.java - Copyright © 2013 David Roden
4 * This program is free software: you can redistribute it and/or modify
5 * it under the terms of the GNU General Public License as published by
6 * the Free Software Foundation, either version 3 of the License, or
7 * (at your option) any later version.
9 * This program is distributed in the hope that it will be useful,
10 * but WITHOUT ANY WARRANTY; without even the implied warranty of
11 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12 * GNU General Public License for more details.
14 * You should have received a copy of the GNU General Public License
15 * along with this program. If not, see <http://www.gnu.org/licenses/>.
18 package net.pterodactylus.sonitus.io.flac;
21 * The type of a metadata block.
23 * @author <a href="mailto:bombe@pterodactylus.net">David ‘Bombe’ Roden</a>
25 public enum BlockType {
27 /** A STREAMINFO block. */
30 public Data createData(byte[] content) {
31 return new StreamInfo(content);
35 /** A PADDING block. */
38 /** An APPLICATION block. */
41 /** A SEEKTABLE block. */
44 /** A VORBIS_COMMENT block. */
47 /** A CUESHEET block. */
50 /** A PICTURE block. */
53 /** A RESERVED block. */
56 /** An INVALID block. */
64 * Creates a {@link Data} object from the given byte array. Block type
65 * enumeration values can override this to return specialized parser objects.
68 * The content of the metadata block
69 * @return The metadata block as a data object
71 public Data createData(byte[] content) {
72 return new Data(content);
80 * Creates a block type from the given block type number.
83 * The block type number
84 * @return The parsed block type
86 public static BlockType valueOf(int blockType) {
87 if ((blockType >= 0) && (blockType <= 6)) {
88 return values()[blockType];
90 if ((blockType > 6) && (blockType < 127)) {