AnsweredAssumed Answered

Retrieve document content as byte array using UUID

Question asked by narayana.giri on May 27, 2014
Latest reply on May 27, 2014 by marsbard
Hi,

Alfresco document was uploaded using web services RepositoryServiceSoapBindingStub and ContentServiceSoapBindingStub(SDK Samples API) and have complete URL of the document with UUID and file name - http://localhost:8080/alfresco/d/d/workspace/SpacesStore/e93b3b3f-774f-43fd-8c32-f3d44c0e570e/sample file.txt

Need to get the content of the document in byte array to scan it before displaying in the browser.

Can I read the alfresco document URL as any other URL to get the byte array as below:

URL url= new URL("http://localhost:8080/alfresco/d/d/workspace/SpacesStore/e93b3b3f-774f-43fd-8c32-f3d44c0e570e/build file.txt");
        BufferedReader in = new BufferedReader(
        new InputStreamReader(url.openStream()));

        String inputLine;
        while ((inputLine = in.readLine()) != null)
            System.out.println(inputLine);
        in.close();

If not possible to read as a URL, what is the simple Java or Web Service API(with links, documents or samples) to get byte array?

Alfresco version 4.2 and we are not using CMIS.

Thanks in advance for all your help.

Outcomes