congrats Icon
New! Announcing our next generation AI code completions
Read here
Tabnine Logo
LittleEndianDataInput
Code IndexAdd Tabnine to your IDE (free)

How to use
LittleEndianDataInput
in
com.ardor3d.util

Best Java code snippets using com.ardor3d.util.LittleEndianDataInput (Showing top 20 results out of 315)

origin: com.ardor3d/ardor3d-core

public final void readFully(final byte b[], final int off, final int len) throws IOException {
  // this may look over-complicated, but the problem is that the InputStream.read() methods are
  // not guaranteed to fill up the buffer you pass to it. So we need to loop until we have filled
  // up the buffer or until we reach the end of the file.
  final int bytesRead = _stream.read(b, off, len);
  if (bytesRead == -1) {
    throw new EOFException("EOF reached");
  }
  if (bytesRead < len) {
    // we didn't get all the data we wanted, so read some more
    readFully(b, off + bytesRead, len - bytesRead);
  }
}
origin: com.ardor3d/ardor3d-core

  static DdsPixelFormat read(final LittleEndianDataInput in) throws IOException {
    final DdsPixelFormat format = new DdsPixelFormat();
    format.dwSize = in.readInt();
    if (format.dwSize != 32) {
      throw new Error("invalid pixel format size: " + format.dwSize);
    }
    format.dwFlags = in.readInt();
    format.dwFourCC = in.readInt();
    format.dwRGBBitCount = in.readInt();
    format.dwRBitMask = in.readInt();
    format.dwGBitMask = in.readInt();
    format.dwBBitMask = in.readInt();
    format.dwABitMask = in.readInt();
    return format;
  }
}
origin: Renanse/Ardor3D

public final double readDouble() throws IOException {
  return Double.longBitsToDouble(readLong());
}
origin: Renanse/Ardor3D

public Image load(final InputStream is, final boolean flipVertically) throws IOException {
  final LittleEndianDataInput in = new LittleEndianDataInput(is);
  // Read and check magic word...
  final int dwMagic = in.readInt();
  if (dwMagic != getInt("DDS ")) {
    throw new Error("Not a dds file.");
  }
  logger.finest("Reading DDS file.");
  // Create our data store;
  final DdsImageInfo info = new DdsImageInfo();
  info.flipVertically = flipVertically;
  // Read standard dds header
  info.header = DdsHeader.read(in);
  // if applicable, read DX10 header
  info.headerDX10 = info.header.ddpf.dwFourCC == getInt("DX10") ? DdsHeaderDX10.read(in) : null;
  // Create our new image
  final Image image = new Image();
  image.setWidth(info.header.dwWidth);
  image.setHeight(info.header.dwHeight);
  // update depth based on flags / header
  updateDepth(image, info);
  // add our format and image data.
  populateImage(image, info, in);
  // return the loaded image
  return image;
}
origin: Renanse/Ardor3D

