1
package org.jaudiotagger.audio.mp4.atom;
3
import org.jaudiotagger.audio.generic.Utils;
4
import org.jaudiotagger.audio.mp4.Mp4NotMetaFieldKey;
6
import java.io.ByteArrayOutputStream;
7
import java.io.IOException;
8
import java.nio.ByteBuffer;
13
* <p>There are usually two free boxes, one beneath the meta atom and one toplevel atom
15
public class Mp4FreeBox extends AbstractMp4Box
18
* Construct a new FreeBox containing datasize padding (i.e doesnt include header size)
20
* @param datasize padding size
22
public Mp4FreeBox(int datasize)
27
header = new Mp4BoxHeader();
28
ByteArrayOutputStream headerBaos = new ByteArrayOutputStream();
29
headerBaos.write(Utils.getSizeBEInt32(Mp4BoxHeader.HEADER_LENGTH + datasize));
30
headerBaos.write(Utils.getDefaultBytes(Mp4NotMetaFieldKey.FREE.getFieldName(), "ISO-8859-1"));
31
header.update(ByteBuffer.wrap(headerBaos.toByteArray()));
34
ByteArrayOutputStream freeBaos = new ByteArrayOutputStream();
35
for (int i = 0; i < datasize; i++)
39
dataBuffer = ByteBuffer.wrap(freeBaos.toByteArray());
41
catch (IOException ioe)
43
//This should never happen as were not actually writing to/from a file
44
throw new RuntimeException(ioe);
1
package org.jaudiotagger.audio.mp4.atom;
3
import org.jaudiotagger.audio.generic.Utils;
4
import org.jaudiotagger.audio.mp4.Mp4NotMetaFieldKey;
6
import java.io.ByteArrayOutputStream;
7
import java.io.IOException;
8
import java.nio.ByteBuffer;
13
* <p>There are usually two free boxes, one beneath the meta atom and one toplevel atom
15
public class Mp4FreeBox extends AbstractMp4Box
18
* Construct a new FreeBox containing datasize padding (i.e doesnt include header size)
20
* @param datasize padding size
22
public Mp4FreeBox(int datasize)
27
header = new Mp4BoxHeader();
28
ByteArrayOutputStream headerBaos = new ByteArrayOutputStream();
29
headerBaos.write(Utils.getSizeBEInt32(Mp4BoxHeader.HEADER_LENGTH + datasize));
30
headerBaos.write(Utils.getDefaultBytes(Mp4NotMetaFieldKey.FREE.getFieldName(), "ISO-8859-1"));
31
header.update(ByteBuffer.wrap(headerBaos.toByteArray()));
34
ByteArrayOutputStream freeBaos = new ByteArrayOutputStream();
35
for (int i = 0; i < datasize; i++)
39
dataBuffer = ByteBuffer.wrap(freeBaos.toByteArray());
41
catch (IOException ioe)
43
//This should never happen as were not actually writing to/from a file
44
throw new RuntimeException(ioe);