Exemplo n.º 1
0
        /** 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);
        }
Exemplo n.º 2
0
        /** Creates new Score object from the input stream.
         * This uses the InputStream to initialize a RIFF object
         * which is used to read the input as a RIFF file.
         *
         * @param input     the InputStream containing the NIFF info
         */
        public static Score newInstance(Stream input)
        {
            Riff riffInput = new RiffForNiff(input, RIFF_ID);

              return new Score
             (RiffScoreSetup.newInstance(riffInput),
              RiffScoreData.newInstance(riffInput));
        }
Exemplo n.º 3
0
        /** Creates new Score object from the input stream.
         * This uses the InputStream to initialize a RIFF object
         * which is used to read the input as a RIFF file.
         *
         * @param input     the InputStream containing the NIFF info
         */
        static public Score newInstance(Stream input)
        {
            Riff riffInput = new RiffForNiff(input, RIFF_ID);

            return(new Score
                       (RiffScoreSetup.newInstance(riffInput),
                       RiffScoreData.newInstance(riffInput)));
        }
Exemplo n.º 4
0
        /** Creates a new Lyric 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 Lyric newInstance(Riff parentInput)
        {
            Riff riffInput = new Riff(parentInput, RIFF_ID);

            String text = RiffStringTable.decodeString
                              (RiffForNiff.getStringTable(parentInput), riffInput.readLONG());

            return(new Lyric
                       (text, riffInput.readBYTE(), RiffTags.newInstance(riffInput)));
        }