java writeint_Java DataOutputStream.writeInt(int v)類型

DataOutputStream.writeInt(int v)方法示例

DataOutputStream的DataOutputStream.writeInt(int v)方法具有以下語法。

public final void writeInt(int v) throws IOException

示例

在下面的代碼中展示了如何使用DataOutputStream.writeInt(int v)方法。

import java.io.DataInputStream; import java.io.DataOutputStream; import java.io.FileInputStream; import java.io.FileOutputStream; import java.io.IOException; import java.io.InputStream; public class Main { public static void main(String[] args) throws IOException { int[] i = { 123, 234, 454, 567, 789 }; FileOutputStream fos = new FileOutputStream("c:\test.txt"); DataOutputStream dos = new DataOutputStream(fos); for (int j : i) { dos.writeInt(j); } dos.flush();// From: W WW . yI I B A I .c O M InputStream is = new FileInputStream("c:\test.txt"); DataInputStream dis = new DataInputStream(is); while (dis.available() > 0) { int k = dis.readInt(); System.out.print(k); } } }

¥ 我要打賞?? 糾錯/補充 收藏

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/392461.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/392461.shtml
英文地址,請注明出處:http://en.pswp.cn/news/392461.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

協方差意味著什么_“零”到底意味著什么?

協方差意味著什么When I was an undergraduate student studying Data Science, one of my professors always asked the same question for every data set we worked with — “What does zero mean?”當我是一名研究數據科學的本科生時,我的一位教授總是對我們處…

Go_筆試題記錄-不熟悉的

1、golang中沒有隱藏的this指針,這句話的含義是() A. 方法施加的對象顯式傳遞,沒有被隱藏起來 B. golang沿襲了傳統面向對象編程中的諸多概念,比如繼承、虛函數和構造函數 C. golang的面向對象表達更直觀,對…

leetcode 316. 去除重復字母(單調棧)

給你一個字符串 s ,請你去除字符串中重復的字母,使得每個字母只出現一次。需保證 返回結果的字典序最小(要求不能打亂其他字符的相對位置)。 注意:該題與 1081 https://leetcode-cn.com/problems/smallest-subsequenc…

Go-json解碼到結構體

廢話不多說,直接干就得了,上代碼 package mainimport ("encoding/json""fmt" )type IT struct {Company string json:"company" Subjects []string json:"subjects"IsOk bool json:"isok"…

leetcode 746. 使用最小花費爬樓梯(dp)

數組的每個索引作為一個階梯,第 i個階梯對應著一個非負數的體力花費值 costi。 每當你爬上一個階梯你都要花費對應的體力花費值,然后你可以選擇繼續爬一個階梯或者爬兩個階梯。 您需要找到達到樓層頂部的最低花費。在開始時,你可以選擇從索…

安卓中經常使用控件遇到問題解決方法(持續更新和發現篇幅)(在textview上加一條線、待續)...

TextView設置最多顯示30個字符。超過部分顯示...(省略號)&#xff0c;有人說分別設置TextView的android:signature"true",而且設置android:ellipsize"end";可是我試了。居然成功了&#xff0c;供大家參考 [java] view plaincopy<TextView android:id…

網絡工程師晉升_晉升為工程師的最快方法

網絡工程師晉升by Sihui Huang黃思慧 晉升為工程師的最快方法 (The Fastest Way to Get Promoted as an Engineer) We all want to live up to our potential, grow in our career, and do the best work of our lives. Getting promoted at work not only proves that we hav…

java 銀行存取款_用Java編寫銀行存錢取錢

const readline require(‘readline-sync‘)//引用readline-synclet s 2;//錯誤的次數for (let i 0; i < 3; i) {console.log(‘請輸入名&#xff1a;(由英文組成)‘);let user readline.question();console.log(‘請輸入密碼&#xff1a;(由數字組成)‘);let password …

垃圾郵件分類 python_在python中創建SMS垃圾郵件分類器

垃圾郵件分類 python介紹 (Introduction) I have always been fascinated with Google’s gmail spam detection system, where it is able to seemingly effortlessly judge whether incoming emails are spam and therefore not worthy of our limited attention.我一直對Goo…

leetcode 103. 二叉樹的鋸齒形層序遍歷(層序遍歷)

給定一個二叉樹&#xff0c;返回其節點值的鋸齒形層序遍歷。&#xff08;即先從左往右&#xff0c;再從右往左進行下一層遍歷&#xff0c;以此類推&#xff0c;層與層之間交替進行&#xff09;。例如&#xff1a; 給定二叉樹 [3,9,20,null,null,15,7],3/ \9 20/ \15 7 返回…

簡單易用的MongoDB

從我第一次聽到Nosql這個概念到如今已經走過4個年頭了&#xff0c;但仍然沒有具體的去做過相應的實踐。最近獲得一段學習休息時間&#xff0c;購買了Nosql技術實踐一書&#xff0c;正在慢慢的學習。在主流觀點中&#xff0c;Nosql大體分為4類&#xff0c;鍵值存儲數據庫&#x…

html畫布圖片不顯示_如何在HTML5畫布上顯示圖像

html畫布圖片不顯示by Nash Vail由Nash Vail Ok, so here’s a question: “Why do we need an article for this, Nash?”好的&#xff0c;這是一個問題&#xff1a;“為什么我們需要為此寫一篇文章&#xff0c;納什&#xff1f;” Well, grab a seat.好吧&#xff0c;坐下…

java斷點續傳插件_視頻斷點續傳+java視頻

之前仿造uploadify寫了一個HTML5版的文件上傳插件&#xff0c;沒看過的朋友可以點此先看一下~得到了不少朋友的好評&#xff0c;我自己也用在了項目中&#xff0c;不論是用戶頭像上傳&#xff0c;還是各種媒體文件的上傳&#xff0c;以及各種個性的業務需求&#xff0c;都能得到…

全棧入門_啟動數據棧入門包(2020)

全棧入門I advise a lot of people on how to build out their data stack, from tiny startups to enterprise companies that are moving to the cloud or from legacy solutions. There are many choices out there, and navigating them all can be tricky. Here’s a brea…

Go-json解碼到接口及根據鍵獲取值

Go-json解碼到接口及根據鍵獲取值 package mainimport ("encoding/json""fmt""github.com/bitly/go-simplejson" )type JsonServer struct {ServerName stringServerIP string }type JsonServers struct {Servers []JsonServer }func main() {…

C#接口的顯隱實現

顯示接口實現與隱式接口實現 何為顯式接口實現、隱式接口實現&#xff1f;簡單概括&#xff0c;使用接口名作為方法名的前綴&#xff0c;這稱為“顯式接口實現”&#xff1b;傳統的實現方式&#xff0c;稱為“隱式接口實現”。下面給個例子。 IChineseGreeting接口&#xff0c;…

亞馬遜 各國站點 鏈接_使用Amazon S3和HTTPS的簡單站點托管

亞馬遜 各國站點 鏈接by Georgia Nola喬治亞諾拉(Georgia Nola) 使用Amazon S3和HTTPS的簡單站點托管 (Simple site hosting with Amazon S3 and HTTPS) Hiya folks!大家好&#xff01; In this tutorial I’ll show you how to host a static website with HTTPS on AWS wit…

leetcode 387. 字符串中的第一個唯一字符(hash)

給定一個字符串&#xff0c;找到它的第一個不重復的字符&#xff0c;并返回它的索引。如果不存在&#xff0c;則返回 -1。 示例&#xff1a; s “leetcode” 返回 0 s “loveleetcode” 返回 2 class Solution { public int firstUniqChar(String s) { int[][] tempnew i…

marlin 三角洲_三角洲湖泊和數據湖泊-入門

marlin 三角洲Data lakes are becoming adopted in more and more companies seeking for efficient storage of their assets. The theory behind it is quite simple, in contrast to the industry standard data warehouse. To conclude this this post explains the logica…

tomcat中設置Java 客戶端程序的http(https)訪問代理

1、假定http/https代理服務器為 127.0.0.1 端口為8118 2、在tomcat/bin/catalina.sh腳本文件中設置JAVA_OPTS&#xff0c;如下圖&#xff1a; 保存后重啟tomcat就能生效。轉載于:https://www.cnblogs.com/zhangmingcheng/p/11211776.html