PrintStream 类
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
向 PrintStream 另一个输出流添加功能,即能够方便地打印各种数据值的表示形式。
[Android.Runtime.Register("java/io/PrintStream", DoNotGenerateAcw=true)]
public class PrintStream : Java.IO.FilterOutputStream, IDisposable, Java.Interop.IJavaPeerable, Java.Lang.IAppendable
[<Android.Runtime.Register("java/io/PrintStream", DoNotGenerateAcw=true)>]
type PrintStream = class
inherit FilterOutputStream
interface ICloseable
interface IJavaObject
interface IDisposable
interface IJavaPeerable
interface IAppendable
- 继承
- 属性
- 实现
注解
向 PrintStream 另一个输出流添加功能,即能够方便地打印各种数据值的表示形式。 还提供了另外两个功能。 与其他输出流不同, PrintStream 从不引发 IOException;相反,异常情况只是设置一个可通过该方法测试 checkError 的内部标志。 (可选)可以创建 a PrintStream ,以便自动刷新;这意味着 flush 在写入字节数组后自动调用基础输出流的方法,调用其中一 println 种方法或写入换行符或字节('\n')。
使用 PrintStream 给定的编码或字符集或平台的默认字符编码(如果未指定)将所有字符转换为字节。 此类 PrintWriter 应在需要写入字符而不是字节的情况下使用。
此类始终使用字符集的默认替换字符串替换格式不正确且无法应用字符序列。 需要对编码过程进行更多控制时,应使用 java.nio.charset.CharsetEncoder 类。
在 1.0 中添加。
适用于 . 的 java.io.PrintStreamJava 文档
本页的某些部分是根据 Android 开放源代码项目创建和共享的工作进行的修改,并根据 Creative Commons 2.5 属性许可证中所述的术语使用。
构造函数
| 名称 | 说明 |
|---|---|
| PrintStream(File, Charset) |
使用指定的文件和字符集创建新的打印流,而无需自动刷新行。 |
| PrintStream(File, String) |
使用指定的文件和字符集创建新的打印流,而无需自动刷新行。 |
| PrintStream(File) |
使用指定的文件创建一个新的打印流,而无需自动刷新行。 |
| PrintStream(IntPtr, JniHandleOwnership) |
创建 JNI 对象的托管表示形式时使用的构造函数;由运行时调用。 |
| PrintStream(Stream, Boolean, Charset) |
使用指定的 OutputStream、自动行刷新和字符集创建新的打印流。 |
| PrintStream(Stream, Boolean, String) |
创建新的打印流。 |
| PrintStream(Stream, Boolean) |
创建新的打印流。 |
| PrintStream(Stream) |
创建新的打印流。 |
| PrintStream(String, Charset) |
使用指定的文件名和字符集创建新的打印流,无需自动行刷新。 |
| PrintStream(String, String) |
使用指定的文件名和字符集创建新的打印流,无需自动行刷新。 |
| PrintStream(String) |
使用指定的文件名创建一个新的打印流,而无需自动刷新行。 |
属性
| 名称 | 说明 |
|---|---|
| Class |
返回此 |
| Handle |
基础 Android 实例的句柄。 (继承自 Object) |
| JniIdentityHashCode |
向 |
| JniPeerMembers |
向 |
| Out |
要筛选的基础输出流。 (继承自 FilterOutputStream) |
| PeerReference |
向 |
| ThresholdClass |
此 API 支持 Mono for Android 基础结构,不打算直接从代码使用。 |
| ThresholdType |
此 API 支持 Mono for Android 基础结构,不打算直接从代码使用。 |
方法
| 名称 | 说明 |
|---|---|
| Append(Char) |
将指定的字符追加到此输出流。 |
| Append(ICharSequence, Int32, Int32) |
将指定的字符追加到此输出流。 |
| Append(ICharSequence) |
将指定的字符追加到此输出流。 |
| Append(String, Int32, Int32) |
将指定的字符追加到此输出流。 |
| Append(String) |
将指定的字符追加到此输出流。 |
| AppendAsync(Char) |
向 |
| AppendAsync(ICharSequence, Int32, Int32) |
向 |
| AppendAsync(ICharSequence) |
向 |
| CheckError() |
刷新流并检查其错误状态。 |
| ClearError() |
清除此流的内部错误状态。 |
| Clone() |
创建并返回此对象的副本。 (继承自 Object) |
| Close() |
关闭此输出流并释放与此流关联的任何系统资源。 (继承自 OutputStream) |
| Dispose() |
向 |
| Dispose(Boolean) |
向 |
| Equals(Object) |
指示其他对象是否“等于”此对象。 (继承自 Object) |
| Flush() |
刷新此输出流并强制写出任何缓冲的输出字节。 (继承自 OutputStream) |
| Format(Locale, String, Object[]) |
使用指定的格式字符串和参数将格式化字符串写入此输出流。 |
| Format(String, Object[]) |
使用指定的格式字符串和参数将格式化字符串写入此输出流。 |
| FormatAsync(Locale, String, Object[]) |
向 |
| FormatAsync(String, Object[]) |
向 |
| GetHashCode() |
返回对象的哈希代码值。 (继承自 Object) |
| JavaFinalize() |
当垃圾回收确定不再引用该对象时,由对象上的垃圾回收器调用。 (继承自 Object) |
| Notify() |
唤醒正在等待此对象的监视器的单个线程。 (继承自 Object) |
| NotifyAll() |
唤醒正在等待此对象的监视器的所有线程。 (继承自 Object) |
| Print(Boolean) |
打印布尔值。 |
| Print(Char) |
打印字符。 |
| Print(Char[]) |
打印字符数组。 |
| Print(Double) |
打印双精度浮点数。 |
| Print(Int32) |
打印整数。 |
| Print(Int64) |
打印长整数。 |
| Print(Object) |
打印对象。 |
| Print(Single) |
打印浮点数。 |
| Print(String) |
打印字符串。 |
| PrintAsync(Boolean) |
向 |
| PrintAsync(Char) |
向 |
| PrintAsync(Char[]) |
向 |
| PrintAsync(Double) |
向 |
| PrintAsync(Int32) |
向 |
| PrintAsync(Int64) |
向 |
| PrintAsync(Object) |
向 |
| PrintAsync(Single) |
向 |
| PrintAsync(String) |
向 |
| Printf(Locale, String, Object[]) |
使用指定的格式字符串和参数将格式化字符串写入此输出流的便利方法。 |
| Printf(String, Object[]) |
使用指定的格式字符串和参数将格式化字符串写入此输出流的便利方法。 |
| PrintfAsync(Locale, String, Object[]) |
向 |
| PrintfAsync(String, Object[]) |
向 |
| Println() |
通过写入行分隔符字符串终止当前行。 |
| Println(Boolean) |
打印一个布尔值,然后终止行。 |
| Println(Char) |
打印字符,然后终止行。 |
| Println(Char[]) |
打印字符数组,然后终止行。 |
| Println(Double) |
打印一个双精度值,然后终止该行。 |
| Println(Int32) |
打印一个整数,然后终止该行。 |
| Println(Int64) |
打印长线,然后终止行。 |
| Println(Object) |
打印对象,然后终止行。 |
| Println(Single) |
打印一个浮点,然后终止该行。 |
| Println(String) |
打印字符串,然后终止行。 |
| PrintlnAsync() |
向 |
| PrintlnAsync(Boolean) |
向 |
| PrintlnAsync(Char) |
向 |
| PrintlnAsync(Char[]) |
向 |
| PrintlnAsync(Double) |
向 |
| PrintlnAsync(Int32) |
向 |
| PrintlnAsync(Int64) |
向 |
| PrintlnAsync(Object) |
向 |
| PrintlnAsync(Single) |
向 |
| PrintlnAsync(String) |
向 |
| SetError() |
将流的错误状态设置为 |
| SetHandle(IntPtr, JniHandleOwnership) |
设置 Handle 属性。 (继承自 Object) |
| ToArray<T>() |
向 |
| ToString() |
返回对象的字符串表示形式。 (继承自 Object) |
| UnregisterFromRuntime() |
向 |
| Wait() |
使当前线程等待,直到唤醒它,通常是通过 em 通知/em< 或 >em<interrupted>/em<。><> (继承自 Object) |
| Wait(Int64, Int32) |
使当前线程等待直到唤醒,通常是通过 <em>通知</em> 或 <em interrupted>/em<>,或直到经过一定数量的实时。 (继承自 Object) |
| Wait(Int64) |
使当前线程等待直到唤醒,通常是通过 <em>通知</em> 或 <em interrupted>/em<>,或直到经过一定数量的实时。 (继承自 Object) |
| Write(Byte[], Int32, Int32) |
|
| Write(Byte[]) |
将 |
| Write(Int32) |
将指定的 |
| WriteAsync(Byte[], Int32, Int32) |
向 |
| WriteAsync(Byte[]) |
向 |
| WriteAsync(Int32) |
向 |
| WriteBytes(Byte[]) |
向 |
显式接口实现
| 名称 | 说明 |
|---|---|
| IJavaPeerable.Disposed() |
向 |
| IJavaPeerable.DisposeUnlessReferenced() |
向 |
| IJavaPeerable.Finalized() |
向 |
| IJavaPeerable.JniManagedPeerState |
向 |
| IJavaPeerable.SetJniIdentityHashCode(Int32) |
向 |
| IJavaPeerable.SetJniManagedPeerState(JniManagedPeerStates) |
向 |
| IJavaPeerable.SetPeerReference(JniObjectReference) |
向 |
扩展方法
| 名称 | 说明 |
|---|---|
| Append(IAppendable, String, Int32, Int32) |
向 |
| Append(IAppendable, String) |
向 |
| FlushAsync(IFlushable) |
向 |
| GetJniTypeName(IJavaPeerable) |
获取实例 |
| JavaAs<TResult>(IJavaPeerable) |
尝试强制 |
| JavaCast<TResult>(IJavaObject) |
执行 Android 运行时检查的类型转换。 |
| JavaCast<TResult>(IJavaObject) |
向 |
| TryJavaCast<TResult>(IJavaPeerable, TResult) |
尝试强制 |