Here you can find the source of renameExcludedFiles(File existingBinaryFolder, Collection
Parameter | Description |
---|---|
existingBinaryFolder | a parameter |
excludedBids | a parameter |
public static int renameExcludedFiles(File existingBinaryFolder, Collection<Integer> excludedBids)
//package com.java2s; /*/*from ww w . j a va2s .c om*/ * Copyright 2010 MINT Working Group * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ import java.io.File; import java.util.*; public class Main { public static final String BINARY_FILE_EXTENSION = "dat"; public static final String EXCLUDED_BINARY_FILE_EXTENSION = "exclude"; /** * Will attempt to rename each file that is bid.dat where possible bids are * passed in the excludedBids collection to bid.exclude. Will return -1 if * successful and will return the bid of the rename that failed if something * went wrong. * * @param existingBinaryFolder * @param excludedBids * @return -1 if successful, or the bid of the rename that failed if something * went wrong. */ public static int renameExcludedFiles(File existingBinaryFolder, Collection<Integer> excludedBids) { for (int bid : excludedBids) { File oldFile = new File(existingBinaryFolder, bid + "." + BINARY_FILE_EXTENSION); File newFile = new File(existingBinaryFolder, bid + "." + EXCLUDED_BINARY_FILE_EXTENSION); if (!oldFile.renameTo(newFile)) return bid; } return -1; } }