DataInput di = dis;
if (isLittleEndian) {
  di = new LittleEndianDataInput(dis);
origin: Renanse/Ardor3D

public final short readShort() throws IOException {
  return (short) readUnsignedShort();
}
origin: com.ardor3d/ardor3d-core

public Image load(final InputStream is, final boolean flipVertically) throws IOException {
  final LittleEndianDataInput in = new LittleEndianDataInput(is);
  // Read and check magic word...
  final int dwMagic = in.readInt();
  if (dwMagic != getInt("DDS ")) {
    throw new Error("Not a dds file.");
  }
  logger.finest("Reading DDS file.");
  // Create our data store;
  final DdsImageInfo info = new DdsImageInfo();
  info.flipVertically = flipVertically;
  // Read standard dds header
  info.header = DdsHeader.read(in);
  // if applicable, read DX10 header
  info.headerDX10 = info.header.ddpf.dwFourCC == getInt("DX10") ? DdsHeaderDX10.read(in) : null;
  // Create our new image
  final Image image = new Image();
  image.setWidth(info.header.dwWidth);
  image.setHeight(info.header.dwHeight);
  // update depth based on flags / header
  updateDepth(image, info);
  // add our format and image data.
  populateImage(image, info, in);
  // return the loaded image
  return image;
}
origin: com.ardor3d/ardor3d-terrain

DataInput di = dis;
if (isLittleEndian) {
  di = new LittleEndianDataInput(dis);
origin: com.ardor3d/ardor3d-core

public final char readChar() throws IOException {
  return (char) readUnsignedShort();
}
origin: Renanse/Ardor3D

public final void readFully(final byte b[], final int off, final int len) throws IOException {
  // this may look over-complicated, but the problem is that the InputStream.read() methods are
  // not guaranteed to fill up the buffer you pass to it. So we need to loop until we have filled
  // up the buffer or until we reach the end of the file.
  final int bytesRead = _stream.read(b, off, len);
  if (bytesRead == -1) {
    throw new EOFException("EOF reached");
  }
  if (bytesRead < len) {
    // we didn't get all the data we wanted, so read some more
    readFully(b, off + bytesRead, len - bytesRead);
  }
}
origin: Renanse/Ardor3D

@Before
public void setup() throws Exception {
  in = new MockInputStream();
  array = new byte[10];
  littleEndien = new LittleEndianDataInput(in);
}
origin: Renanse/Ardor3D

  static DdsPixelFormat read(final LittleEndianDataInput in) throws IOException {
    final DdsPixelFormat format = new DdsPixelFormat();
    format.dwSize = in.readInt();
    if (format.dwSize != 32) {
      throw new Error("invalid pixel format size: " + format.dwSize);
    }
    format.dwFlags = in.readInt();
    format.dwFourCC = in.readInt();
    format.dwRGBBitCount = in.readInt();
    format.dwRBitMask = in.readInt();
    format.dwGBitMask = in.readInt();
    format.dwBBitMask = in.readInt();
    format.dwABitMask = in.readInt();
    return format;
  }
}
origin: com.ardor3d/ardor3d-core

public final short readShort() throws IOException {
  return (short) readUnsignedShort();
}
origin: com.ardor3d/ardor3d-core

public final double readDouble() throws IOException {
  return Double.longBitsToDouble(readLong());
}
origin: com.ardor3d/ardor3d-core

static final ByteBuffer readDXT(final LittleEndianDataInput in, final int totalSize, final DdsImageInfo info,
    final Image image) throws IOException {
  int mipWidth = info.header.dwWidth;
  int mipHeight = info.header.dwHeight;
  final ByteBuffer buffer = BufferUtils.createByteBuffer(totalSize);
  for (int mip = 0; mip < info.header.dwMipMapCount; mip++) {
    final byte[] data = new byte[info.mipmapByteSizes[mip]];
    in.readFully(data);
    if (!info.flipVertically) {
      buffer.put(data);
    } else {
      final byte[] flipped = flipDXT(data, mipWidth, mipHeight, image.getDataFormat());
      buffer.put(flipped);
      mipWidth = Math.max(mipWidth / 2, 1);
      mipHeight = Math.max(mipHeight / 2, 1);
    }
  }
  buffer.rewind();
  return buffer;
}
origin: com.ardor3d/ardor3d-core

public final float readFloat() throws IOException {
  return Float.intBitsToFloat(readInt());
}
origin: Renanse/Ardor3D

public final char readChar() throws IOException {
  return (char) readUnsignedShort();
}
origin: Renanse/Ardor3D

static final ByteBuffer readDXT(final LittleEndianDataInput in, final int totalSize, final DdsImageInfo info,
    final Image image) throws IOException {
  int mipWidth = info.header.dwWidth;
  int mipHeight = info.header.dwHeight;
  final ByteBuffer buffer = BufferUtils.createByteBuffer(totalSize);
  for (int mip = 0; mip < info.header.dwMipMapCount; mip++) {
    final byte[] data = new byte[info.mipmapByteSizes[mip]];
    in.readFully(data);
    if (!info.flipVertically) {
      buffer.put(data);
    } else {
      final byte[] flipped = flipDXT(data, mipWidth, mipHeight, image.getDataFormat());
      buffer.put(flipped);
      mipWidth = Math.max(mipWidth / 2, 1);
      mipHeight = Math.max(mipHeight / 2, 1);
    }
  }
  buffer.rewind();
  return buffer;
}
origin: Renanse/Ardor3D

public final float readFloat() throws IOException {
  return Float.intBitsToFloat(readInt());
}
origin: Renanse/Ardor3D

  public void run() {
    try {
      littleEndien.readFully(array);
    } catch (IOException e) {
      e.printStackTrace();
      fail("ioexception");
    }
  }
});
com.ardor3d.utilLittleEndianDataInput

Javadoc

LittleEndianDataInput is a class to read little-endian stored data via a InputStream. All functions work as defined in DataInput, but assume they come from a LittleEndian input stream.

Most used methods

  • <init>
    Creates a new LittleEndian reader from the given input stream. The stream is wrapped in a BufferedIn
  • readFully
  • readInt
  • readLong
  • readUnsignedShort

Popular in Java

  • Making http post requests using okhttp
  • getContentResolver (Context)
  • findViewById (Activity)
  • onCreateOptionsMenu (Activity)
  • Window (java.awt)
    A Window object is a top-level window with no borders and no menubar. The default layout for a windo
  • MessageFormat (java.text)
    Produces concatenated messages in language-neutral way. New code should probably use java.util.Forma
  • StringTokenizer (java.util)
    Breaks a string into tokens; new code should probably use String#split.> // Legacy code: StringTo
  • Cipher (javax.crypto)
    This class provides access to implementations of cryptographic ciphers for encryption and decryption
  • StringUtils (org.apache.commons.lang)
    Operations on java.lang.String that arenull safe. * IsEmpty/IsBlank - checks if a String contains
  • IsNull (org.hamcrest.core)
    Is the value null?
  • 14 Best Plugins for Eclipse
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimAtomGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyStudentsTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now