@Test public void testWithUnknownChunk() throws Exception { final String author = "AUTH4567"; final File aiff = createAIFF("FORM", "AIFF", new PseudoChunk("XYZ0", "SOME_STUFF"), new PseudoChunk("AUTH", author)); final AiffInfoReader aiffInfoReader = new AiffInfoReader(); try (FileChannel fc = new RandomAccessFile(aiff, "rw").getChannel()) { final GenericAudioHeader audioHeader = aiffInfoReader.read(fc, aiff.getAbsolutePath()); Assert.assertTrue(audioHeader instanceof AiffAudioHeader); final AiffAudioHeader aiffAudioHeader = (AiffAudioHeader)audioHeader; Assert.assertEquals(author, aiffAudioHeader.getAuthor()); } aiff.delete(); }
protected GenericAudioHeader read(FileChannel fc, final String fileName) throws CannotReadException, IOException { LOG.log(TRACE, "$1%s Reading AIFF file size:$2%d 0x$2%x", fileName, fc.size()); AiffAudioHeader aiffAudioHeader = new AiffAudioHeader(); final AiffFileHeader fileHeader = new AiffFileHeader(); long noOfBytes = fileHeader.readHeader(fc, aiffAudioHeader, fileName); while (fc.position() < fc.size()) { if (!readChunk(fc, aiffAudioHeader, fileName)) { LOG.log(ERROR, "%s UnableToReadProcessChunk", fileName); break; } } calculateBitRate(aiffAudioHeader); return aiffAudioHeader; }
AiffInfoReader extends AiffChunkReader { protected GenericAudioHeader read(FileChannel fc, final String fileName) throws CannotReadException, IOException { LOG.log(TRACE, "$1%s Reading AIFF file size:$2%d 0x$2%x", fileName, fc.size()); AiffAudioHeader aiffAudioHeader = new AiffAudioHeader(); final AiffFileHeader fileHeader = new AiffFileHeader(); long noOfBytes = fileHeader.readHeader(fc, aiffAudioHeader, fileName); while (fc.position() < fc.size()) { if (!readChunk(fc, aiffAudioHeader, fileName)) { LOG.log(ERROR, "%s UnableToReadProcessChunk", fileName); break; } } calculateBitRate(aiffAudioHeader); return aiffAudioHeader; } }
AiffInfoReader extends AiffChunkReader { protected GenericAudioHeader read(FileChannel fc, final String fileName) throws CannotReadException, IOException { LOG.log(TRACE, "$1%s Reading AIFF file size:$2%d 0x$2%x", fileName, fc.size()); AiffAudioHeader aiffAudioHeader = new AiffAudioHeader(); final AiffFileHeader fileHeader = new AiffFileHeader(); long noOfBytes = fileHeader.readHeader(fc, aiffAudioHeader, fileName); while (fc.position() < fc.size()) { if (!readChunk(fc, aiffAudioHeader, fileName)) { LOG.log(ERROR, "%s UnableToReadProcessChunk", fileName); break; } } calculateBitRate(aiffAudioHeader); return aiffAudioHeader; }  }
AiffInfoReader extends AiffChunkReader { protected GenericAudioHeader read(FileChannel fc, final String fileName) throws CannotReadException, IOException { LOG.log(TRACE, "$1%s Reading AIFF file size:$2%d 0x$2%x", fileName, fc.size()); AiffAudioHeader aiffAudioHeader = new AiffAudioHeader(); final AiffFileHeader fileHeader = new AiffFileHeader(); long noOfBytes = fileHeader.readHeader(fc, aiffAudioHeader, fileName); while (fc.position() < fc.size()) { if (!readChunk(fc, aiffAudioHeader, fileName)) { LOG.log(ERROR, "%s UnableToReadProcessChunk", fileName); break; } } calculateBitRate(aiffAudioHeader); return aiffAudioHeader; }   }
AiffInfoReader extends AiffChunkReader { protected GenericAudioHeader read(FileChannel fc, final String fileName) throws CannotReadException, IOException { LOG.log(TRACE, "$1%s Reading AIFF file size:$2%d 0x$2%x", fileName, fc.size()); AiffAudioHeader aiffAudioHeader = new AiffAudioHeader(); final AiffFileHeader fileHeader = new AiffFileHeader(); long noOfBytes = fileHeader.readHeader(fc, aiffAudioHeader, fileName); while (fc.position() < fc.size()) { if (!readChunk(fc, aiffAudioHeader, fileName)) { LOG.log(ERROR, "%s UnableToReadProcessChunk", fileName); break; } } calculateBitRate(aiffAudioHeader); return aiffAudioHeader; }    }