Package davaguine.jmac.tools

Examples of davaguine.jmac.tools.ByteArrayReader


        //move the remaining data to the front
        System.arraycopy(al = m_pBitArray, j = (int) nBitArrayIndex, al, 0, (int) (al.length - nBitArrayIndex));

        //read the new data
        ByteArrayReader reader = m_pReader;
        reader.reset(m_pIO, j << 2);
        long l1;
        int i = (int) ((l1 = m_nElements) - nBitArrayIndex);
        if ((long) i < l1)
            do {
                al[i] = reader.readUnsignedInt();
                i++;
            } while ((long) i < l1);

        //adjust the m_Bit pointer
        m_nCurrentBitIndex &= 31;
View Full Code Here


        //seek if necessary
        if (nFileLocation != -1)
            m_pIO.seek(nFileLocation);

        //read the new data into the bit array
        ByteArrayReader reader = m_pReader;
        reader.reset(m_pIO, (int) m_nBytes);
        long al[] = m_pBitArray;
        long l = m_nElements;
        for (int i = 0; i < l; i++)
            al[i] = reader.readUnsignedInt();
    }
View Full Code Here

        m_nVersion = nVersion;
        m_nCurrentBitIndex = 0;

        //create the bitarray
        m_pBitArray = new long[(int) m_nElements];
        m_pReader = new ByteArrayReader((int) m_nBytes);
    }
View Full Code Here

    public final static ID3Tag read(final File file) throws IOException {
        file.seek(file.length() - ID3_TAG_BYTES);
        try {
            final ID3Tag tag = new ID3Tag();
            final ByteArrayReader reader = new ByteArrayReader(file, ID3_TAG_BYTES);
            tag.Header = reader.readString(3, "US-ASCII");
            tag.Title = reader.readString(30, "US-ASCII");
            tag.Artist = reader.readString(30, "US-ASCII");
            tag.Album = reader.readString(30, "US-ASCII");
            tag.Year = reader.readString(4, "US-ASCII");
            tag.Comment = reader.readString(29, "US-ASCII");
            tag.Track = reader.readUnsignedByte();
            tag.Genre = reader.readUnsignedByte();
            return tag.Header.equals("TAG") ? tag : null;
        } catch (EOFException e) {
            return null;
        }
    }
View Full Code Here

    public final static int APE_DESCRIPTOR_BYTES = 52;

    public static APEDescriptor read(final File file) throws IOException {
        try {
            APEDescriptor header = new APEDescriptor();
            final ByteArrayReader reader = new ByteArrayReader(file, APE_DESCRIPTOR_BYTES - 16);
            header.cID = reader.readString(4, "US-ASCII");
            header.nVersion = reader.readUnsignedShort();
            reader.skipBytes(2);
            header.nDescriptorBytes = reader.readUnsignedInt();
            header.nHeaderBytes = reader.readUnsignedInt();
            header.nSeekTableBytes = reader.readUnsignedInt();
            header.nHeaderDataBytes = reader.readUnsignedInt();
            header.nAPEFrameDataBytes = reader.readUnsignedInt();
            header.nAPEFrameDataBytesHigh = reader.readUnsignedInt();
            header.nTerminatingDataBytes = reader.readUnsignedInt();
            file.readFully(header.cFileMD5);
            return header;
        } catch (EOFException e) {
            throw new JMACException("Unsupported Format");
        }
View Full Code Here

        pWAVHeader.nDataBytes = nAudioBytes;
    }

    public final static WaveHeader read(final File file) throws IOException {
        try {
            final ByteArrayReader reader = new ByteArrayReader(file, WAVE_HEADER_BYTES);
            return read(reader);
        } catch (EOFException e) {
            return null;
        }
    }
View Full Code Here

            return null;
        }
    }

    public final static WaveHeader read(final byte[] data) {
        final ByteArrayReader reader = new ByteArrayReader(data);
        return read(reader);
    }
View Full Code Here

    public static APETagFooter read(final File file) throws IOException {
        file.seek(file.length() - APE_TAG_FOOTER_BYTES);
        APETagFooter tag = new APETagFooter();
        try {
            final ByteArrayReader reader = new ByteArrayReader(file, APE_TAG_FOOTER_BYTES);
            tag.m_cID = reader.readString(8, "US-ASCII");
            tag.m_nVersion = reader.readInt();
            tag.m_nSize = reader.readInt();
            tag.m_nFields = reader.readInt();
            tag.m_nFlags = reader.readInt();
            return tag;
        } catch (EOFException e) {
            throw new JMACException("Unsupported Format");
        }
    }
View Full Code Here

        if (offset < 0)
            return null;
        file.seek(offset);
        try {
            final ID3Tag tag = new ID3Tag();
            final ByteArrayReader reader = new ByteArrayReader(file, ID3_TAG_BYTES);
            tag.Header = reader.readString(3, defaultEncoding);
            tag.Title = reader.readString(30, defaultEncoding);
            tag.Artist = reader.readString(30, defaultEncoding);
            tag.Album = reader.readString(30, defaultEncoding);
            tag.Year = reader.readString(4, defaultEncoding);
            tag.Comment = reader.readString(29, defaultEncoding);
            tag.Track = reader.readUnsignedByte();
            tag.Genre = reader.readUnsignedByte();
            return tag.Header.equals("TAG") ? tag : null;
        } catch (EOFException e) {
            return null;
        }
    }
View Full Code Here

    public final static int APE_HEADER_OLD_BYTES = 32;

    public static APEHeaderOld read(final File file) throws IOException {
        try {
            APEHeaderOld header = new APEHeaderOld();
            final ByteArrayReader reader = new ByteArrayReader(file, APE_HEADER_OLD_BYTES);
            header.cID = reader.readString(4, "US-ASCII");
            header.nVersion = reader.readUnsignedShort();
            header.nCompressionLevel = reader.readUnsignedShort();
            header.nFormatFlags = reader.readUnsignedShort();
            header.nChannels = reader.readUnsignedShort();
            header.nSampleRate = reader.readUnsignedInt();
            header.nHeaderBytes = reader.readUnsignedInt();
            header.nTerminatingBytes = reader.readUnsignedInt();
            header.nTotalFrames = reader.readUnsignedInt();
            header.nFinalFrameBlocks = reader.readUnsignedInt();
            return header;
        } catch (EOFException e) {
            throw new JMACException("Unsupported Format");
        }
    }
View Full Code Here

TOP

Related Classes of davaguine.jmac.tools.ByteArrayReader

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.