CoverUriBox.java revision dd9eb897ee7c7b507cbdcf80263bb4b5de6966bf
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 17package com.coremedia.iso.boxes.vodafone; 18 19import com.coremedia.iso.IsoTypeReader; 20import com.coremedia.iso.Utf8; 21import com.googlecode.mp4parser.AbstractFullBox; 22 23import java.nio.ByteBuffer; 24 25/** 26 * A vodafone specific box. 27 */ 28public class CoverUriBox extends AbstractFullBox { 29 public static final String TYPE = "cvru"; 30 31 private String coverUri; 32 33 public CoverUriBox() { 34 super(TYPE); 35 } 36 37 public String getCoverUri() { 38 return coverUri; 39 } 40 41 public void setCoverUri(String coverUri) { 42 this.coverUri = coverUri; 43 } 44 45 protected long getContentSize() { 46 return Utf8.utf8StringLengthInBytes(coverUri) + 5; 47 } 48 49 @Override 50 public void _parseDetails(ByteBuffer content) { 51 parseVersionAndFlags(content); 52 coverUri = IsoTypeReader.readString(content); 53 } 54 55 @Override 56 protected void getContent(ByteBuffer byteBuffer) { 57 writeVersionAndFlags(byteBuffer); 58 byteBuffer.put(Utf8.convert(coverUri)); 59 byteBuffer.put((byte) 0); 60 } 61 62 63 public String toString() { 64 return "CoverUriBox[coverUri=" + getCoverUri() + "]"; 65 } 66} 67