Repository: incubator-taverna-language Updated Branches: refs/heads/master 4b59c1401 -> 70720f821
Replaced StreamHelper with version from odfdom incubator: https://svn.apache.org/repos/asf/incubator/odf/trunk/odfdom/src/main/java/org/odftoolkit/odfdom/pkg/StreamHelper.java .. except transformStream() we'll still call stream() This adds the (c) Oracle copyright-header to StreamHelper.java from upstream. Project: http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/commit/70720f82 Tree: http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/tree/70720f82 Diff: http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/diff/70720f82 Branch: refs/heads/master Commit: 70720f82154dbf4f2e703aeb1425d1839480d2ac Parents: 4b59c14 Author: Stian Soiland-Reyes <[email protected]> Authored: Thu Jul 16 00:04:32 2015 +0100 Committer: Stian Soiland-Reyes <[email protected]> Committed: Thu Jul 16 00:04:32 2015 +0100 ---------------------------------------------------------------------- .../impl/odfdom/pkg/StreamHelper.java | 61 ++++++++++---------- 1 file changed, 31 insertions(+), 30 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-taverna-language/blob/70720f82/taverna-scufl2-ucfpackage/src/main/java/org/apache/taverna/scufl2/ucfpackage/impl/odfdom/pkg/StreamHelper.java ---------------------------------------------------------------------- diff --git a/taverna-scufl2-ucfpackage/src/main/java/org/apache/taverna/scufl2/ucfpackage/impl/odfdom/pkg/StreamHelper.java b/taverna-scufl2-ucfpackage/src/main/java/org/apache/taverna/scufl2/ucfpackage/impl/odfdom/pkg/StreamHelper.java index 936486a..8608715 100644 --- a/taverna-scufl2-ucfpackage/src/main/java/org/apache/taverna/scufl2/ucfpackage/impl/odfdom/pkg/StreamHelper.java +++ b/taverna-scufl2-ucfpackage/src/main/java/org/apache/taverna/scufl2/ucfpackage/impl/odfdom/pkg/StreamHelper.java @@ -1,29 +1,30 @@ -package org.apache.taverna.scufl2.ucfpackage.impl.odfdom.pkg; -/* +/************************************************************************ + * + * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER + * + * Copyright 2008, 2010 Oracle and/or its affiliates. All rights reserved. * - * 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 + * Use is subject to license terms. * - * http://www.apache.org/licenses/LICENSE-2.0 + * Licensed 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. You can also + * obtain a copy of the License at http://odftoolkit.org/docs/license.txt * - * 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. + * 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. + * + ************************************************************************/ /* This file is derived from ODFDOM 0.8.6, and * has been modified for Apache Taverna. * (c) 2010-2014 University of Manchester * (c) 2015 The Apache Software Foundation */ +package org.apache.taverna.scufl2.ucfpackage.impl.odfdom.pkg; import java.io.IOException; import java.io.InputStream; @@ -34,6 +35,7 @@ import java.io.OutputStream; * No streams will be closed - calling classes must do this. */ class StreamHelper { + // 4096 is thought to be the minimum page size for most systems; // change this for optimization public static final int PAGE_SIZE = 4096; @@ -68,18 +70,17 @@ class StreamHelper { * does not close any stream; calling methods must take care of that. * @throws IOException when io error happens */ - void stream() throws IOException { - if (mStreamed) - throw new IOException(); - byte[] buf = new byte[PAGE_SIZE]; - int r = 0; - // let npe happen if one of the streams is null - while ((r = in.read(buf, 0, PAGE_SIZE)) > -1) { - out.write(buf, 0, r); - } - // free the references - in = null; - out = null; - mStreamed = true; + void stream() throws IOException { + if (mStreamed) throw new IOException(); + byte[] buf = new byte[PAGE_SIZE]; + int r = 0; + // let npe happen if one of the streams is null + while ((r = in.read(buf, 0, PAGE_SIZE)) > -1) { + out.write(buf, 0, r); + } + // free the references + in = null; + out = null; + mStreamed = true; } }
