public abstract class AudioFileWriter extends Object
| Constructor and Description |
|---|
AudioFileWriter() |
| Modifier and Type | Method and Description |
|---|---|
static byte[] |
buildOggPageHeader(int headerType,
long granulepos,
int streamSerialNumber,
int pageCount,
int packetCount,
byte[] packetSizes)
Builds and returns an Ogg Page Header.
|
static byte[] |
buildOpusComment(String comment)
Builds and returns a Opus Comment.
|
static byte[] |
buildOpusHeader(int sampleRate)
Builds a Opus Header.
|
abstract void |
close()
Closes the output file.
|
abstract void |
open(File file)
Open the output file.
|
abstract void |
open(String filename)
Open the output file.
|
abstract void |
writeHeader(String comment)
Writes the header pages that start the Ogg Opus file.
|
static void |
writeInt(byte[] data,
int offset,
int v)
Writes a Little-endian int.
|
static void |
writeInt(DataOutput out,
int v)
Writes a Little-endian int.
|
static void |
writeInt(OutputStream os,
int v)
Writes a Little-endian int.
|
static void |
writeLong(byte[] data,
int offset,
long v)
Writes a Little-endian long.
|
static void |
writeLong(OutputStream os,
long v)
Writes a Little-endian long.
|
static int |
writeOggPageHeader(byte[] buf,
int offset,
int headerType,
long granulepos,
int streamSerialNumber,
int pageCount,
int packetCount,
byte[] packetSizes)
Writes an Ogg Page Header to the given byte array.
|
static void |
writeOpusComment(byte[] buf,
int offset,
String comment)
Writes a Opus Comment to the given byte array.
|
static void |
writeOpusHeader(byte[] buf,
int offset,
int sampleRate)
Write Opus header.
|
abstract void |
writePacket(byte[] data,
int offset,
int len)
Writes a packet of audio.
|
static void |
writeShort(byte[] data,
int offset,
int v)
Writes a Little-endian short.
|
static void |
writeShort(DataOutput out,
short v)
Writes a Little-endian short.
|
static void |
writeShort(OutputStream os,
short v)
Writes a Little-endian short.
|
static void |
writeString(byte[] data,
int offset,
String v)
Writes a String.
|
public static int writeOggPageHeader(byte[] buf,
int offset,
int headerType,
long granulepos,
int streamSerialNumber,
int pageCount,
int packetCount,
byte[] packetSizes)
buf - the buffer to write to.offset - the from which to start writing.headerType - the header type flag
(0=normal, 2=bos: beginning of stream, 4=eos: end of stream).granulepos - the absolute granule position.streamSerialNumber - the stream serial numberpageCount - the page countpacketCount - the packet countpacketSizes - the packet sizespublic static byte[] buildOggPageHeader(int headerType,
long granulepos,
int streamSerialNumber,
int pageCount,
int packetCount,
byte[] packetSizes)
headerType - the header type flag
(0=normal, 2=bos: beginning of stream, 4=eos: end of stream).granulepos - the absolute granule position.streamSerialNumber - the stream serial numberpageCount - the page countpacketCount - the packet countpacketSizes - the packet sizespublic static byte[] buildOpusHeader(int sampleRate)
sampleRate - the sample ratepublic static void writeOpusHeader(byte[] buf,
int offset,
int sampleRate)
buf - the bufoffset - the offsetsampleRate - the sample ratepublic static void writeOpusComment(byte[] buf,
int offset,
String comment)
buf - the buffer to write to.offset - the from which to start writing.comment - the comment.public static byte[] buildOpusComment(String comment)
comment - the comment.public static void writeShort(DataOutput out, short v) throws IOException
out - the data output to write to.v - value to write.IOException - Signals that an I/O exception has occurred.public static void writeInt(DataOutput out, int v) throws IOException
out - the data output to write to.v - value to write.IOException - Signals that an I/O exception has occurred.public static void writeShort(OutputStream os, short v) throws IOException
os - - the output stream to write to.v - - the value to write.IOException - Signals that an I/O exception has occurred.public static void writeInt(OutputStream os, int v) throws IOException
os - - the output stream to write to.v - - the value to write.IOException - Signals that an I/O exception has occurred.public static void writeLong(OutputStream os, long v) throws IOException
os - - the output stream to write to.v - - the value to write.IOException - Signals that an I/O exception has occurred.public static void writeShort(byte[] data,
int offset,
int v)
data - the array into which the data should be written.offset - the offset from which to start writing in the array.v - the value to write.public static void writeInt(byte[] data,
int offset,
int v)
data - the array into which the data should be written.offset - the offset from which to start writing in the array.v - the value to write.public static void writeLong(byte[] data,
int offset,
long v)
data - the array into which the data should be written.offset - the offset from which to start writing in the array.v - the value to write.public static void writeString(byte[] data,
int offset,
String v)
data - the array into which the data should be written.offset - the offset from which to start writing in the array.v - the value to write.public abstract void close()
throws IOException
IOException - if there was an exception closing the Audio Writer.public abstract void open(File file) throws IOException
file - - file to open.IOException - if there was an exception opening the Audio Writer.public abstract void open(String filename) throws IOException
filename - - file to open.IOException - if there was an exception opening the Audio Writer.public abstract void writeHeader(String comment) throws IOException
comment - description to be included in the header.IOException - Signals that an I/O exception has occurred.public abstract void writePacket(byte[] data,
int offset,
int len)
throws IOException
data - audio dataoffset - the offset from which to start reading the data.len - the length of data to read.IOException - Signals that an I/O exception has occurred.