@Override
        protected void onProfileStartingLine(String profileName, String line) {
            existingProfileProperties.put(profileName, new HashSet<String>());

            // Copy the line after flush the buffer
            flush();

            if (deletedProfiles.contains(profileName))
                return;

            // If the profile name is changed
            if (newProfiles.get(profileName) != null) {
                String newProfileName = newProfiles.get(profileName).getProfileName();
                if ( !newProfileName.equals(profileName) ) {
                    line = "[" + newProfileName + "]";
                }
            }

            writeLine(line);
        }
Read the existing content of a credentials file, and then make
in-place modification according to the new profiles specified in this
class.
aws-java-sdk-core/src/main/java/com/amazonaws/auth/profile/ProfilesConfigFileWriter.java