1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495969798 |
|
/*******************************************************************************
copyright: Copyright (c) 2007 Kris Bell. All rights reserved
license: BSD style: $(LICENSE)
version: Initial release: Nov 2007
author: Kris
*******************************************************************************/
module tango.io.stream.TextFile;
public import tango.io.device.File;
private import tango.io.stream.Text;
/*******************************************************************************
Composes a file with line-oriented input. The input is buffered.
*******************************************************************************/
class TextFileInput : TextInput
{
/***********************************************************************
Compose a FileStream.
***********************************************************************/
this (const(char)[] path, File.Style style = File.ReadExisting)
{
this (new File (path, style));
}
/***********************************************************************
Wrap a FileConduit instance.
***********************************************************************/
this (File file)
{
super (file);
}
}
/*******************************************************************************
Composes a file with formatted text output. Output is buffered.
*******************************************************************************/
class TextFileOutput : TextOutput
{
/***********************************************************************
Compose a FileStream.
***********************************************************************/
this (const(char)[] path, File.Style style = File.WriteCreate)
{
this (new File (path, style));
}
/***********************************************************************
Wrap a File instance.
***********************************************************************/
this (File file)
{
super (file);
}
}
/*******************************************************************************
*******************************************************************************/
debug (TextFile)
{
import tango.io.Console;
void main()
{
auto t = new TextFileInput ("TextFile.d");
foreach (line; t)
Cout(line).newline;
}
}
|