source: release-kits/lirk3/resources/gs3-release-maker/apache-ant-1.6.5/src/main/org/apache/tools/ant/taskdefs/cvslib/RedirectingStreamHandler.java@ 14982

Last change on this file since 14982 was 14982, checked in by oranfry, 16 years ago

initial import of LiRK3

File size: 1.7 KB
Line 
1/*
2 * Copyright 2002,2004-2005 The Apache Software Foundation
3 *
4 * Licensed under the Apache License, Version 2.0 (the "License");
5 * you may not use this file except in compliance with the License.
6 * You may obtain a copy of the License at
7 *
8 * http://www.apache.org/licenses/LICENSE-2.0
9 *
10 * Unless required by applicable law or agreed to in writing, software
11 * distributed under the License is distributed on an "AS IS" BASIS,
12 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 * See the License for the specific language governing permissions and
14 * limitations under the License.
15 *
16 */
17package org.apache.tools.ant.taskdefs.cvslib;
18
19import java.io.ByteArrayOutputStream;
20import java.io.IOException;
21import org.apache.tools.ant.BuildException;
22import org.apache.tools.ant.taskdefs.PumpStreamHandler;
23
24/**
25 * A dummy stream handler that just passes stuff to the parser.
26 *
27 */
28class RedirectingStreamHandler
29 extends PumpStreamHandler {
30 RedirectingStreamHandler(final ChangeLogParser parser) {
31 super(new RedirectingOutputStream(parser),
32 new ByteArrayOutputStream());
33 }
34
35
36 String getErrors() {
37 try {
38 final ByteArrayOutputStream error
39 = (ByteArrayOutputStream) getErr();
40
41 return error.toString("ASCII");
42 } catch (final Exception e) {
43 return null;
44 }
45 }
46
47
48 public void stop() {
49 super.stop();
50 try {
51 getErr().close();
52 getOut().close();
53 } catch (final IOException e) {
54 // plain impossible
55 throw new BuildException(e);
56 }
57 }
58}
59
Note: See TracBrowser for help on using the repository browser.