From 6f5b9305a8a3dbd26e3579c22e5bf6666d83eaaa Mon Sep 17 00:00:00 2001 From: Jeff Wilcox Date: Wed, 11 Jul 2012 13:49:11 -0700 Subject: [PATCH 1/2] Updating README to syntax highlight with Java on GitHub --- README.md | 98 ++++++++++++++++++++++++++++--------------------------- 1 file changed, 50 insertions(+), 48 deletions(-) diff --git a/README.md b/README.md index 07c59ee7dee66..b7a28d26212ff 100644 --- a/README.md +++ b/README.md @@ -62,61 +62,63 @@ deployment tools. The following is a quick example on how to set up a Azure blob using the API and uploading a file to it. For additional information on using the client libraries to access Azure services see the How To guides listed [here](http://www.windowsazure.com/en-us/develop/java/). - import com.microsoft.windowsazure.services.core.storage.*; - import com.microsoft.windowsazure.services.blob.client.*; +```java +import com.microsoft.windowsazure.services.core.storage.*; +import com.microsoft.windowsazure.services.blob.client.*; - public class BlobSample { +public class BlobSample { - public static final String storageConnectionString = - "DefaultEndpointsProtocol=http;" + - "AccountName=your_account_name;" + - "AccountKey= your_account_name"; + public static final String storageConnectionString = + "DefaultEndpointsProtocol=http;" + + "AccountName=your_account_name;" + + "AccountKey= your_account_name"; - public static void main(String[] args) + public static void main(String[] args) + { + try { - try - { - CloudStorageAccount account; - CloudBlobClient serviceClient; - CloudBlobContainer container; - CloudBlockBlob blob; - - account = CloudStorageAccount.parse(storageConnectionString); - serviceClient = account.createCloudBlobClient(); - // Container name must be lower case. - container = serviceClient.getContainerReference("blobsample"); - container.createIfNotExist(); - - // Set anonymous access on the container. - BlobContainerPermissions containerPermissions; - containerPermissions = new BlobContainerPermissions(); - - // Upload an image file. - blob = container.getBlockBlobReference("image1.jpg"); - File fileReference = new File ("c:\\myimages\\image1.jpg"); - blob.upload(new FileInputStream(fileReference), fileReference.length()); - } - catch (FileNotFoundException fileNotFoundException) - { - System.out.print("FileNotFoundException encountered: "); - System.out.println(fileNotFoundException.getMessage()); - System.exit(-1); - } - catch (StorageException storageException) - { - System.out.print("StorageException encountered: "); - System.out.println(storageException.getMessage()); - System.exit(-1); - } - catch (Exception e) - { - System.out.print("Exception encountered: "); - System.out.println(e.getMessage()); - System.exit(-1); - } + CloudStorageAccount account; + CloudBlobClient serviceClient; + CloudBlobContainer container; + CloudBlockBlob blob; + account = CloudStorageAccount.parse(storageConnectionString); + serviceClient = account.createCloudBlobClient(); + // Container name must be lower case. + container = serviceClient.getContainerReference("blobsample"); + container.createIfNotExist(); + + // Set anonymous access on the container. + BlobContainerPermissions containerPermissions; + containerPermissions = new BlobContainerPermissions(); + + // Upload an image file. + blob = container.getBlockBlobReference("image1.jpg"); + File fileReference = new File ("c:\\myimages\\image1.jpg"); + blob.upload(new FileInputStream(fileReference), fileReference.length()); + } + catch (FileNotFoundException fileNotFoundException) + { + System.out.print("FileNotFoundException encountered: "); + System.out.println(fileNotFoundException.getMessage()); + System.exit(-1); + } + catch (StorageException storageException) + { + System.out.print("StorageException encountered: "); + System.out.println(storageException.getMessage()); + System.exit(-1); + } + catch (Exception e) + { + System.out.print("Exception encountered: "); + System.out.println(e.getMessage()); + System.exit(-1); } + } +} +``` #Need Help? From 327b9255c722df52f5343488521f33912e4a4a07 Mon Sep 17 00:00:00 2001 From: "Jeff Wilcox @ Microsoft" Date: Wed, 11 Jul 2012 14:00:39 -0700 Subject: [PATCH 2/2] Highlighting the XML --- README.md | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index b7a28d26212ff..e4db4978d7ef7 100644 --- a/README.md +++ b/README.md @@ -38,11 +38,13 @@ To get the source code of the SDK via git just type: To get the binaries of this library as distributed by Microsoft, ready for use within your project you can also have them installed by the Java package manager Maven. - - com.microsoft.windowsazure - microsoft-windowsazure-api - 0.3.0 - +```xml + + com.microsoft.windowsazure + microsoft-windowsazure-api + 0.3.0 + +``` ##Minimum Requirements