private boolean checkHeader(BufferingInputStream bis) throws IOException { int magicBytes = readInt(bis); if (magicBytes != MAGIC_BYTES) { logger.warning(format("Found invalid header for Near Cache %s (%s)", nearCacheName, storeFile.getAbsolutePath())); return false; } int fileFormat = readInt(bis); if (fileFormat < 0 || fileFormat > FileFormat.values().length - 1) { logger.warning(format("Found invalid file format for Near Cache %s (%s)", nearCacheName, storeFile.getAbsolutePath())); return false; } return true; }
writeInt(fos, FileFormat.INTERLEAVED_LENGTH_FIELD.ordinal()); writeKeySet(fos, fos.getChannel(), iterator);
writeInt(fos, FileFormat.INTERLEAVED_LENGTH_FIELD.ordinal()); writeKeySet(fos, fos.getChannel(), iterator);
private boolean checkHeader(BufferingInputStream bis) throws IOException { int magicBytes = readInt(bis); if (magicBytes != MAGIC_BYTES) { logger.warning(format("Found invalid header for Near Cache %s (%s)", nearCacheName, storeFile.getAbsolutePath())); return false; } int fileFormat = readInt(bis); if (fileFormat < 0 || fileFormat > FileFormat.values().length - 1) { logger.warning(format("Found invalid file format for Near Cache %s (%s)", nearCacheName, storeFile.getAbsolutePath())); return false; } return true; }