/** * Reads the header of a chunk. If _chunkID is non-null, * it's assumed to have already been read. */ public boolean readHeader (DataInputStream dstrm) throws IOException { StringBuffer id = new StringBuffer(4); for (int i = 0; i < 4; i++) { int ch = ModuleBase.readUnsignedByte (dstrm, _module); if (ch < 32) { String hx = Integer.toHexString (ch); if (hx.length () < 2) { hx = "0" + hx; } _repInfo.setMessage (new ErrorMessage (MessageConstants.ERR_CHUNK_ID_CHAR_INV, MessageConstants.ERR_CHUNK_ID_CHAR_SUB + hx, _module.getNByte ())); _repInfo.setWellFormed (false); return false; } id.append((char) ch); } _chunkID = id.toString (); _size = ModuleBase.readUnsignedInt (dstrm, _module.isBigEndian (), _module); return true; }
/** Reads a chunk and puts appropriate information into * the RepInfo object. * * @return <code>false</code> if the chunk is structurally * invalid, otherwise <code>true</code> * */ public boolean readChunk(RepInfo info) throws IOException { boolean isInfo = false; boolean isExif = false; String typeID = ((WaveModule) _module).read4Chars(_dstream); bytesLeft -= 4; if ("INFO".equals (typeID)) { return readInfoChunk (info); } else if ("exif".equals (typeID)) { return readExifChunk (info); } else if ("adtl".equals (typeID)) { return readAdtlChunk (info); } else { info.setMessage (new ErrorMessage (MessageConstants.ERR_LIST_CHUNK_TYPE_UNK + typeID,_module.getNByte())); info.setWellFormed (false); return false; } }
info.setMessage (new ErrorMessage (MessageConstants.ERR_LIST_TYPE_UNK, MessageConstants.SUB_MESS_TYPE + typeID, _module.getNByte())); info.setWellFormed (false); return false;