Java PushbackInputStream markSupported()方法与示例
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()方法是一種非靜態(tài)方法,只能通過類對(duì)象訪問,如果嘗試使用類名稱訪問該方法,則會(huì)收到錯(cuò)誤消息。
markSupported() method does not throw an exception at the time of checking supporting methods.
在檢查支持方法時(shí), markSupported()方法不會(huì)引發(fā)異常。
Syntax:
句法:
public boolean markSupported();Parameter(s):
參數(shù):
It does not accept any parameter.
它不接受任何參數(shù)。
Return value:
返回值:
The return type of the method is boolean, it returns true when this stream support mark() method otherwise it returns false.
方法的返回類型為boolean ,當(dāng)此流支持mark()方法時(shí)返回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 PushbackInputStreamis_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 notboolean 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翻譯自: https://www.includehelp.com/java/pushbackinputstream-marksupported-method-with-example.aspx
創(chuàng)作挑戰(zhàn)賽新人創(chuàng)作獎(jiǎng)勵(lì)來咯,堅(jiān)持創(chuàng)作打卡瓜分現(xiàn)金大獎(jiǎng)總結(jié)
以上是生活随笔為你收集整理的Java PushbackInputStream markSupported()方法与示例的全部?jī)?nèi)容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: python字符串转浮点数_如何在Pyt
- 下一篇: Java文件类字符串getAbsolut