• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /*
2  * Copyright 2008 CoreMedia AG, Hamburg
3  *
4  * Licensed under the Apache License, Version 2.0 (the License);
5  * you may not use this file except in compliance with the License.
6  * You may obtain a copy of the License at
7  *
8  *     http://www.apache.org/licenses/LICENSE-2.0
9  *
10  * Unless required by applicable law or agreed to in writing, software
11  * distributed under the License is distributed on an AS IS BASIS,
12  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13  * See the License for the specific language governing permissions and
14  * limitations under the License.
15  */
16 
17 package com.coremedia.iso.boxes;
18 
19 import com.googlecode.mp4parser.AbstractBox;
20 
21 import java.nio.ByteBuffer;
22 
23 /**
24  * A user specifc box. See ISO/IEC 14496-12 for details.
25  */
26 public class UserBox extends AbstractBox {
27     byte[] data;
28     public static final String TYPE = "uuid";
29 
UserBox(byte[] userType)30     public UserBox(byte[] userType) {
31         super(TYPE, userType);
32     }
33 
34 
getContentSize()35     protected long getContentSize() {
36         return data.length;
37     }
38 
toString()39     public String toString() {
40         return "UserBox[type=" + (getType()) +
41                 ";userType=" + new String(getUserType()) +
42                 ";contentLength=" + data.length + "]";
43     }
44 
45 
getData()46     public byte[] getData() {
47         return data;
48     }
49 
setData(byte[] data)50     public void setData(byte[] data) {
51         this.data = data;
52     }
53 
54     @Override
_parseDetails(ByteBuffer content)55     public void _parseDetails(ByteBuffer content) {
56         data = new byte[content.remaining()];
57         content.get(data);
58     }
59 
60     @Override
getContent(ByteBuffer byteBuffer)61     protected void getContent(ByteBuffer byteBuffer) {
62         byteBuffer.put(data);
63     }
64 }
65