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 20 import com.googlecode.mp4parser.AbstractBox; 21 22 import java.nio.ByteBuffer; 23 24 /** 25 * A box unknown to the ISO Parser. If there is no specific Box implementation for a Box this <code>UnknownBox</code> 26 * will just hold the box's data. 27 */ 28 public class UnknownBox extends AbstractBox { 29 ByteBuffer data; 30 UnknownBox(String type)31 public UnknownBox(String type) { 32 super(type); 33 } 34 35 @Override getContentSize()36 protected long getContentSize() { 37 return data.limit(); 38 } 39 40 @Override _parseDetails(ByteBuffer content)41 public void _parseDetails(ByteBuffer content) { 42 data = content; 43 content.position(content.position() + content.remaining()); 44 } 45 46 @Override getContent(ByteBuffer byteBuffer)47 protected void getContent(ByteBuffer byteBuffer) { 48 data.rewind(); 49 byteBuffer.put(data); 50 } 51 getData()52 public ByteBuffer getData() { 53 return data; 54 } 55 setData(ByteBuffer data)56 public void setData(ByteBuffer data) { 57 this.data = data; 58 } 59 } 60