1*a1a3b679SAndreas Boehler<?php 2*a1a3b679SAndreas Boehler 3*a1a3b679SAndreas Boehlernamespace Sabre\DAV; 4*a1a3b679SAndreas Boehler 5*a1a3b679SAndreas Boehler/** 6*a1a3b679SAndreas Boehler * This interface represents a file in the directory tree 7*a1a3b679SAndreas Boehler * 8*a1a3b679SAndreas Boehler * A file is a bit of a broad definition. In general it implies that on 9*a1a3b679SAndreas Boehler * this specific node a PUT or GET method may be performed, to either update, 10*a1a3b679SAndreas Boehler * or retrieve the contents of the file. 11*a1a3b679SAndreas Boehler * 12*a1a3b679SAndreas Boehler * @copyright Copyright (C) 2007-2015 fruux GmbH (https://fruux.com/). 13*a1a3b679SAndreas Boehler * @author Evert Pot (http://evertpot.com/) 14*a1a3b679SAndreas Boehler * @license http://sabre.io/license/ Modified BSD License 15*a1a3b679SAndreas Boehler */ 16*a1a3b679SAndreas Boehlerinterface IFile extends INode { 17*a1a3b679SAndreas Boehler 18*a1a3b679SAndreas Boehler /** 19*a1a3b679SAndreas Boehler * Replaces the contents of the file. 20*a1a3b679SAndreas Boehler * 21*a1a3b679SAndreas Boehler * The data argument is a readable stream resource. 22*a1a3b679SAndreas Boehler * 23*a1a3b679SAndreas Boehler * After a succesful put operation, you may choose to return an ETag. The 24*a1a3b679SAndreas Boehler * etag must always be surrounded by double-quotes. These quotes must 25*a1a3b679SAndreas Boehler * appear in the actual string you're returning. 26*a1a3b679SAndreas Boehler * 27*a1a3b679SAndreas Boehler * Clients may use the ETag from a PUT request to later on make sure that 28*a1a3b679SAndreas Boehler * when they update the file, the contents haven't changed in the mean 29*a1a3b679SAndreas Boehler * time. 30*a1a3b679SAndreas Boehler * 31*a1a3b679SAndreas Boehler * If you don't plan to store the file byte-by-byte, and you return a 32*a1a3b679SAndreas Boehler * different object on a subsequent GET you are strongly recommended to not 33*a1a3b679SAndreas Boehler * return an ETag, and just return null. 34*a1a3b679SAndreas Boehler * 35*a1a3b679SAndreas Boehler * @param resource $data 36*a1a3b679SAndreas Boehler * @return string|null 37*a1a3b679SAndreas Boehler */ 38*a1a3b679SAndreas Boehler function put($data); 39*a1a3b679SAndreas Boehler 40*a1a3b679SAndreas Boehler /** 41*a1a3b679SAndreas Boehler * Returns the data 42*a1a3b679SAndreas Boehler * 43*a1a3b679SAndreas Boehler * This method may either return a string or a readable stream resource 44*a1a3b679SAndreas Boehler * 45*a1a3b679SAndreas Boehler * @return mixed 46*a1a3b679SAndreas Boehler */ 47*a1a3b679SAndreas Boehler function get(); 48*a1a3b679SAndreas Boehler 49*a1a3b679SAndreas Boehler /** 50*a1a3b679SAndreas Boehler * Returns the mime-type for a file 51*a1a3b679SAndreas Boehler * 52*a1a3b679SAndreas Boehler * If null is returned, we'll assume application/octet-stream 53*a1a3b679SAndreas Boehler * 54*a1a3b679SAndreas Boehler * @return string|null 55*a1a3b679SAndreas Boehler */ 56*a1a3b679SAndreas Boehler function getContentType(); 57*a1a3b679SAndreas Boehler 58*a1a3b679SAndreas Boehler /** 59*a1a3b679SAndreas Boehler * Returns the ETag for a file 60*a1a3b679SAndreas Boehler * 61*a1a3b679SAndreas Boehler * An ETag is a unique identifier representing the current version of the file. If the file changes, the ETag MUST change. 62*a1a3b679SAndreas Boehler * 63*a1a3b679SAndreas Boehler * Return null if the ETag can not effectively be determined. 64*a1a3b679SAndreas Boehler * 65*a1a3b679SAndreas Boehler * The ETag must be surrounded by double-quotes, so something like this 66*a1a3b679SAndreas Boehler * would make a valid ETag: 67*a1a3b679SAndreas Boehler * 68*a1a3b679SAndreas Boehler * return '"someetag"'; 69*a1a3b679SAndreas Boehler * 70*a1a3b679SAndreas Boehler * @return string|null 71*a1a3b679SAndreas Boehler */ 72*a1a3b679SAndreas Boehler function getETag(); 73*a1a3b679SAndreas Boehler 74*a1a3b679SAndreas Boehler /** 75*a1a3b679SAndreas Boehler * Returns the size of the node, in bytes 76*a1a3b679SAndreas Boehler * 77*a1a3b679SAndreas Boehler * @return int 78*a1a3b679SAndreas Boehler */ 79*a1a3b679SAndreas Boehler function getSize(); 80*a1a3b679SAndreas Boehler 81*a1a3b679SAndreas Boehler} 82