• Empleos
  • Sobre nosotros
  • profesionales
    • Inicio
    • Empleos
    • Cursos y retos
    • Preguntas
    • Profesores
  • empresas
    • Inicio
    • Publicar vacante
    • Nuestro proceso
    • Precios
    • Pruebas Online
    • Nómina
    • Blog
    • Comercial
    • Calculadora de salario

0

169
Vistas
How to download a video file from amazon s3 to specific folder using Java

I am trying to download a video file from S3 account.It is niether giving me an error nor I am able to see the file downloaded means I am not getting the location of file.I have a doubt that is my file is getting downloaded.Pls give a solution on this.Thanks in advance here is my code:

System.out.println("Downloading an object");
        S3Object object = s3.getObject(new GetObjectRequest(bucketName, key));
        System.out.println("Content-Type: "  + object.getObjectMetadata().getContentType());
         object.getObjectContent();
    }catch(AmazonServiceException ex){
        System.out.println("Caught an AmazonServiceException, which means your request made it "
                + "to Amazon S3, but was rejected with an error response for some reason.");
        System.out.println("Error Message:    " + ex.getMessage());
        System.out.println("HTTP Status Code: " + ex.getStatusCode());
        System.out.println("AWS Error Code:   " + ex.getErrorCode());
        System.out.println("Error Type:       " + ex.getErrorType());
        System.out.println("Request ID:       " + ex.getRequestId());
    }catch (AmazonClientException ace) {
        System.out.println("Caught an AmazonClientException, which means the client encountered "
                + "a serious internal problem while trying to communicate with S3, "
                + "such as not being able to access the network.");
        System.out.println("Error Message: " + ace.getMessage());
    }
about 3 years ago · Santiago Trujillo
1 Respuestas
Responde la pregunta

0

object.getObjectContent() gives the stream of data from the HTTP connection, is there any exception reading from the stream? you can also try s3.getObjectAsString()

about 3 years ago · Santiago Trujillo Denunciar
Responde la pregunta
Encuentra empleos remotos

¡Descubre la nueva forma de encontrar empleo!

Top de empleos
Top categorías de empleo
Empresas
Publicar vacante Precios Nuestro proceso Comercial
Legal
Términos y condiciones Política de privacidad
© 2025 PeakU Inc. All Rights Reserved.

Andres GPT

Recomiéndame algunas ofertas
Necesito ayuda