update credits
[LibreOffice.git] / javaunohelper / com / sun / star / lib / uno / adapter / OutputStreamToXOutputStreamAdapter.java
blob3f6f15325da826215226bcadd2a6d761cee7fd04
1 /*
2 * This file is part of the LibreOffice project.
4 * This Source Code Form is subject to the terms of the Mozilla Public
5 * License, v. 2.0. If a copy of the MPL was not distributed with this
6 * file, You can obtain one at http://mozilla.org/MPL/2.0/.
8 * This file incorporates work covered by the following license notice:
10 * Licensed to the Apache Software Foundation (ASF) under one or more
11 * contributor license agreements. See the NOTICE file distributed
12 * with this work for additional information regarding copyright
13 * ownership. The ASF licenses this file to you under the Apache
14 * License, Version 2.0 (the "License"); you may not use this file
15 * except in compliance with the License. You may obtain a copy of
16 * the License at http://www.apache.org/licenses/LICENSE-2.0 .
19 package com.sun.star.lib.uno.adapter;
21 import java.io.IOException;
23 import com.sun.star.io.XOutputStream;
25 import java.io.OutputStream;
27 /** The <code>OutputStreamToXOutputStreamAdapter</code> wraps
28 an UNO <code>XOutputStream</code> into a Java <code>OutputStream</code>
29 object in a Java. This allows users to access an <code>OutputStream</code>
30 as if it were an <code>XOutputStream</code>.
32 public final class OutputStreamToXOutputStreamAdapter implements XOutputStream {
34 /**
35 * Internal handle to the OutputStream
37 OutputStream iOut;
39 /**
40 * Constructor.
42 * @param out The <code>XOutputStream</code> to be
43 * accessed as an <code>OutputStream</code>.
45 public OutputStreamToXOutputStreamAdapter(OutputStream out) {
46 iOut = out;
49 public void closeOutput() throws
50 com.sun.star.io.IOException
52 try {
53 iOut.close();
54 } catch (IOException e) {
55 throw new com.sun.star.io.IOException(e);
59 public void flush() throws
60 com.sun.star.io.IOException
62 try {
63 iOut.flush();
64 } catch (IOException e) {
65 throw new com.sun.star.io.IOException(e);
69 public void writeBytes(byte[] b) throws
70 com.sun.star.io.IOException
73 try {
74 iOut.write(b);
75 } catch (IOException e) {
76 throw new com.sun.star.io.IOException(e);