Skip to content
This repository was archived by the owner on Dec 6, 2024. It is now read-only.

Commit 6400c8e

Browse files
SynapticloopSynapticloop
authored andcommitted
Merge branch 'pr/17'
2 parents a6b4e57 + caf5fc0 commit 6400c8e

1 file changed

Lines changed: 0 additions & 90 deletions

File tree

src/main/java/synapticloop/b2/B2ApiClient.java

Lines changed: 0 additions & 90 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@
2323
import java.util.Map;
2424

2525
import org.apache.commons.io.FileUtils;
26-
import org.apache.commons.io.IOUtils;
2726
import org.apache.http.HttpEntity;
2827
import org.apache.http.impl.client.CloseableHttpClient;
2928
import org.apache.http.impl.client.HttpClients;
@@ -584,53 +583,6 @@ public void downloadFileRangeByNameToFile(String bucketName, String fileName, Fi
584583
.getResponse().getContent(), file);
585584
}
586585

587-
/**
588-
* Download a named file from a named bucket to an byte[]. This is a
589-
* utility method which will automatically convert the response stream to a
590-
* byte[].
591-
*
592-
* Note: This will not return any of the headers that accompanied the download.
593-
* See downloadFileByName to retrieve the complete response including sha1,
594-
* content length, content type and all headers.
595-
*
596-
* @param bucketName The name of the bucket to download the file from
597-
* @param fileName the name of the file to download
598-
*
599-
* @return the array of bytes from the download
600-
*
601-
* @throws B2ApiException if there was an error with the call
602-
* @throws IOException if there was an error communicating with the API service
603-
*/
604-
public byte[] downloadFileByNameToBytes(String bucketName, String fileName) throws B2ApiException, IOException {
605-
return IOUtils.toByteArray(new B2DownloadFileByNameRequest(client, b2AuthorizeAccountResponse, bucketName, fileName).getResponse().getContent());
606-
}
607-
608-
/**
609-
* Download a range of bytes from a named file from a named bucket to an
610-
* byte[]. This is a utility method which will automatically convert the
611-
* response stream to a byte[].The range starts at 0 (zero) and goes up
612-
* to the end. Both are inclusive - e.g. a range of 0-5 will return 6
613-
* (six) bytes. If the range values are not correct, the complete file
614-
* will be downloaded
615-
*
616-
* Note: This will not return any of the headers that accompanied the download.
617-
* See downloadFileByName to retrieve the complete response including sha1,
618-
* content length, content type and all headers.
619-
*
620-
* @param bucketName The name of the bucket to download the file from
621-
* @param fileName the name of the file to download
622-
* @param rangeStart the start range (byte) offset for the content (inclusive)
623-
* @param rangeEnd the end range (byte) offset for the content (inclusive)
624-
*
625-
* @return the array of bytes from the download
626-
*
627-
* @throws B2ApiException if there was an error with the call
628-
* @throws IOException if there was an error communicating with the API service
629-
*/
630-
public byte[] downloadFileRangeByNameToBytes(String bucketName, String fileName, long rangeStart, long rangeEnd) throws B2ApiException, IOException {
631-
return IOUtils.toByteArray(new B2DownloadFileByNameRequest(client, b2AuthorizeAccountResponse, bucketName, fileName, rangeStart, rangeEnd).getResponse().getContent());
632-
}
633-
634586
/**
635587
* Download a named file from a named bucket and return the input stream from
636588
* the HTTP response. This is a utility method which will automatically return
@@ -750,48 +702,6 @@ public B2DownloadFileResponse downloadFileRangeById(String fileId, long rangeSta
750702
return new B2DownloadFileByIdRequest(client, b2AuthorizeAccountResponse, fileId, rangeStart, rangeEnd).getResponse();
751703
}
752704

753-
/**
754-
* Download a file to a byte[]
755-
*
756-
* Note: This will not return any of the headers that accompanied the download.
757-
* See downloadFileByName to retrieve the complete response including sha1,
758-
* content length, content type and all headers.
759-
*
760-
* @param fileId the id of the file to download
761-
*
762-
* @return the array of bytes for the file
763-
*
764-
* @throws B2ApiException if there was an error with the call
765-
* @throws IOException if there was an error communicating with the API service
766-
*/
767-
public byte[] downloadFileByIdToBytes(String fileId) throws B2ApiException, IOException {
768-
return IOUtils.toByteArray(new B2DownloadFileByIdRequest(client, b2AuthorizeAccountResponse, fileId).getResponse().getContent());
769-
}
770-
771-
/**
772-
* Download a partial range of file data to a byte[], the range starts at 0
773-
* (zero) and goes up to the end. Both are inclusive - e.g. a range of 0-5
774-
* will return 6 (six) bytes. If the range values are not correct, the
775-
* complete file will be downloaded
776-
*
777-
* Note: This will not return any of the headers that accompanied the download.
778-
* See downloadFileByName to retrieve the complete response including sha1,
779-
* content length, content type and all headers.
780-
*
781-
* @param fileId the id of the file to download
782-
* @param rangeStart the start range (byte) offset for the content (inclusive)
783-
* @param rangeEnd the end range (byte) offset for the content (inclusive)
784-
*
785-
* @return the array of bytes for the file
786-
*
787-
* @throws B2ApiException if there was an error with the call
788-
* @throws IOException if there was an error communicating with the API service
789-
*/
790-
public byte[] downloadFileRangeByIdToBytes(String fileId, long rangeStart, long rangeEnd) throws B2ApiException, IOException {
791-
return IOUtils.toByteArray(new B2DownloadFileByIdRequest(client, b2AuthorizeAccountResponse, fileId, rangeStart, rangeEnd)
792-
.getResponse().getContent());
793-
}
794-
795705
/**
796706
* Download the file to a local file
797707
*

0 commit comments

Comments
 (0)