axml/src/main/java/fr/xgouchet/axml/AXMLParser.java
private void updateBuffer() throws IOException {
        if (mEndOfStreamReached) {
            return;
        }

        if (mBufferStartPosition == 0) {
            return;
        }

        // first decal the end of the buffer
        int remainingLength = mBufferEndPosition - mBufferStartPosition;
        System.arraycopy(mBuffer, mBufferStartPosition, mBuffer, 0, remainingLength);

        // then read from input stream into our buffer
        int sizeToRead = BUFFER_SIZE - remainingLength;
        int sizeRead = mInputStream.read(mBuffer, remainingLength, sizeToRead);

        if (sizeRead == -1) {
            mEndOfStreamReached = true;
            sizeRead = 0;
        }

        mBufferEndPosition = remainingLength + sizeRead;
        mBufferStartPosition = 0;
    }
/**
     * Reads more data into the buffer
     */
Reads more data into the buffer
Reads more data into the buffer
private void updateBuffer() throws IOException {
        if (mEndOfStreamReached) {
            return;
        }
        if (mBufferStartPosition == 0) {
            return;
        }
        int remainingLength = mBufferEndPosition - mBufferStartPosition;
        System.arraycopy(mBuffer, mBufferStartPosition, mBuffer, 0, remainingLength);
        int sizeToRead = BUFFER_SIZE - remainingLength;
        int sizeRead = mInputStream.read(mBuffer, remainingLength, sizeToRead);
        if (sizeRead == -1) {
            mEndOfStreamReached = true;
            sizeRead = 0;
        }
        mBufferEndPosition = remainingLength + sizeRead;
        mBufferStartPosition = 0;
    }
private void updateBuffer ( ) throws IOException { if ( mEndOfStreamReached ) { return ; } if ( mBufferStartPosition == 0 ) { return ; } int remainingLength = mBufferEndPosition - mBufferStartPosition ; System . arraycopy ( mBuffer , mBufferStartPosition , mBuffer , 0 , remainingLength ) ; int sizeToRead = BUFFER_SIZE - remainingLength ; int sizeRead = mInputStream . read ( mBuffer , remainingLength , sizeToRead ) ; if ( sizeRead == - 1 ) { mEndOfStreamReached = true ; sizeRead = 0 ; } mBufferEndPosition = remainingLength + sizeRead ; mBufferStartPosition = 0 ; }
Reads more data into the buffer
Reads more data into the buffer
// first decal the end of the buffer // then read from input stream into our buffer