org.jclouds.io.ContentMetadata Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of jclouds-core Show documentation
Show all versions of jclouds-core Show documentation
Core components to access jclouds services
/*
* Licensed to the Apache Software Foundation (ASF) under one or more
* contributor license agreements. See the NOTICE file distributed with
* this work for additional information regarding copyright ownership.
* The ASF licenses this file to You under the Apache License, Version 2.0
* (the "License"); you may not use this file except in compliance with
* the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.jclouds.io;
import static com.google.common.net.HttpHeaders.CONTENT_DISPOSITION;
import static com.google.common.net.HttpHeaders.CONTENT_ENCODING;
import static com.google.common.net.HttpHeaders.CONTENT_LANGUAGE;
import static com.google.common.net.HttpHeaders.CONTENT_LENGTH;
import static com.google.common.net.HttpHeaders.CONTENT_MD5;
import static com.google.common.net.HttpHeaders.CONTENT_TYPE;
import static com.google.common.net.HttpHeaders.EXPIRES;
import java.util.Date;
import java.util.Set;
import org.jclouds.javax.annotation.Nullable;
import com.google.common.hash.HashCode;
import com.google.common.collect.ImmutableSet;
public interface ContentMetadata {
Set HTTP_HEADERS = ImmutableSet.of(CONTENT_LENGTH, CONTENT_MD5, CONTENT_TYPE,
CONTENT_DISPOSITION, CONTENT_ENCODING, CONTENT_LANGUAGE, EXPIRES);
// See http://stackoverflow.com/questions/10584647/simpledateformat-parse-is-one-hour-out-using-rfc-1123-gmt-in-summer
// for why not using "zzz"
String RFC1123_DATE_PATTERN = "EEE, dd MMM yyyyy HH:mm:ss Z";
/**
* Returns the total size of the payload, or the chunk that's available.
*
* Chunking is only used when {@link org.jclouds.http.GetOptions} is called with options like
* tail, range, or startAt.
*
* @return the length in bytes that can be be obtained from {@link #getInput()}
* @see com.google.common.net.HttpHeaders#CONTENT_LENGTH
* @see org.jclouds.http.options.GetOptions
*/
@Nullable
Long getContentLength();
/**
* Specifies presentational information for the object.
*
* @see
*/
@Nullable
String getContentDisposition();
/**
* Specifies what content encodings have been applied to the object and thus what decoding
* mechanisms must be applied in order to obtain the media-type referenced by the Content-Type
* header field.
*
* @see
*/
@Nullable
String getContentEncoding();
/**
*
* A standard MIME type describing the format of the contents. If none is provided, the default
* is binary/octet-stream.
*
* @see
*/
@Nullable
String getContentType();
/** @deprecated use {@link #getContentMD5AsHashCode()} instead. */
@Deprecated
@Nullable
byte[] getContentMD5();
@Nullable
HashCode getContentMD5AsHashCode();
/**
* Get Content Language of the payload
*
* Not all providers may support it
*/
@Nullable
String getContentLanguage();
/**
* Gives the date/time after which the response is considered stale.
*
* @throws IllegalStateException If the Expires header is non-null, and not a valid RFC 1123 date
*
* @see
*/
@Nullable
Date getExpires();
ContentMetadataBuilder toBuilder();
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy