Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Download/Retrive Files from Baasbox console #2

Open
avaiyakirtib opened this issue May 1, 2014 · 2 comments
Open

Download/Retrive Files from Baasbox console #2

avaiyakirtib opened this issue May 1, 2014 · 2 comments

Comments

@avaiyakirtib
Copy link

I am using Baasbox Files retrieving code as below as per code given on the official site for files retrieving-

// load file in memory
BaasFile file = ...;
file.stream(new BaasHandler() {
@OverRide
public void handle(BaasResult res) {
if ( res.isSuccess() ) {
byte[] data = res.value().getData();
Log.d("LOG","File received");
} else {
Log.e("LOG","Error while streaming",res.error());
}
}
});

I am getting trouble while accessing BaasFile file = ...; , I am using BaasFile file = new BaasFile();

after at the time of getting file.stream it throws me error says "ID can not be null" , then I am using file.stream("ef2162d9-919c-48f8-b76f-13e25ab25250",new BaasHandler() { ....}; but it still trows same error,

So can you please guide me How can I retreive files from Baasbox.

@eliantor
Copy link
Member

eliantor commented May 2, 2014

If you create a BaasFile object from scratch it has no id associated with it so you cannot retrieve it, from the server.

So, if your file object has no correspondence on the server, the best way to retrieve it all in one pass, is to use:

BaasFile.fetchStream("id",new BaasHandler(){...});

I admit the naming can be confusing, and the BaasFile api has still some issues.

@avaiyakirtib
Copy link
Author

By using your solution as below
BaasFile.fetchStream("ef2162d9-919c-48f8-b76f-13e25ab25250",new BaasHandler() {
@OverRide
public void handle(BaasResult res) {
if ( res.isSuccess() ) {
byte[] data = res.value().getData();
Log.d("LOG","File received");
} else {
Log.e("LOG","Error while streaming",res.error());
}
}
});

its throws me below error

    Error{error=com.baasbox.android.BaasException: java.lang.NegativeArraySizeException: -1}

So do you know the solution ?

funkyboy added a commit that referenced this issue Jul 10, 2015
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants