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()方法是一種非靜態方法,只能通過類對象訪問,如果嘗試使用類名稱訪問該方法,則會收到錯誤消息。
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 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
創作挑戰賽新人創作獎勵來咯,堅持創作打卡瓜分現金大獎總結
以上是生活随笔為你收集整理的Java PushbackInputStream markSupported()方法与示例的全部內容,希望文章能夠幫你解決所遇到的問題。
- 上一篇: python字符串转浮点数_如何在Pyt
- 下一篇: “惭无胜化质”下一句是什么