| /* |
| * Copyright 2009-2013 by The Regents of the University of California |
| * 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 from |
| * |
| * 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. |
| */ |
| package edu.uci.ics.hyracks.algebricks.examples.piglet.metadata; |
| |
| import java.io.File; |
| |
| import edu.uci.ics.hyracks.api.io.FileReference; |
| import edu.uci.ics.hyracks.dataflow.std.file.FileSplit; |
| |
| public class FileSplitUtils { |
| public static FileSplit[] parseFileSplits(String fileSplits) { |
| String[] splits = fileSplits.split(","); |
| FileSplit[] fSplits = new FileSplit[splits.length]; |
| for (int i = 0; i < splits.length; ++i) { |
| String s = splits[i].trim(); |
| int idx = s.indexOf(':'); |
| if (idx < 0) { |
| throw new IllegalArgumentException("File split " + s + " not well formed"); |
| } |
| fSplits[i] = new FileSplit(s.substring(0, idx), new FileReference(new File(s.substring(idx + 1)))); |
| } |
| return fSplits; |
| } |
| } |