📄 flacstream.java
字号:
package com.hadeslee.audiotag.audio.flac;
import com.hadeslee.audiotag.audio.exceptions.CannotReadException;
import java.io.RandomAccessFile;
import java.io.IOException;
/**
* Flac Stream
* <p/>
* Identifies this is in fact a flac stream
*/
public class FlacStream
{
public static final int FLAC_STREAM_IDENTIFIER_LENGTH = 4;
public static final String FLAC_STREAM_IDENTIFIER = "fLaC";
/**
* Reads the stream block to ensure it is a flac file
*
* @param raf
* @throws IOException
* @throws CannotReadException
*/
public static void findStream(RandomAccessFile raf)throws IOException,CannotReadException
{
//Begins tag parsing
if (raf.length() == 0)
{
//Empty File
throw new CannotReadException("Error: File empty");
}
raf.seek(0);
//FLAC Stream
byte[] b = new byte[FlacStream.FLAC_STREAM_IDENTIFIER_LENGTH];
raf.read(b);
String flac = new String(b);
if (!flac.equals(FlacStream.FLAC_STREAM_IDENTIFIER))
{
throw new CannotReadException("fLaC Header not found, not a flac file");
}
}
}
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -