01: /*******************************************************************************
02: * Licensed to the Apache Software Foundation (ASF) under one
03: * or more contributor license agreements. See the NOTICE file
04: * distributed with this work for additional information
05: * regarding copyright ownership. The ASF licenses this file
06: * to you under the Apache License, Version 2.0 (the
07: * "License"); you may not use this file except in compliance
08: * with the License. You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing,
13: * software distributed under the License is distributed on an
14: * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15: * KIND, either express or implied. See the License for the
16: * specific language governing permissions and limitations
17: * under the License.
18: *******************************************************************************/package org.ofbiz.content.openoffice;
19:
20: import java.io.ByteArrayOutputStream;
21:
22: import com.sun.star.io.XSeekable;
23: import com.sun.star.io.XOutputStream;
24: import com.sun.star.io.BufferSizeExceededException;
25: import com.sun.star.io.NotConnectedException;
26:
27: /**
28: * OpenOfficeByteArrayOutputStream Class
29: */
30:
31: public class OpenOfficeByteArrayOutputStream extends
32: ByteArrayOutputStream implements XOutputStream {
33:
34: public static final String module = OpenOfficeByteArrayOutputStream.class
35: .getName();
36:
37: public OpenOfficeByteArrayOutputStream() {
38: super ();
39: // TODO Auto-generated constructor stub
40: }
41:
42: public OpenOfficeByteArrayOutputStream(int arg0) {
43: super (arg0);
44: // TODO Auto-generated constructor stub
45: }
46:
47: public void writeBytes(byte[] buf)
48: throws BufferSizeExceededException, NotConnectedException,
49: com.sun.star.io.IOException {
50: try {
51: write(buf);
52: } catch (java.io.IOException e) {
53: throw (new com.sun.star.io.IOException(e.getMessage()));
54: }
55: }
56:
57: public void closeOutput() throws BufferSizeExceededException,
58: NotConnectedException, com.sun.star.io.IOException {
59: try {
60: super .flush();
61: close();
62: } catch (java.io.IOException e) {
63: throw (new com.sun.star.io.IOException(e.getMessage()));
64: }
65: }
66:
67: public void flush() {
68: try {
69: super .flush();
70: } catch (java.io.IOException e) {
71: }
72: }
73:
74: }
|