Show / Hide Table of Contents

Class Utf8FileWriter

Defines a writer class for UTF8-encoded files.

Inheritance
System.Object
Utf8FileWriter
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Juhta.Net.Common
Assembly: Juhta.Net.dll
Syntax
public class Utf8FileWriter

Constructors

| Improve this Doc View Source

Utf8FileWriter(String)

Initializes a new instance.

Declaration
public Utf8FileWriter(string filePath)
Parameters
Type Name Description
System.String filePath

Specifies the ablosute or a relative path of a UTF8-encoded file where data will be written. If the file already exists, it will be overwritten.

| Improve this Doc View Source

Utf8FileWriter(String, FileMode)

Initializes a new instance.

Declaration
public Utf8FileWriter(string filePath, FileMode openMode)
Parameters
Type Name Description
System.String filePath

Specifies the ablosute or a relative path of a UTF8-encoded file where data will be written.

System.IO.FileMode openMode

Specifies how the UTF8-encoded file should be opened.

Properties

| Improve this Doc View Source

FilePath

Gets the absolute path of the underlying UTF8-encoded file.

Declaration
public string FilePath { get; }
Property Value
Type Description
System.String
| Improve this Doc View Source

IndentLevel

Gets or sets the current indent level.

Declaration
public byte IndentLevel { get; set; }
Property Value
Type Description
System.Byte
Remarks

The result of the multiplication of IndentLevel and TabSize determines the number of space characters to write at the beginning of each new line.

See Also
TabSize
| Improve this Doc View Source

TabSize

Gets or sets the current tab size.

Declaration
public byte TabSize { get; set; }
Property Value
Type Description
System.Byte
See Also
IndentLevel

Methods

| Improve this Doc View Source

Close()

Flushes all unwritten data to the underlying UTF8-encoded file, and after that, closes the file.

Declaration
public void Close()
Remarks

This method does nothing if the underlying UTF8-encoded file is not open.

See Also
Open()
| Improve this Doc View Source

DecreaseIndentLevel()

Decreases the current indent level by one.

Declaration
public void DecreaseIndentLevel()
| Improve this Doc View Source

Flush()

Flushes all unwritten data to the underlying UTF8-encoded file.

Declaration
public void Flush()
Remarks

This method does nothing if the underlying UTF8-encoded file is not open.

| Improve this Doc View Source

IncreaseIndentLevel()

Increases the current indent level by one.

Declaration
public void IncreaseIndentLevel()
| Improve this Doc View Source

Open()

Opens the underlying UTF8-encoded file.

Declaration
public void Open()
Remarks

This method does nothing if the underlying UTF8-encoded file is already open.

This method does not necessarily have to be called when writing data to the underlying UTF8-encoded file. If the file is not open, it will be automatically opened and closed in context of each write operation. However, recurrent openings and closings of the file might cause some performance loss. To gain the maximum performance, the file should be opened with an explicit call on this method prior to write operations. In this case, the file must also be explicitly closed with the Close() method.

See Also
Close()
| Improve this Doc View Source

Write(String)

Writes a specified string to the underlying UTF8-encoded file.

Declaration
public void Write(string s)
Parameters
Type Name Description
System.String s

Specifies a string.

| Improve this Doc View Source

Write(String, Object[])

Writes a formatted string to the underlying UTF8-encoded file.

Declaration
public void Write(string format, params object[] args)
Parameters
Type Name Description
System.String format

Specifies a string containing zero or more format items.

System.Object[] args

Specifies an object array containing zero or more objects to format. These objects must correspond to the format items in format.

| Improve this Doc View Source

WriteLine()

Writes a line terminator to the underlying UTF8-encoded file.

Declaration
public void WriteLine()
| Improve this Doc View Source

WriteLine(Int32)

Writes a specified number of line terminators to the underlying UTF8-encoded file.

Declaration
public void WriteLine(int count)
Parameters
Type Name Description
System.Int32 count

Specifies a number of line terminators to write.

| Improve this Doc View Source

WriteLine(String)

Writes a specified string followed by a line terminator to the underlying UTF8-encoded file.

Declaration
public void WriteLine(string s)
Parameters
Type Name Description
System.String s

Specifies a string.

| Improve this Doc View Source

WriteLine(String, Object[])

Writes a formatted string followed by a line terminator to the underlying UTF8-encoded file.

Declaration
public void WriteLine(string format, params object[] args)
Parameters
Type Name Description
System.String format

Specifies a string containing zero or more format items.

System.Object[] args

Specifies an object array containing zero or more objects to format. These objects must correspond to the format items in format.

  • Improve this Doc
  • View Source
Back to top Copyright © 2017-2019 Juha Lähteenmäki
Generated by DocFX