Main.java Source code

Java tutorial

Introduction

Here is the source code for Main.java

Source

//package com.java2s;
//License from project: Apache License 

import android.support.annotation.NonNull;

import java.io.File;

import java.io.IOException;

public class Main {
    public static final void deleteOrThrow(@NonNull File file) throws IOException {
        if (!file.exists()) {
            return;
        }

        boolean result = file.delete();
        if (!result) {
            throw new IOException("Failed to delete a file, file=" + file.getAbsolutePath());
        }
    }
}