01: /*
02: * Copyright 2005 Hippo Webworks.
03: *
04: * Licensed under the Apache License, Version 2.0 (the "License");
05: * you may not use this file except in compliance with the License.
06: * You may obtain a copy of the License at
07: *
08: * http://www.apache.org/licenses/LICENSE-2.0
09: *
10: * Unless required by applicable law or agreed to in writing, software
11: * distributed under the License is distributed on an "AS IS" BASIS,
12: * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13: * See the License for the specific language governing permissions and
14: * limitations under the License.
15: */
16: package nl.hippo.cms.fileimport;
17:
18: import java.io.BufferedReader;
19: import java.io.FileReader;
20: import java.io.IOException;
21: import java.util.HashMap;
22: import java.util.Map;
23:
24: class ImageListReader {
25: ImageListReader() {
26: super ();
27: }
28:
29: Map read(String contentPath) throws IOException {
30: Map result = new HashMap();
31: BufferedReader reader = new BufferedReader(new FileReader(
32: contentPath));
33: String line = reader.readLine();
34: while (line != null) {
35: String[] strings = line.split("::");
36: String path = strings[0];
37: String targetName = strings[1];
38: Image i = new Image(path, targetName);
39: result.put(path, i);
40:
41: line = reader.readLine();
42: }
43:
44: return result;
45: }
46: }
|