Here you can find the source of fread(short[] data, int length, InputStream fp)
data
from fp
.
Parameter | Description |
---|---|
data | a parameter |
length | a parameter |
fp | a parameter |
Parameter | Description |
---|
static int fread(short[] data, int length, InputStream fp) throws IOException
//package com.java2s; /*/* w w w . j a v a 2 s . c o m*/ * Jitsi, the OpenSource Java VoIP and Instant Messaging client. * * Distributable under LGPL license. * See terms of license at gnu.org. */ import java.io.*; public class Main { /** * Read <code>data</code> from <code>fp</code>. * * @param data * @param length * @param fp * @return length of resulting data array * @throws java.io.IOException */ static int fread(short[] data, int length, InputStream fp) throws IOException { byte[] bytes = new byte[2]; int readLength = 0; for (int i = 0; i < length; i++) { if (fp.read(bytes) != 2) break; data[i] = (short) ((bytes[1] << 8) | (bytes[0] & 0x00FF)); readLength++; } return readLength; } }