1
package org.jaudiotagger.audio.flac;
3
import org.jaudiotagger.audio.exceptions.CannotReadException;
5
import java.io.RandomAccessFile;
6
import java.io.IOException;
11
* Identifies this is in fact a flac stream
13
public class FlacStream
15
public static final int FLAC_STREAM_IDENTIFIER_LENGTH = 4;
16
public static final String FLAC_STREAM_IDENTIFIER = "fLaC";
19
* Reads the stream block to ensure it is a flac file
23
* @throws CannotReadException
25
public static void findStream(RandomAccessFile raf)throws IOException,CannotReadException
28
if (raf.length() == 0)
31
throw new CannotReadException("Error: File empty");
36
byte[] b = new byte[FlacStream.FLAC_STREAM_IDENTIFIER_LENGTH];
38
String flac = new String(b);
39
if (!flac.equals(FlacStream.FLAC_STREAM_IDENTIFIER))
41
throw new CannotReadException("fLaC Header not found, not a flac file");