|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object org.jaudiotagger.audio.ogg.OggVorbisTagWriter
public class OggVorbisTagWriter
Write Vorbis Tag within an ogg
VorbisComment holds the tag information within an ogg file
Field Summary | |
---|---|
static java.util.logging.Logger |
logger
|
private OggVorbisTagReader |
reader
|
private OggVorbisCommentTagCreator |
tc
|
Constructor Summary | |
---|---|
OggVorbisTagWriter()
|
Method Summary | |
---|---|
private void |
calculateChecksumOverPage(java.nio.ByteBuffer page)
Calculate checkSum over the Page |
private byte[] |
createSegments(int length,
boolean quitStream)
This method creates a byte array of values whose sum should be the value of length . |
private byte[] |
createSegmentTable(int newCommentLength,
int setupHeaderLength,
java.util.List<OggPageHeader.PacketStartAndLength> extraPackets)
This method creates a new segment table for the second page (header). |
private byte[] |
createSegmentTable(int setupHeaderLength,
java.util.List<OggPageHeader.PacketStartAndLength> extraPackets)
This method creates a new segment table for the second half of setup header |
void |
delete(java.io.RandomAccessFile raf,
java.io.RandomAccessFile tempRaf)
|
private boolean |
isCommentAndSetupHeaderFitsOnASinglePage(int commentLength,
int setupHeaderLength,
java.util.List<OggPageHeader.PacketStartAndLength> extraPacketList)
|
private void |
replacePagesAndRenumberPageSeqs(OggVorbisTagReader.OggVorbisHeaderSizes originalHeaderSizes,
int newCommentLength,
OggPageHeader secondPageHeader,
java.nio.ByteBuffer newComment,
java.io.RandomAccessFile raf,
java.io.RandomAccessFile rafTemp)
CommentHeader extends over multiple pages OR Comment Header doesnt but it's got larger causing some extra packets to be shifted onto another page. |
private void |
replaceSecondPageAndRenumberPageSeqs(OggVorbisTagReader.OggVorbisHeaderSizes originalHeaderSizes,
int newCommentLength,
int newSecondPageLength,
OggPageHeader secondPageHeader,
java.nio.ByteBuffer newComment,
java.io.RandomAccessFile raf,
java.io.RandomAccessFile rafTemp)
Previously comment and/or setup header was on a number of pages now can just replace this page fitting all on 2nd page, and renumber subsequent sequence pages |
private void |
replaceSecondPageOnly(OggVorbisTagReader.OggVorbisHeaderSizes vorbisHeaderSizes,
int newCommentLength,
int newSecondPageLength,
OggPageHeader secondPageHeader,
java.nio.ByteBuffer newComment,
long secondPageHeaderEndPos,
java.io.RandomAccessFile raf,
java.io.RandomAccessFile rafTemp)
Usually can use this method, previously comment and setup header all fit on page 2 and they still do, so just replace this page. |
private java.nio.ByteBuffer |
startCreateBasicSecondPage(OggVorbisTagReader.OggVorbisHeaderSizes vorbisHeaderSizes,
int newCommentLength,
int newSecondPageLength,
OggPageHeader secondPageHeader,
java.nio.ByteBuffer newComment)
Create a second Page, and add comment header to it, but page is incomplete may want to add addition header and need to calculate CRC |
void |
write(Tag tag,
java.io.RandomAccessFile raf,
java.io.RandomAccessFile rafTemp)
|
void |
writeRemainingPages(int pageSequence,
java.io.RandomAccessFile raf,
java.io.RandomAccessFile rafTemp)
Write all the remaining pages as they are except that the page sequence needs to be modified. |
void |
writeRemainingPagesOld(int pageSequence,
java.io.RandomAccessFile raf,
java.io.RandomAccessFile rafTemp)
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
---|
public static java.util.logging.Logger logger
private OggVorbisCommentTagCreator tc
private OggVorbisTagReader reader
Constructor Detail |
---|
public OggVorbisTagWriter()
Method Detail |
---|
public void delete(java.io.RandomAccessFile raf, java.io.RandomAccessFile tempRaf) throws java.io.IOException, CannotReadException, CannotWriteException
java.io.IOException
CannotReadException
CannotWriteException
public void write(Tag tag, java.io.RandomAccessFile raf, java.io.RandomAccessFile rafTemp) throws CannotReadException, CannotWriteException, java.io.IOException
CannotReadException
CannotWriteException
java.io.IOException
private void calculateChecksumOverPage(java.nio.ByteBuffer page)
page
- private java.nio.ByteBuffer startCreateBasicSecondPage(OggVorbisTagReader.OggVorbisHeaderSizes vorbisHeaderSizes, int newCommentLength, int newSecondPageLength, OggPageHeader secondPageHeader, java.nio.ByteBuffer newComment) throws java.io.IOException
vorbisHeaderSizes
- newCommentLength
- newSecondPageLength
- secondPageHeader
- newComment
-
java.io.IOException
private void replaceSecondPageOnly(OggVorbisTagReader.OggVorbisHeaderSizes vorbisHeaderSizes, int newCommentLength, int newSecondPageLength, OggPageHeader secondPageHeader, java.nio.ByteBuffer newComment, long secondPageHeaderEndPos, java.io.RandomAccessFile raf, java.io.RandomAccessFile rafTemp) throws java.io.IOException
vorbisHeaderSizes
- newCommentLength
- newSecondPageLength
- secondPageHeader
- newComment
- secondPageHeaderEndPos
- raf
- rafTemp
-
java.io.IOException
private void replaceSecondPageAndRenumberPageSeqs(OggVorbisTagReader.OggVorbisHeaderSizes originalHeaderSizes, int newCommentLength, int newSecondPageLength, OggPageHeader secondPageHeader, java.nio.ByteBuffer newComment, java.io.RandomAccessFile raf, java.io.RandomAccessFile rafTemp) throws java.io.IOException, CannotReadException, CannotWriteException
originalHeaderSizes
- newCommentLength
- newSecondPageLength
- secondPageHeader
- newComment
- raf
- rafTemp
-
java.io.IOException
CannotReadException
CannotWriteException
private void replacePagesAndRenumberPageSeqs(OggVorbisTagReader.OggVorbisHeaderSizes originalHeaderSizes, int newCommentLength, OggPageHeader secondPageHeader, java.nio.ByteBuffer newComment, java.io.RandomAccessFile raf, java.io.RandomAccessFile rafTemp) throws java.io.IOException, CannotReadException, CannotWriteException
originalHeaderSizes
- newCommentLength
- secondPageHeader
- newComment
- raf
- rafTemp
-
java.io.IOException
CannotReadException
CannotWriteException
public void writeRemainingPages(int pageSequence, java.io.RandomAccessFile raf, java.io.RandomAccessFile rafTemp) throws java.io.IOException, CannotReadException, CannotWriteException
pageSequence
- raf
- rafTemp
-
java.io.IOException
CannotReadException
CannotWriteException
public void writeRemainingPagesOld(int pageSequence, java.io.RandomAccessFile raf, java.io.RandomAccessFile rafTemp) throws java.io.IOException, CannotReadException, CannotWriteException
java.io.IOException
CannotReadException
CannotWriteException
private byte[] createSegmentTable(int newCommentLength, int setupHeaderLength, java.util.List<OggPageHeader.PacketStartAndLength> extraPackets)
newCommentLength
- The length of the Vorbis CommentsetupHeaderLength
- The length of Setup Header, zero if comment String extends
over multiple pages and this is not the last page.extraPackets
- If there are packets immediately after setup header in same page, they
need including in the segment table
private byte[] createSegmentTable(int setupHeaderLength, java.util.List<OggPageHeader.PacketStartAndLength> extraPackets)
setupHeaderLength
- The length of Setup Header, zero if comment String extends
over multiple pages and this is not the last page.extraPackets
- If there are packets immediately after setup header in same page, they
need including in the segment table
private byte[] createSegments(int length, boolean quitStream)
length
.
length
- Size of the page which should be
represented as 255 byte packets.quitStream
- If true and a length is a multiple of 255 we need another
segment table entry with the value of 0. Else it's the last stream of the
table which is already ended.
private boolean isCommentAndSetupHeaderFitsOnASinglePage(int commentLength, int setupHeaderLength, java.util.List<OggPageHeader.PacketStartAndLength> extraPacketList)
commentLength
- setupHeaderLength
- extraPacketList
-
|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |