You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by ve...@apache.org on 2009/07/17 13:37:14 UTC

svn commit: r795051 - /webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/blob/BlobDataSource.java

Author: veithen
Date: Fri Jul 17 11:37:14 2009
New Revision: 795051

URL: http://svn.apache.org/viewvc?rev=795051&view=rev
Log:
Added a class that was missing in r794858.

Added:
    webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/blob/BlobDataSource.java   (with props)

Added: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/blob/BlobDataSource.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/blob/BlobDataSource.java?rev=795051&view=auto
==============================================================================
--- webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/blob/BlobDataSource.java (added)
+++ webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/blob/BlobDataSource.java Fri Jul 17 11:37:14 2009
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.axiom.util.blob;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+
+import org.apache.axiom.attachments.SizeAwareDataSource;
+
+/**
+ * Data source backed by a {@link Blob}.
+ */
+public class BlobDataSource implements SizeAwareDataSource {
+    private final Blob blob;
+    private final String contentType;
+    
+    public BlobDataSource(Blob blob, String contentType) {
+        this.blob = blob;
+        this.contentType = contentType;
+    }
+
+    public InputStream getInputStream() throws IOException {
+        return blob.getInputStream();
+    }
+
+    public String getContentType() {
+        return contentType;
+    }
+
+    public String getName() {
+        return null;
+    }
+
+    public OutputStream getOutputStream() throws IOException {
+        throw new UnsupportedOperationException();
+    }
+
+    public long getSize() {
+        return blob.getLength();
+    }
+}

Propchange: webservices/commons/trunk/modules/axiom/modules/axiom-api/src/main/java/org/apache/axiom/util/blob/BlobDataSource.java
------------------------------------------------------------------------------
    svn:eol-style = native