001/*
002 *  Copyright 2019 Anyware Services
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 */
016package org.ametys.cms.data;
017
018import java.io.InputStream;
019import java.time.ZonedDateTime;
020
021/**
022 * Class representing a file
023 */
024public interface File
025{
026    /**
027     * Returns the data stream.
028     * @return the data stream.
029     */
030    public InputStream getInputStream();
031    
032    /**
033     * Returns the last modification date.
034     * @return the last modification date.
035     */
036    public ZonedDateTime getLastModificationDate();
037    
038    /**
039     * Sets the last modification date of the file's data
040     * @param lastModificationDate the last modification date to set
041     */
042    public void setLastModificationDate(ZonedDateTime lastModificationDate);
043    
044    /**
045     * Returns the length of the data stream.
046     * @return the length of the data stream.
047     */
048    public long getLength();
049    
050    /**
051     * Returns the data mime-type.
052     * @return the data mime-type.
053     */
054    public String getMimeType();
055    
056    /**
057     * Sets the mime type of the file's data
058     * @param mimeType the mime type to set
059     */
060    public void setMimeType(String mimeType);
061    
062    /**
063     * Retrieves the file's name
064     * @return the file's name
065     */
066    public String getName();
067    
068    /**
069     * Returns the path of this resource in its hierarchy (which is a subset of the whole repository).
070     * @return the path of this resource in its hierarchy.
071     */
072    public String getPath();
073}