Go to the source code of this file.
Functions | |
static | this () |
Variables | |
module mango io | Stdout |
import mango io | Writer |
import mango io | Console |
import mango io mango io | BufferCodec |
import mango io mango io mango io | FlushWriter |
static FlushWriter | Stderr |
This software is provided 'as-is', without any express or implied warranty. In no event will the authors be held liable for damages of any kind arising from the use of this software.
Permission is hereby granted to anyone to use this software for any purpose, including commercial applications, and to alter it and/or redistribute it freely, subject to the following restrictions:
1. The origin of this software must not be misrepresented; you must not claim that you wrote the original software. If you use this software in a product, an acknowledgment within documentation of said product would be appreciated but is not required.
2. Altered source versions must be plainly marked as such, and must not be misrepresented as being the original software.
3. This notice may not be removed or altered from any distribution of the source.
4. Derivative works are permitted, but they must carry this notice in full and credit the original source.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Definition in file Stdout.d.
|
Definition at line 144 of file Stdout.d. References FlushWriter, Stderr, Stdout, and UnicodeImporter(). |
|
The ubiquitous console IO support. These are standard Conduit instances, with Reader/Writer wrappers applied appropriately. Note that the outputs use FlushBuffer to automatically flush data as it is added to the buffer. The basic usage of this module is illustrated below:
char[] msg = "on the console"; Stdout ("print ") (1) (' ') ("message ") (msg) (CR); An alternative is to use put() notation like so:
char[] msg = "on the console"; Stdout.put ("print ") .put (1) .put (' ') .put ("message ") .put (msg) .put (CR); Another alternative is to use the C++ iostream operators like so:
char[] msg = "on the console"; Stdout << "print " << 1 << ' ' << "message " << msg << CR; Since console idioms are based upon Conduit, you can use them as direct targets for stream-oriented operations. For example, the code:
FileConduit from = new FileConduit ("myfile.txt"); Stdout.conduit.copy (from); copies a text file directly to the console. Likewise, you can copy console input directly to a FileConduit or a SocketConduit. Input via Stdin is similar in nature, but uses the Token classes to isolate and parse each token on an input line:
Stdout automatically flushes the output when it sees a CR, so you may need to flush the output manually where a CR is not desired. This is the case in the above example, so we use the empty () to request a flush (which is actually an alias for the flush method). Note that Stdin awaits a carriage-return before parsing the input into the targets. Note also that the Stdout and Stderr are not written to be thread-safe. As such you may find that output from two threads intersect across each other. If this is a problem you should wrap a synchronized block around the offending entity, like so:
Alternatively, please consider using the mango.log (Logger) package to provide detailed runtime diagnostics from your application. The functionality exposed there is likely sufficient for most application needs. Redirecting the standard IO handles (via a shell) operates as one would expect. |
|
|
|
|
|
|
|
|
|
The ubiquitous console IO support. These are standard Conduit instances, with Reader/Writer wrappers applied appropriately. Note that the outputs use FlushBuffer to automatically flush data as it is added to the buffer. The basic usage of this module is illustrated below:
char[] msg = "on the console"; Stdout ("print ") (1) (' ') ("message ") (msg) (CR); An alternative is to use put() notation like so:
char[] msg = "on the console"; Stdout.put ("print ") .put (1) .put (' ') .put ("message ") .put (msg) .put (CR); Another alternative is to use the C++ iostream operators like so:
char[] msg = "on the console"; Stdout << "print " << 1 << ' ' << "message " << msg << CR; Since console idioms are based upon Conduit, you can use them as direct targets for stream-oriented operations. For example, the code:
FileConduit from = new FileConduit ("myfile.txt"); Stdout.conduit.copy (from); copies a text file directly to the console. Likewise, you can copy console input directly to a FileConduit or a SocketConduit. Input via Stdin is similar in nature, but uses the Token classes to isolate and parse each token on an input line:
Stdout automatically flushes the output when it sees a CR, so you may need to flush the output manually where a CR is not desired. This is the case in the above example, so we use the empty () to request a flush (which is actually an alias for the flush method). Note that Stdin awaits a carriage-return before parsing the input into the targets. Note also that the Stdout and Stderr are not written to be thread-safe. As such you may find that output from two threads intersect across each other. If this is a problem you should wrap a synchronized block around the offending entity, like so:
Alternatively, please consider using the mango.log (Logger) package to provide detailed runtime diagnostics from your application. The functionality exposed there is likely sufficient for most application needs. Redirecting the standard IO handles (via a shell) operates as one would expect. Definition at line 141 of file Stdout.d. Referenced by this(). |