/** * Finish the request by closing the HTTP connection and the InputStream. * You can call this method even before the entire file has been uploaded. Use this behavior to * enable pausing uploads. * * @throws ProtocolException Thrown if the server sends an unexpected status * code * @throws IOException Thrown if an exception occurs while cleaning up. */ public void finish() throws ProtocolException, IOException { finishConnection(); // Close the TusInputStream after checking the response and closing the connection to ensure // that we will not need to read from it again in the future. input.close(); }