[jboss-svn-commits] JBoss Common SVN: r3915 - jboss-stdio/trunk/src/main/java/org/jboss/stdio.
jboss-svn-commits at lists.jboss.org
jboss-svn-commits at lists.jboss.org
Thu Jan 7 16:36:21 EST 2010
Author: david.lloyd at jboss.com
Date: 2010-01-07 16:36:21 -0500 (Thu, 07 Jan 2010)
New Revision: 3915
Added:
jboss-stdio/trunk/src/main/java/org/jboss/stdio/LoggingOutputStream.java
jboss-stdio/trunk/src/main/java/org/jboss/stdio/StdioService.java
Modified:
jboss-stdio/trunk/src/main/java/org/jboss/stdio/WriterOutputStream.java
Log:
Add stdio service, logging output stream
Added: jboss-stdio/trunk/src/main/java/org/jboss/stdio/LoggingOutputStream.java
===================================================================
--- jboss-stdio/trunk/src/main/java/org/jboss/stdio/LoggingOutputStream.java (rev 0)
+++ jboss-stdio/trunk/src/main/java/org/jboss/stdio/LoggingOutputStream.java 2010-01-07 21:36:21 UTC (rev 3915)
@@ -0,0 +1,61 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.stdio;
+
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+/**
+ * A convenience {@code OutputStream} which writes to a {@code LoggingWriter}.
+ */
+public final class LoggingOutputStream extends WriterOutputStream {
+ /**
+ * Construct a new instance.
+ *
+ * @param category the log category to use
+ * @param levelName the name of the level at which to log messages
+ */
+ public LoggingOutputStream(final String category, final String levelName) {
+ this(category, Level.parse(levelName));
+ }
+
+ /**
+ * Construct a new instance.
+ *
+ * @param category the log category to use
+ * @param level the level at which to log messages
+ */
+ public LoggingOutputStream(final String category, final Level level) {
+ this(Logger.getLogger(category), level);
+ }
+
+ /**
+ * Construct a new instance.
+ *
+ * @param log the logger to use
+ * @param level the level at which to log messages
+ */
+ public LoggingOutputStream(final Logger log, final Level level) {
+ super(new LoggingWriter(log, level));
+ }
+}
Added: jboss-stdio/trunk/src/main/java/org/jboss/stdio/StdioService.java
===================================================================
--- jboss-stdio/trunk/src/main/java/org/jboss/stdio/StdioService.java (rev 0)
+++ jboss-stdio/trunk/src/main/java/org/jboss/stdio/StdioService.java 2010-01-07 21:36:21 UTC (rev 3915)
@@ -0,0 +1,43 @@
+/*
+ * JBoss, Home of Professional Open Source.
+ * Copyright 2010, Red Hat Middleware LLC, and individual contributors
+ * as indicated by the @author tags. See the copyright.txt file in the
+ * distribution for a full listing of individual contributors.
+ *
+ * This is free software; you can redistribute it and/or modify it
+ * under the terms of the GNU Lesser General Public License as
+ * published by the Free Software Foundation; either version 2.1 of
+ * the License, or (at your option) any later version.
+ *
+ * This software is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ * Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public
+ * License along with this software; if not, write to the Free
+ * Software Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
+ * 02110-1301 USA, or see the FSF site: http://www.fsf.org.
+ */
+
+package org.jboss.stdio;
+
+/**
+ * An object which exposes the {@code StdioContext} installation methods as a service.
+ */
+public final class StdioService {
+
+ /**
+ * Start the stdio service.
+ */
+ public void start() {
+ StdioContext.install();
+ }
+
+ /**
+ * Stop the stdio service.
+ */
+ public void stop() {
+ StdioContext.uninstall();
+ }
+}
Modified: jboss-stdio/trunk/src/main/java/org/jboss/stdio/WriterOutputStream.java
===================================================================
--- jboss-stdio/trunk/src/main/java/org/jboss/stdio/WriterOutputStream.java 2010-01-07 21:36:00 UTC (rev 3914)
+++ jboss-stdio/trunk/src/main/java/org/jboss/stdio/WriterOutputStream.java 2010-01-07 21:36:21 UTC (rev 3915)
@@ -34,7 +34,7 @@
/**
* An output stream which decodes into a writer.
*/
-public final class WriterOutputStream extends OutputStream {
+public class WriterOutputStream extends OutputStream {
private final Writer writer;
private final CharsetDecoder decoder;
More information about the jboss-svn-commits
mailing list