src/main/java/org/intellimate/izou/sdk/properties/EventPropertiesAssistant.java
public void unregisterEventID(String eventKey) {
        properties.remove(eventKey + "_DESCRIPTION");
        properties.remove(eventKey);

        FileOutputStream out = null;
        BufferedReader reader = null;
        BufferedWriter writer = null;

        try {
            out = new FileOutputStream(eventPropertiesPath, true);

            final File tempFile = new File(eventPropertiesPath + "temp.properties");
            final BufferedReader readerFinal = new BufferedReader(new FileReader(eventPropertiesPath));
            final BufferedWriter writerFinal = new BufferedWriter(new FileWriter(tempFile));

            doWithLock(out.getChannel(), lock -> {
                unlockedReloadFile();
                if (getEventID(eventKey) != null) {
                    return;
                }

                try {
                    String currentLine = readerFinal.readLine();
                    while(currentLine != null) {
                        String trimmedLine = currentLine.trim();
                        if(trimmedLine.equals(eventKey + "_DESCRIPTION") || trimmedLine.equals(eventKey)) continue;
                        writerFinal.write(currentLine + System.getProperty("line.separator"));
                        currentLine = readerFinal.readLine();
                    }
                } catch (IOException e) {
                    e.printStackTrace();
                }
            });

            reader = readerFinal;
            writer = writerFinal;
            tempFile.renameTo(new File(eventPropertiesPath));
        } catch (IOException e) {
            error("Unable find file", e);
        } finally {
            try {
                if (out != null) {
                    out.close();
                }
                if (writer != null) {
                    writer.close();
                }
                if (reader != null) {
                    reader.close();
                }
            } catch (IOException e) {
                error("Unable to close lock", e);
            }
        }
    }
public void unregisterEventID(String eventKey) {
        properties.remove(eventKey + "_DESCRIPTION");
        properties.remove(eventKey);

        FileOutputStream out = null;
        BufferedReader reader = null;
        BufferedWriter writer = null;

        try {
            out = new FileOutputStream(eventPropertiesPath, true);

            final File tempFile = new File(eventPropertiesPath + "temp.properties");
            final BufferedReader readerFinal = new BufferedReader(new FileReader(eventPropertiesPath));
            final BufferedWriter writerFinal = new BufferedWriter(new FileWriter(tempFile));

            doWithLock(out.getChannel(), lock -> {
                unlockedReloadFile();
                if (getEventID(eventKey) != null) {
                    return;
                }

                try {
                    String currentLine = readerFinal.readLine();
                    while(currentLine != null) {
                        String trimmedLine = currentLine.trim();
                        if(trimmedLine.equals(eventKey + "_DESCRIPTION") || trimmedLine.equals(eventKey)) continue;
                        writerFinal.write(currentLine + System.getProperty("line.separator"));
                        currentLine = readerFinal.readLine();
                    }
                } catch (IOException e) {
                    e.printStackTrace();
                }
            });

            reader = readerFinal;
            writer = writerFinal;
            tempFile.renameTo(new File(eventPropertiesPath));
        } catch (IOException e) {
            error("Unable find file", e);
        } finally {
            try {
                if (out != null) {
                    out.close();
                }
                if (writer != null) {
                    writer.close();
                }
                if (reader != null) {
                    reader.close();
                }
            } catch (IOException e) {
                error("Unable to close lock", e);
            }
        }
    }
public void unregisterEventID ( String eventKey ) { properties . remove ( eventKey + "_DESCRIPTION" ) ; properties . remove ( eventKey ) ; FileOutputStream out = null ; BufferedReader reader = null ; BufferedWriter writer = null ; try { out = new FileOutputStream ( eventPropertiesPath , true ) ; final File tempFile = new File ( eventPropertiesPath + "temp.properties" ) ; final BufferedReader readerFinal = new BufferedReader ( new FileReader ( eventPropertiesPath ) ) ; final BufferedWriter writerFinal = new BufferedWriter ( new FileWriter ( tempFile ) ) ; doWithLock ( out . getChannel ( ) , lock -> { unlockedReloadFile ( ) ; if ( getEventID ( eventKey ) != null ) { return ; } try { String currentLine = readerFinal . readLine ( ) ; while ( currentLine != null ) { String trimmedLine = currentLine . trim ( ) ; if ( trimmedLine . equals ( eventKey + "_DESCRIPTION" ) || trimmedLine . equals ( eventKey ) ) continue ; writerFinal . write ( currentLine + System . getProperty ( "line.separator" ) ) ; currentLine = readerFinal . readLine ( ) ; } } catch ( IOException e ) { e . printStackTrace ( ) ; } } ) ; reader = readerFinal ; writer = writerFinal ; tempFile . renameTo ( new File ( eventPropertiesPath ) ) ; } catch ( IOException e ) { error ( "Unable find file" , e ) ; } finally { try { if ( out != null ) { out . close ( ) ; } if ( writer != null ) { writer . close ( ) ; } if ( reader != null ) { reader . close ( ) ; } } catch ( IOException e ) { error ( "Unable to close lock" , e ) ; } } }
Unregisters or deletes an event from the local_events.properties file

@param eventKey the key under which the complete event ID is stored in the properties file
Unregisters or deletes an event from the local_events . properties file