Java File Read via ByteBuffer readInt(InputStream input)

Here you can find the source of readInt(InputStream input)

Description

read Int

License

Open Source License

Declaration

public static int readInt(InputStream input) throws IOException 

Method Source Code


//package com.java2s;
//License from project: Open Source License 

import java.io.*;

import java.nio.ByteBuffer;

public class Main {
    public static int readInt(InputStream input) throws IOException {
        byte[] szBytes = new byte[4];
        int read = input.read(szBytes);
        if (read <= 0) {
            return 0;
        }//from  w w  w  . j av  a  2s .  c o m
        return ByteBuffer.wrap(szBytes).getInt();
    }
}

Related

  1. readInt(byte[] bytes, int index)
  2. readInt(byte[] bytes, int offset, java.nio.ByteOrder byteorder)
  3. readInt(byte[] in)
  4. readInt(ByteArrayInputStream bin)
  5. readInt(InputStream in, ByteOrder order)
  6. readInt(InputStream inputStream)
  7. readInt(ReadableByteChannel channel)
  8. readInt(ReadableByteChannel channel)
  9. readInt16(DataInput di)