1 /* 2 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved. 3 * 4 * Licensed under the Apache License, Version 2.0 (the "License"). 5 * You may not use this file except in compliance with the License. 6 * A copy of the License is located at 7 * 8 * http://aws.amazon.com/apache2.0 9 * 10 * or in the "license" file accompanying this file. This file is distributed 11 * on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either 12 * express or implied. See the License for the specific language governing 13 * permissions and limitations under the License. 14 */ 15 16 package software.amazon.awssdk.transfer.s3.model; 17 18 import java.io.InputStream; 19 import java.io.OutputStream; 20 import java.nio.file.Path; 21 import software.amazon.awssdk.annotations.SdkPublicApi; 22 import software.amazon.awssdk.core.SdkBytes; 23 24 /** 25 * Contains the information of a pausible upload or download; such 26 * information can be used to resume the upload or download later on 27 * 28 * @see FileDownload#pause() 29 */ 30 @SdkPublicApi 31 public interface ResumableTransfer { 32 33 /** 34 * Persists this download object to a file in Base64-encoded JSON format. 35 * 36 * @param path The path to the file to which you want to write the serialized download object. 37 */ serializeToFile(Path path)38 default void serializeToFile(Path path) { 39 throw new UnsupportedOperationException(); 40 } 41 42 /** 43 * Writes the serialized JSON data representing this object to an output stream. 44 * Note that the {@link OutputStream} is not closed or flushed after writing. 45 * 46 * @param outputStream The output stream to write the serialized object to. 47 */ serializeToOutputStream(OutputStream outputStream)48 default void serializeToOutputStream(OutputStream outputStream) { 49 throw new UnsupportedOperationException(); 50 } 51 52 /** 53 * Returns the serialized JSON data representing this object as a string. 54 */ serializeToString()55 default String serializeToString() { 56 throw new UnsupportedOperationException(); 57 } 58 59 /** 60 * Returns the serialized JSON data representing this object as an {@link SdkBytes} object. 61 * 62 * @return the serialized JSON as {@link SdkBytes} 63 */ serializeToBytes()64 default SdkBytes serializeToBytes() { 65 throw new UnsupportedOperationException(); 66 } 67 68 /** 69 * Returns the serialized JSON data representing this object as an {@link InputStream}. 70 * 71 * @return the serialized JSON input stream 72 */ serializeToInputStream()73 default InputStream serializeToInputStream() { 74 throw new UnsupportedOperationException(); 75 } 76 77 } 78