Examples of AmazonS3


Examples of org.eclipse.jgit.transport.AmazonS3

    return false;
  }

  @Override
  protected void run() throws Exception {
    final AmazonS3 s3 = new AmazonS3(properties());

    if ("get".equals(op)) {
      final URLConnection c = s3.get(bucket, key);
      int len = c.getContentLength();
      final InputStream in = c.getInputStream();
      try {
        final byte[] tmp = new byte[2048];
        while (len > 0) {
          final int n = in.read(tmp);
          if (n < 0)
            throw new EOFException(MessageFormat.format(CLIText.get().expectedNumberOfbytes, len));
          System.out.write(tmp, 0, n);
          len -= n;
        }
      } finally {
        in.close();
      }

    } else if ("ls".equals(op) || "list".equals(op)) {
      for (final String k : s3.list(bucket, key))
        System.out.println(k);

    } else if ("rm".equals(op) || "delete".equals(op)) {
      s3.delete(bucket, key);

    } else if ("put".equals(op)) {
      final OutputStream os = s3.beginPut(bucket, key, null, null);
      final byte[] tmp = new byte[2048];
      int n;
      while ((n = System.in.read(tmp)) > 0)
        os.write(tmp, 0, n);
      os.close();
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.