1 /** 2 * Licensed to jclouds, Inc. (jclouds) under one or more 3 * contributor license agreements. See the NOTICE file 4 * distributed with this work for additional information 5 * regarding copyright ownership. jclouds licenses this file 6 * to you under the Apache License, Version 2.0 (the 7 * "License"); you may not use this file except in compliance 8 * with the License. You may obtain a copy of the License at 9 * 10 * http://www.apache.org/licenses/LICENSE-2.0 11 * 12 * Unless required by applicable law or agreed to in writing, 13 * software distributed under the License is distributed on an 14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY 15 * KIND, either express or implied. See the License for the 16 * specific language governing permissions and limitations 17 * under the License. 18 */ 19 package org.jclouds.io; 20 21 import static javax.ws.rs.core.HttpHeaders.CONTENT_LENGTH; 22 import static javax.ws.rs.core.HttpHeaders.CONTENT_TYPE; 23 24 import java.util.Set; 25 26 import org.jclouds.javax.annotation.Nullable; 27 28 import com.google.common.collect.ImmutableSet; 29 30 /** 31 * @author Adrian Cole 32 */ 33 public interface ContentMetadata { 34 public static final Set<String> HTTP_HEADERS = ImmutableSet.of(CONTENT_LENGTH, "Content-MD5", CONTENT_TYPE, 35 "Content-Disposition", "Content-Encoding", "Content-Language"); 36 37 /** 38 * Returns the total size of the payload, or the chunk that's available. 39 * <p/> 40 * Chunking is only used when {@link org.jclouds.http.GetOptions} is called with options like 41 * tail, range, or startAt. 42 * 43 * @return the length in bytes that can be be obtained from {@link #getInput()} 44 * @see javax.ws.rs.core.HttpHeaders#CONTENT_LENGTH 45 * @see org.jclouds.http.options.GetOptions 46 */ 47 @Nullable 48 Long getContentLength(); 49 50 /** 51 * Specifies presentational information for the object. 52 * 53 * @see <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec19.html?sec19.5.1."/> 54 */ 55 @Nullable 56 String getContentDisposition(); 57 58 /** 59 * Specifies what content encodings have been applied to the object and thus what decoding 60 * mechanisms must be applied in order to obtain the media-type referenced by the Content-Type 61 * header field. 62 * 63 * @see <a href= "http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html?sec14.11" /> 64 */ 65 @Nullable 66 String getContentEncoding(); 67 68 /** 69 * 70 * A standard MIME type describing the format of the contents. If none is provided, the default 71 * is binary/octet-stream. 72 * 73 * @see <a href="http://www.w3.org/Protocols/rfc2616/rfc2616-sec14.html#sec14.17"/> 74 */ 75 @Nullable 76 String getContentType(); 77 78 @Nullable 79 byte[] getContentMD5(); 80 81 /** 82 * Get Content Language of the payload 83 * <p/> 84 * Not all providers may support it 85 */ 86 @Nullable 87 String getContentLanguage(); 88 89 ContentMetadataBuilder toBuilder(); 90 91 }