DataOutputStream类writeLong()方法 (DataOutputStream Class writeLong() method)
writeLong() method is available in java.io package.
writeLong()方法在java.io包中可用。
writeLong() method is used to write the given long value to the basic DataOutputStream as 8 bytes (i.e. 64 bit) and the variable counter is plus by 8 on successful execution.
writeLong()方法用于将给定的long值作为8个字节(即64位)写入基本DataOutputStream,并且成功执行时变量计数器加8。
writeLong() 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.
writeLong()方法是一个非静态方法,只能通过类对象访问,如果尝试使用类名称访问该方法,则会收到错误消息。
writeLong() method may throw an exception at the time of writing long.
writeLong()方法在写入很长时间时可能会引发异常。
IOException: This exception may throw while getting any input/output error.
IOException :在获取任何输入/输出错误时,可能引发此异常。
Syntax:
句法:
public final void writeLong(long val);
Parameter(s):
参数:
long val – represents the long value to be written to the data output stream.
long val –表示要写入数据输出流的long值。
Return value:
返回值:
The return type of the method is void, it returns nothing.
该方法的返回类型为void ,不返回任何内容。
Example:
例:
// Java program to demonstrate the example
// of void writeLong(long val) method
// of DataOutputStream
public class GetSignersOfClass {
public static void main(String[] args) throws Exception {
// Creating an instance of String
String str = new String();
// It returns the Class object represented by the String class
// object
Class cl = str.getClass();
// By using getSigners() method is to get the signers of the Class
Object[] o = cl.getSigners();
System.out.println(cl.getName() + " " + "Signers :" + o);
}
}
Output
输出量
java.lang.String Signers :null
翻译自: https://www.includehelp.com/java/dataoutputstream-writelong-method-with-example.aspx