View Javadoc

1   /*
2    * Copyright 2005 The Apache Software Foundation
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *     http://www.apache.org/licenses/LICENSE-2.0
9    *
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 org.apache.commons.net.ftp.parser;
17  
18  import java.text.ParseException;
19  import java.util.Calendar;
20  
21  /**
22   * This interface specifies the concept of parsing an FTP server's 
23   * timestamp.
24   * @since 1.4
25   */
26  public interface FTPTimestampParser {
27      
28  	/**
29  	 * the default default date format. 
30  	 */
31  	public static final String DEFAULT_SDF = UnixFTPEntryParser.DEFAULT_DATE_FORMAT;
32  	/**
33  	 * the default recent date format. 
34  	 */
35  	public static final String DEFAULT_RECENT_SDF = UnixFTPEntryParser.DEFAULT_RECENT_DATE_FORMAT;
36  	
37  	/**
38  	 * Parses the supplied datestamp parameter.  This parameter typically would 
39  	 * have been pulled from a longer FTP listing via the regular expression 
40  	 * mechanism
41  	 * @param timestampStr - the timestamp portion of the FTP directory listing
42  	 * to be parsed
43  	 * @return a <code>java.util.Calendar</code> object initialized to the date
44  	 * parsed by the parser
45  	 * @throws ParseException if none of the parser mechanisms belonging to 
46  	 * the implementor can parse the input.
47  	 */
48  	public Calendar parseTimestamp(String timestampStr) throws ParseException;
49  	
50  }