public int readInt() { int result = Memory.peekInt(address + position, swap); position += SizeOf.INT; return result; }
public int readInt() { int result = Memory.peekInt(buffer, offset + position, order); position += SizeOf.INT; return result; }
/** * Returns the IP address of the request as an integer. */ public int getIP() { return Memory.peekInt(buffer, INDEX_IP, ByteOrder.BIG_ENDIAN); }
public final int peekInt(int offset, ByteOrder order) { return Memory.peekInt(address + offset, order.needsSwap); }
/** * Reads a big-endian 32-bit integer from the current position in this file. Blocks * until four bytes have been read, the end of the file is reached or an * exception is thrown. * * @return the next int value from this file. * @throws EOFException * if the end of this file is detected. * @throws IOException * if this file is closed or another I/O error occurs. * @see #writeInt(int) */ public final int readInt() throws IOException { readFully(scratch, 0, SizeOf.INT); return Memory.peekInt(scratch, 0, ByteOrder.BIG_ENDIAN); }
@Override public final int getInt() { int newPosition = position + SizeOf.INT; if (newPosition > limit) { throw new BufferUnderflowException(); } int result = Memory.peekInt(backingArray, arrayOffset + position, order); position = newPosition; return result; }
public final int readInt() throws IOException { Streams.readFully(in, scratch, 0, SizeOf.INT); return Memory.peekInt(scratch, 0, ByteOrder.BIG_ENDIAN); }
@Override public final int getInt(int index) { checkIndex(index, SizeOf.INT); return Memory.peekInt(backingArray, arrayOffset + index, order); }
private void readAndVerifyDataDescriptor(int inB, int out) throws IOException { if (hasDD) { Streams.readFully(in, hdrBuf, 0, EXTHDR); int sig = Memory.peekInt(hdrBuf, 0, ByteOrder.LITTLE_ENDIAN); if (sig != (int) EXTSIG) { throw new ZipException(String.format("unknown format (EXTSIG=%x)", sig)); } currentEntry.crc = ((long) Memory.peekInt(hdrBuf, EXTCRC, ByteOrder.LITTLE_ENDIAN)) & 0xffffffffL; currentEntry.compressedSize = ((long) Memory.peekInt(hdrBuf, EXTSIZ, ByteOrder.LITTLE_ENDIAN)) & 0xffffffffL; currentEntry.size = ((long) Memory.peekInt(hdrBuf, EXTLEN, ByteOrder.LITTLE_ENDIAN)) & 0xffffffffL; } if (currentEntry.crc != crc.getValue()) { throw new ZipException("CRC mismatch"); } if (currentEntry.compressedSize != inB || currentEntry.size != out) { throw new ZipException("Size mismatch"); } }
private void verifyCrc() throws IOException { // Get non-compressed bytes read by fill int size = inf.getRemaining(); final int trailerSize = 8; // crc (4 bytes) + total out (4 bytes) byte[] b = new byte[trailerSize]; int copySize = (size > trailerSize) ? trailerSize : size; System.arraycopy(buf, len - size, b, 0, copySize); readFully(b, copySize, trailerSize - copySize); if (Memory.peekInt(b, 0, ByteOrder.LITTLE_ENDIAN) != (int) crc.getValue()) { throw new IOException("CRC mismatch"); } if (Memory.peekInt(b, 4, ByteOrder.LITTLE_ENDIAN) != inf.getTotalOut()) { throw new IOException("Size mismatch"); } }
@Override public boolean isMCGlobal() { // Check if we have a prefix of 1110 if (!isMulticastAddress()) { return false; } int address = Memory.peekInt(ipaddress, 0, ByteOrder.BIG_ENDIAN); /* * Now check the boundaries of the global space if we have an address * that is prefixed by something less than 111000000000000000000001 * (fortunately we don't have to worry about sign after shifting 8 bits * right) it is not multicast. ( < 224.0.1.0) */ if (address >>> 8 < 0xE00001) { return false; } /* * Now check the high boundary which is prefixed by 11101110 = 0xEE. If * the value is higher than this than it is not MCGlobal ( > * 238.255.255.255 ) */ if (address >>> 24 > 0xEE) { return false; } return true; }
private void writeObject(ObjectOutputStream stream) throws IOException { ObjectOutputStream.PutField fields = stream.putFields(); if (ipaddress == null) { fields.put("address", 0); } else { fields.put("address", Memory.peekInt(ipaddress, 0, ByteOrder.BIG_ENDIAN)); } fields.put("family", family); fields.put("hostName", hostName); stream.writeFields(); }
int hdr = Memory.peekInt(hdrBuf, 0, ByteOrder.LITTLE_ENDIAN); if (hdr == CENSIG) { entriesEnd = true; long ceCrc = 0, ceCompressedSize = 0, ceSize = -1; if (!hasDD) { ceCrc = ((long) Memory.peekInt(hdrBuf, LOCCRC - LOCVER, ByteOrder.LITTLE_ENDIAN)) & 0xffffffffL; ceCompressedSize = ((long) Memory.peekInt(hdrBuf, LOCSIZ - LOCVER, ByteOrder.LITTLE_ENDIAN)) & 0xffffffffL; ceSize = ((long) Memory.peekInt(hdrBuf, LOCLEN - LOCVER, ByteOrder.LITTLE_ENDIAN)) & 0xffffffffL;
public int readInt() { int result = Memory.peekInt(buffer, offset + position, order); position += SizeOf.INT; return result; }
public int readInt() { int result = Memory.peekInt(address + position, swap); position += SizeOf.INT; return result; }
/** * Returns the IP address of the request as an integer. */ public int getIP() { return Memory.peekInt(buffer, INDEX_IP, ByteOrder.BIG_ENDIAN); }
@Override public final int getInt() { int newPosition = position + SizeOf.INT; if (newPosition > limit) { throw new BufferUnderflowException(); } int result = Memory.peekInt(backingArray, arrayOffset + position, order); position = newPosition; return result; }
@Override public final int getInt() { int newPosition = position + SizeOf.INT; if (newPosition > limit) { throw new BufferUnderflowException(); } int result = Memory.peekInt(backingArray, arrayOffset + position, order); position = newPosition; return result; }
@Override public final int getInt() { int newPosition = position + SizeOf.INT; if (newPosition > limit) { throw new BufferUnderflowException(); } int result = Memory.peekInt(backingArray, arrayOffset + position, order); position = newPosition; return result; }
private void writeObject(ObjectOutputStream stream) throws IOException { ObjectOutputStream.PutField fields = stream.putFields(); if (ipaddress == null) { fields.put("address", 0); } else { fields.put("address", Memory.peekInt(ipaddress, 0, ByteOrder.BIG_ENDIAN)); } fields.put("family", family); fields.put("hostName", hostName); stream.writeFields(); }