01: /*
02: * This file is part of DrFTPD, Distributed FTP Daemon.
03: *
04: * DrFTPD is free software; you can redistribute it and/or modify
05: * it under the terms of the GNU General Public License as published by
06: * the Free Software Foundation; either version 2 of the License, or
07: * (at your option) any later version.
08: *
09: * DrFTPD is distributed in the hope that it will be useful,
10: * but WITHOUT ANY WARRANTY; without even the implied warranty of
11: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
12: * GNU General Public License for more details.
13: *
14: * You should have received a copy of the GNU General Public License
15: * along with DrFTPD; if not, write to the Free Software
16: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
17: */
18: package org.drftpd;
19:
20: import java.io.BufferedReader;
21: import java.io.IOException;
22: import java.io.Serializable;
23:
24: import org.drftpd.remotefile.CaseInsensitiveHashtable;
25:
26: /**
27: * @author mog
28: * @version $Id: LightSFVFile.java 1562 2007-01-05 12:37:07Z zubov $
29: */
30: public class LightSFVFile extends AbstractSFVFile {
31: /**
32: * Constructor for SFVFile.
33: */
34: public LightSFVFile(BufferedReader in) throws IOException {
35: String line;
36: _entries = new CaseInsensitiveHashtable();
37: try {
38: while ((line = in.readLine()) != null) {
39: if (line.length() == 0) {
40: continue;
41: }
42:
43: if (line.charAt(0) == ';') {
44: continue;
45: }
46:
47: int separator = line.indexOf(" ");
48:
49: if (separator == -1) {
50: continue;
51: }
52:
53: String fileName = line.substring(0, separator);
54: String checkSumString = line.substring(separator + 1);
55: Long checkSum;
56:
57: try {
58: checkSum = Long.valueOf(checkSumString, 16);
59: } catch (NumberFormatException e) {
60: continue;
61: }
62: _entries.put(fileName, checkSum);
63: }
64: } finally {
65: in.close();
66: }
67: System.out.println("Parsed " + getClass().getName() + "[size="
68: + size() + "]");
69: }
70: }
|