集册 Java实例教程 使用DataInputStream从文件读取无符号字节

使用DataInputStream从文件读取无符号字节

欢马劈雪     最近更新时间:2020-01-02 10:19:05

366
使用DataInputStream从文件读取无符号字节
//n o w j a v a . c o m - 时代Java


import java.io.DataInputStream;

import java.io.FileInputStream;

import java.io.FileNotFoundException;

import java.io.IOException;

 

public class Main {

 

  public static void main(String[] args) {

    String strFilePath = "C://Folder//readUnsignedByte.txt";

    try

    {

       FileInputStream fin = new FileInputStream(strFilePath);//NowJava.com 提供

       DataInputStream din = new DataInputStream(fin);

       int i = din.readUnsignedByte();

       System.out.println("Unsinged byte value : " + i);

       din.close();

       

    }

    catch(FileNotFoundException fe)

    {

      System.out.println(
展开阅读全文