001 /* 002 * Copyright 2005 The Apache Software Foundation 003 * 004 * Licensed under the Apache License, Version 2.0 (the "License"); 005 * you may not use this file except in compliance with the License. 006 * You may obtain a copy of the License at 007 * 008 * http://www.apache.org/licenses/LICENSE-2.0 009 * 010 * Unless required by applicable law or agreed to in writing, software 011 * distributed under the License is distributed on an "AS IS" BASIS, 012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 013 * See the License for the specific language governing permissions and 014 * limitations under the License. 015 */ 016 package org.apache.commons.net.ftp.parser; 017 018 import java.text.ParseException; 019 import java.util.Calendar; 020 021 /** 022 * This interface specifies the concept of parsing an FTP server's 023 * timestamp. 024 * @since 1.4 025 */ 026 public interface FTPTimestampParser { 027 028 /** 029 * the default default date format. 030 */ 031 public static final String DEFAULT_SDF = UnixFTPEntryParser.DEFAULT_DATE_FORMAT; 032 /** 033 * the default recent date format. 034 */ 035 public static final String DEFAULT_RECENT_SDF = UnixFTPEntryParser.DEFAULT_RECENT_DATE_FORMAT; 036 037 /** 038 * Parses the supplied datestamp parameter. This parameter typically would 039 * have been pulled from a longer FTP listing via the regular expression 040 * mechanism 041 * @param timestampStr - the timestamp portion of the FTP directory listing 042 * to be parsed 043 * @return a <code>java.util.Calendar</code> object initialized to the date 044 * parsed by the parser 045 * @throws ParseException if none of the parser mechanisms belonging to 046 * the implementor can parse the input. 047 */ 048 public Calendar parseTimestamp(String timestampStr) throws ParseException; 049 050 }