Here you can find the source of readBytesArray(DataInputStream dis)
static byte[] readBytesArray(DataInputStream dis)
//package com.java2s; /******************************************************************************* * Copyright (c) 2014 Open Door Logistics (www.opendoorlogistics.com) * All rights reserved. This program and the accompanying materials * are made available under the terms of the GNU Lesser Public License 3.0 * which accompanies this distribution, and is available at * http://www.gnu.org/licenses/lgpl.html * /*from ww w .j a v a 2s. c o m*/ ******************************************************************************/ import java.io.DataInputStream; public class Main { public static final String RENDER_GEOMETRY_FILE_EXT = "odlrg"; static byte[] readBytesArray(DataInputStream dis) { try { int len = dis.readInt(); if (len > 0) { byte[] ret = new byte[len]; int read = dis.read(ret); if (read < len) { throw new RuntimeException( "Corrupt " + RENDER_GEOMETRY_FILE_EXT + " file; found array which is shorter than declated."); } return ret; } return null; } catch (Exception e) { throw new RuntimeException(e); } } }