/** Peek into the parentInput's input stream and if the next item * is a NIFF String Table, then decode it and store it in the * root RIFFForNIFF object. * If the next item is not a NIFF String Table, do nothing * and leave the input stream unchanged. * * @param parentInput the parent RIFF object being used to read the input stream. * If parentInput.getParent() is not of type RIFFForNIFF, then this * moves the input past the String Table but does not store it. * @return true if the String Table was processed, false if this is * not a String Table. */ static public bool maybeDecode(Riff parentInput) { if (!parentInput.peekFOURCC().Equals(RIFF_ID)) { return(false); } Riff riffInput = new Riff(parentInput, RIFF_ID); if (!(parentInput.getParent() is RiffForNiff)) { // There is no place to store the data riffInput.skipRemaining(); return(true); } RiffForNiff riffForNiff = (RiffForNiff)parentInput.getParent(); // Read the entire string table into a byte array byte[] stringTable = new byte[riffInput.getBytesRemaining()]; for (int i = 0; i < stringTable.Length; ++i) { stringTable[i] = (byte)riffInput.readBYTE(); } riffForNiff.setStringTable(stringTable); // This skips possible pad byte riffInput.skipRemaining(); return(true); }
/** Creates new ChunkLengthTable from the parentInput's input stream. * The next object in the input stream must be of this type. * * @param parentInput the parent RIFF object being used to read the input stream */ static public ChunkLengthTable newInstance(Riff parentInput) { Riff riffInput = new Riff(parentInput, RIFF_ID); // Debug. Just skip remaining for now. riffInput.skipRemaining(); return(new ChunkLengthTable()); }
/** Creates new PartsList from the parentInput's input stream. * The next object in the input stream must be of this type. * * @param parentInput the parent RIFF object being used to read the input stream */ public static PartsList newInstance(Riff parentInput) { Riff riffInput = new Riff(parentInput, "LIST"); riffInput.requireFOURCC(RIFF_ID); // Debug. Just skip remaining for now. riffInput.skipRemaining(); return new PartsList(); }
/** Creates new ChunkLengthTable from the parentInput's input stream. * The next object in the input stream must be of this type. * * @param parentInput the parent RIFF object being used to read the input stream */ public static ChunkLengthTable newInstance(Riff parentInput) { Riff riffInput = new Riff(parentInput, RIFF_ID); // Debug. Just skip remaining for now. riffInput.skipRemaining(); return new ChunkLengthTable(); }
/** Creates new PartsList from the parentInput's input stream. * The next object in the input stream must be of this type. * * @param parentInput the parent RIFF object being used to read the input stream */ static public PartsList newInstance(Riff parentInput) { Riff riffInput = new Riff(parentInput, "LIST"); riffInput.requireFOURCC(RIFF_ID); // Debug. Just skip remaining for now. riffInput.skipRemaining(); return(new PartsList()); }
/** Skip past the next chunk in the input stream. */ public void skipChunk() { Riff child = new Riff(this); child.skipRemaining(); }
/** Peek into the parentInput's input stream and if the next item * is a NIFF String Table, then decode it and store it in the * root RIFFForNIFF object. * If the next item is not a NIFF String Table, do nothing * and leave the input stream unchanged. * * @param parentInput the parent RIFF object being used to read the input stream. * If parentInput.getParent() is not of type RIFFForNIFF, then this * moves the input past the String Table but does not store it. * @return true if the String Table was processed, false if this is * not a String Table. */ public static bool maybeDecode(Riff parentInput) { if (!parentInput.peekFOURCC().Equals(RIFF_ID)) return false; Riff riffInput = new Riff(parentInput, RIFF_ID); if (!(parentInput.getParent() is RiffForNiff)) { // There is no place to store the data riffInput.skipRemaining(); return true; } RiffForNiff riffForNiff = (RiffForNiff)parentInput.getParent(); // Read the entire string table into a byte array byte[] stringTable = new byte[riffInput.getBytesRemaining()]; for (int i = 0; i < stringTable.Length; ++i) stringTable[i] = (byte)riffInput.readBYTE(); riffForNiff.setStringTable(stringTable); // This skips possible pad byte riffInput.skipRemaining(); return true; }