本文整理匯總了Java中java.io.DataInputStream.available方法的典型用法代碼示例。如果您正苦於以下問題:Java DataInputStream.available方法的具體用法?Java DataInputStream.available怎麽用?Java DataInputStream.available使用的例子?那麽恭喜您, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類java.io.DataInputStream的用法示例。
在下文中一共展示了DataInputStream.available方法的20個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於我們的係統推薦出更棒的Java代碼示例。
示例1: load
點讚 3
import java.io.DataInputStream; //導入方法依賴的package包/類
@Override
public FileSystem load(FileSystem previous, ByteBuffer bb) throws IOException {
byte[] arr = new byte[bb.limit()];
bb.get(arr);
DataInputStream is = new DataInputStream(new ByteArrayInputStream(arr));
List urls = new ArrayList();
while (is.available() > 0) {
String u = is.readUTF();
urls.add(new URL(u));
}
try {
XMLFileSystem fs = (XMLFileSystem)previous;
fs.setXmlUrls(urls.toArray(new URL[urls.size()]));
return fs;
} catch (PropertyVetoException pve) {
throw (IOException) new IOException(pve.toString()).initCause(pve);
}
}
開發者ID:apache,項目名稱:incubator-netbeans,代碼行數:19,
示例2: stream
點讚 3
import java.io.DataInputStream; //導入方法依賴的package包/類
/**
* This method returns a ByteArrayInputStream that contains an internal
* buffer of bytes that may be read from the stream
*/
@SuppressWarnings("resource")
private InputStream stream(String fileName) throws IOException {
// ---- Create a FileInputStream ------------------------------
FileInputStream fileInputStream = new FileInputStream(fileName);
// ---- Create a DataInputStream ------------------------------
DataInputStream dataInputStream = new DataInputStream(fileInputStream);
// ---- Put the dataInputStream in Byte[] ---------------------
byte[] bytes = new byte[dataInputStream.available()];
// ---- Read the bytes ----------------------------------------
dataInputStream.readFully(bytes);
// ---- Create a ByteArrayInputStream -------------------------
ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(bytes);
return byteArrayInputStream;
}
開發者ID:EnFlexIT,項目名稱:AgentWorkbench,代碼行數:20,
示例3: PRUDPPacketReplyScrape2
點讚 3
import java.io.DataInputStream; //導入方法依賴的package包/類
protected
PRUDPPacketReplyScrape2(
DataInputStreamis,
inttrans_id )
throws IOException
{
super( PRUDPPacketTracker.ACT_REPLY_SCRAPE, trans_id );
// interval = is.readInt();
complete= new int[is.available()/BYTES_PER_ENTRY];
incomplete= new int[complete.length];
downloaded= new int[complete.length];
for (int i=0;i
complete[i] = is.readInt();
downloaded[i] = is.readInt();
incomplete[i] = is.readInt();
}
}
開發者ID:BiglySoftware,項目名稱:BiglyBT,代碼行數:23,
示例4: getClassBody
點讚 3
import java.io.DataInputStream; //導入方法依賴的package包/類
private byte[] getClassBody(Object task) {
Class> c = task.getClass();
byte[] classBody = class2bytes.get(c);
if (classBody == null) {
String className = c.getName();
String classAsPath = className.replace('.', '/') + ".class";
InputStream classStream = c.getClassLoader().getResourceAsStream(classAsPath);
DataInputStream s = new DataInputStream(classStream);
try {
classBody = new byte[s.available()];
s.readFully(classBody);
} catch (IOException e) {
throw new IllegalArgumentException(e);
}
class2bytes.put(c, classBody);
}
return classBody;
}
開發者ID:qq1588518,項目名稱:JRediClients,代碼行數:21,
示例5: internalDecodeKeyValues
點讚 3
import java.io.DataInputStream; //導入方法依賴的package包/類
@Override
protected ByteBuffer internalDecodeKeyValues(DataInputStream source, int allocateHeaderLength,
int skipLastBytes, HFileBlockDefaultDecodingContext decodingCtx) throws IOException {
int decompressedSize = source.readInt();
ByteBuffer buffer = ByteBuffer.allocate(decompressedSize +
allocateHeaderLength);
buffer.position(allocateHeaderLength);
DiffCompressionState state = new DiffCompressionState();
w