public float readFloat() throws IOException { return Float.intBitsToFloat(readInt()); }
@Override public Object load(AssetInfo assetInfo) throws IOException { data.clear(); LittleEndien stream = new LittleEndien(new DataInputStream(assetInfo.openStream())); int magic = stream.readInt(); int version = stream.readInt(); int length = stream.readInt(); byte[] json = null; //length is the total size, we have to remove the header size (3 integers = 12 bytes). length -= 12; while (length > 0) { int chunkLength = stream.readInt(); int chunkType = stream.readInt(); if (chunkType == JSON_TYPE) { json = new byte[chunkLength]; stream.read(json); } else { byte[] bin = new byte[chunkLength]; stream.read(bin); data.add(bin); } //8 is the byte size of the 2 ints chunkLength and chunkType. length -= chunkLength + 8; } return loadFromStream(assetInfo, new ByteArrayInputStream(json)); }
private static void populateIntBuffer(IntBuffer buffer, LittleEndien stream, int count, int byteOffset, int byteStride, int numComponents, VertexBuffer.Format format) throws IOException { int componentSize = format.getComponentSize(); int index = byteOffset; int dataLength = componentSize * numComponents; int stride = Math.max(dataLength, byteStride); int end = count * stride + byteOffset; stream.skipBytes(byteOffset); while (index < end) { for (int i = 0; i < numComponents; i++) { buffer.put(stream.readInt()); } if (dataLength < stride) { stream.skipBytes(stride - dataLength); } index += stride; } }
public float readFloat() throws IOException { return Float.intBitsToFloat(readInt()); }
public float readFloat() throws IOException { return Float.intBitsToFloat(readInt()); }
@Override public Object load(AssetInfo assetInfo) throws IOException { LittleEndien stream = new LittleEndien(new DataInputStream(assetInfo.openStream())); int magic = stream.readInt(); int version = stream.readInt(); int length = stream.readInt(); byte[] json = null; //length is the total size, we have to remove the header size (3 integers = 12 bytes). length -= 12; while (length > 0) { int chunkLength = stream.readInt(); int chunkType = stream.readInt(); if (chunkType == JSON_TYPE) { json = new byte[chunkLength]; stream.read(json); } else { byte[] bin = new byte[chunkLength]; stream.read(bin); data.add(bin); } //8 is the byte size of the 2 ints chunkLength and chunkType. length -= chunkLength + 8; } return loadFromStream(assetInfo, new ByteArrayInputStream(json)); }
private static void populateIntBuffer(IntBuffer buffer, LittleEndien stream, int count, int byteOffset, int byteStride, int numComponents, VertexBuffer.Format format) throws IOException { int componentSize = format.getComponentSize(); int index = byteOffset; int dataLength = componentSize * numComponents; int stride = Math.max(dataLength, byteStride); int end = count * stride + byteOffset; stream.skipBytes(byteOffset); while (index < end) { for (int i = 0; i < numComponents; i++) { buffer.put(stream.readInt()); } if (dataLength < stride) { stream.skipBytes(stride - dataLength); } index += stride; } }
private AudioData load(InputStream inputStream, boolean stream) throws IOException{ this.in = new LittleEndien(inputStream); int sig = in.readInt(); if (sig != i_RIFF) throw new IOException("File is not a WAVE file"); in.readInt(); if (in.readInt() != i_WAVE) throw new IOException("WAVE File does not contain audio"); int type = in.readInt(); int len = in.readInt();