Coverage Report - org.jaudiotagger.audio.asf.io.ChunkHeaderReader
 
Classes in this File Line Coverage Branch Coverage Complexity
ChunkHeaderReader
71%
5/7
N/A
1
 
 1  
 /*
 2  
  * Entagged Audio Tag library
 3  
  * Copyright (c) 2004-2005 Christian Laireiter <liree@web.de>
 4  
  * 
 5  
  * This library is free software; you can redistribute it and/or
 6  
  * modify it under the terms of the GNU Lesser General Public
 7  
  * License as published by the Free Software Foundation; either
 8  
  * version 2.1 of the License, or (at your option) any later version.
 9  
  *  
 10  
  * This library is distributed in the hope that it will be useful,
 11  
  * but WITHOUT ANY WARRANTY; without even the implied warranty of
 12  
  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
 13  
  * Lesser General Public License for more details.
 14  
  * 
 15  
  * You should have received a copy of the GNU Lesser General Public
 16  
  * License along with this library; if not, write to the Free Software
 17  
  * Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 18  
  */
 19  
 package org.jaudiotagger.audio.asf.io;
 20  
 
 21  
 import java.io.IOException;
 22  
 import java.io.InputStream;
 23  
 import java.math.BigInteger;
 24  
 
 25  
 import org.jaudiotagger.audio.asf.data.Chunk;
 26  
 import org.jaudiotagger.audio.asf.data.GUID;
 27  
 import org.jaudiotagger.audio.asf.util.Utils;
 28  
 
 29  
 /**
 30  
  * Default reader, Reads GUID and size out of an input stream and creates a
 31  
  * {@link org.jaudiotagger.audio.asf.data.Chunk}object, finally skips the 
 32  
  * remaining chunk bytes.
 33  
  *
 34  
  * @author Christian Laireiter
 35  
  */
 36  582
 class ChunkHeaderReader implements ChunkReader
 37  
 {
 38  
 
 39  
     /**
 40  
      * {@inheritDoc}
 41  
      */
 42  
     public boolean canFail()
 43  
     {
 44  0
         return false;
 45  
     }
 46  
 
 47  
     /**
 48  
      * {@inheritDoc}
 49  
      */
 50  
     public GUID getApplyingId()
 51  
     {
 52  0
         return GUID.GUID_UNSPECIFIED;
 53  
     }
 54  
 
 55  
     /**
 56  
      * {@inheritDoc}
 57  
      */
 58  
     public Chunk read(final GUID guid, final InputStream stream, final long chunkStart) throws IOException
 59  
     {
 60  582
         final BigInteger chunkLen = Utils.readBig64(stream);
 61  582
         stream.skip(chunkLen.longValue() - 24);
 62  582
         final Chunk result = new Chunk(guid, chunkStart, chunkLen);
 63  582
         return result;
 64  
     }
 65  
 
 66  
 }