博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
Java PushbackInputStream markSupported()方法与示例
阅读量:2534 次
发布时间:2019-05-11

本文共 2127 字,大约阅读时间需要 7 分钟。

PushbackInputStream类markSupported()方法 (PushbackInputStream Class markSupported() method)

  • markSupported() method is available in java.io package.

    markSupported()方法在java.io包中可用。

  • markSupported() method is used to check whether this stream supports mark(), reset() or not.

    markSupported()方法用于检查此流是否支持mark(),reset()。

  • markSupported() method is a non-static method, it is accessible with the class object only and if we try to access the method with the class name then we will get an error.

    markSupported()方法是一种非静态方法,只能通过类对象访问,如果尝试使用类名称访问该方法,则会收到错误消息。

  • markSupported() method does not throw an exception at the time of checking supporting methods.

    在检查支持方法时, markSupported()方法不会引发异常。

Syntax:

句法:

public boolean markSupported();

Parameter(s):

参数:

  • It does not accept any parameter.

    它不接受任何参数。

Return value:

返回值:

The return type of the method is boolean, it returns true when this stream support mark() method otherwise it returns false.

方法的返回类型为boolean ,当此流支持mark()方法时返回true,否则返回false。

Example:

例:

// Java program to demonstrate the example // of boolean markSupported() method of// PushbackInputStreamimport java.io.*;public class MarkSupportedOfPBIS {
public static void main(String[] args) throws Exception {
byte[] b_arr = {
97, 98, 99, 100 }; InputStream is_stm = null; PushbackInputStream pb_stm = null; try {
// Instantiates ByteArrayOutputStream and PushbackInputStream is_stm = new ByteArrayInputStream(b_arr); pb_stm = new PushbackInputStream(is_stm); // By using markSupported() method is to // check whether this stream supports // mark() method or not boolean status = pb_stm.markSupported(); System.out.println("pb_stm.markSupported(): " + status); } catch (Exception ex) {
System.out.println(ex.toString()); } finally {
if (is_stm != null) is_stm.close(); if (pb_stm != null) pb_stm.close(); } }}

Output

输出量

pb_stm.markSupported(): false

翻译自:

转载地址:http://rfazd.baihongyu.com/

你可能感兴趣的文章
5个基于HTML5的加载动画推荐
查看>>
水平权限漏洞的修复方案
查看>>
静态链接与动态链接的区别
查看>>
Android 关于悬浮窗权限的问题
查看>>
如何使用mysql
查看>>
linux下wc命令详解
查看>>
敏捷开发中软件测试团队的职责和产出是什么?
查看>>
在mvc3中使用ffmpeg对上传视频进行截图和转换格式
查看>>
python的字符串内建函数
查看>>
Spring - DI
查看>>
微软自己的官网介绍 SSL 参数相关
查看>>
Composite UI Application Block (CAB) 概念和术语
查看>>
ajax跨域,携带cookie
查看>>
阶段3 2.Spring_01.Spring框架简介_03.spring概述
查看>>
阶段3 2.Spring_02.程序间耦合_1 编写jdbc的工程代码用于分析程序的耦合
查看>>
阶段3 2.Spring_01.Spring框架简介_04.spring发展历程
查看>>
阶段3 2.Spring_02.程序间耦合_3 程序的耦合和解耦的思路分析1
查看>>
阶段3 2.Spring_02.程序间耦合_5 编写工厂类和配置文件
查看>>
阶段3 2.Spring_01.Spring框架简介_05.spring的优势
查看>>
阶段3 2.Spring_02.程序间耦合_7 分析工厂模式中的问题并改造
查看>>