try (FSDataInputStream inStream = fs.open(openTxFileName)) { internalId = inStream.readLong(); short fileEpoch = inStream.readShort(); if (epoch != fileEpoch) { throw new RuntimeException(String.format("Was expecting [%s] but got [%s] from path [%s]",
leadBytes = i.readShort(); } catch (EOFException e) { i.seek(0);
/** * @see java.io.DataInput#readShort() */ @Override public short readShort() throws IOException { return this.fis.readShort(); }
/** * @see java.io.DataInput#readShort() */ @Override public short readShort() throws IOException { return this.fis.readShort(); }
/** * @see java.io.DataInput#readShort() */ @Override public short readShort() throws IOException { return this.fis.readShort(); }
public final short readShort() throws IOException { return in.readShort(); }
public final short readShort() throws IOException { return in.readShort(); }
public short getShort() throws IOException { if (stream.getPos() >= startPos + limit) { throw new ArrayIndexOutOfBoundsException( "Stream out of bounds: startPos = " + startPos + " limit = " + limit); } return stream.readShort(); }
public short getShort(int index) throws IOException { if (index >= limit) { throw new ArrayIndexOutOfBoundsException( "Stream out of bounds: startPos = " + startPos + " limit = " + limit + " index = " + index); } long currentPos = stream.getPos(); stream.seek(startPos + index); short returnValue = stream.readShort(); stream.seek(currentPos); return returnValue; }
private InputStream forMagic(Path p, FileSystem srcFs) throws IOException { FSDataInputStream i = srcFs.open(p); switch(i.readShort()) { case 0x1f8b: // RFC 1952 i.seek(0); return new GZIPInputStream(i); case 0x5345: // 'S' 'E' if (i.readByte() == 'Q') { i.close(); return new TextRecordInputStream(srcFs.getFileStatus(p)); } break; } i.seek(0); return i; }
private InputStream forMagic(Path p, FileSystem srcFs) throws IOException { FSDataInputStream i = srcFs.open(p); switch(i.readShort()) { case 0x1f8b: // RFC 1952 i.seek(0); return new GZIPInputStream(i); case 0x5345: // 'S' 'E' if (i.readByte() == 'Q') { i.close(); return new TextRecordInputStream(srcFs.getFileStatus(p)); } break; } i.seek(0); return i; }
private InputStream forMagic(Path p, FileSystem srcFs) throws IOException { FSDataInputStream i = srcFs.open(p); switch(i.readShort()) { case 0x1f8b: // RFC 1952 i.seek(0); return new GZIPInputStream(i); case 0x5345: // 'S' 'E' if (i.readByte() == 'Q') { i.close(); return new TextRecordInputStream(srcFs.getFileStatus(p)); } break; } i.seek(0); return i; }
/** * Initializes a new HDF file from an input stream. This stream should not * be closed as long as the HDF file is used. Closing this HDFFile will * also close the underlying stream. * @throws IOException * */ public HDFFile(FSDataInputStream inStream) throws IOException { this.inStream = inStream; byte[] signature = new byte[4]; inStream.readFully(signature); if (!Arrays.equals(signature, HDFMagicNumber)) throw new RuntimeException("Not a valid HDF file"); int blockSize = inStream.readUnsignedShort(); int nextBlock; do { // Keep track of the location of the next block nextBlock = inStream.readInt(); this.readBlock(blockSize); if (nextBlock != 0) { inStream.seek(nextBlock); blockSize = inStream.readShort(); } } while (nextBlock > 0); LOG.debug("Read an HDF file with "+this.dataDescriptors.size()+" data descriptors"); }
switch(i.readShort()) { case 0x1f8b: // RFC 1952 i.seek(0);
@Override public void loadIndex(Path index, Path mapping, FileSystem fs) throws IOException { this.conf = fs.getConf(); LOG.info("Loading forward index: " + index); docnoMapping.loadMapping(mapping, fs); FSDataInputStream in = fs.open(index); // Class name; throw away. in.readUTF(); collectionPath = in.readUTF(); int blocks = in.readInt(); LOG.info(blocks + " blocks expected"); docnos = new int[blocks]; offsets = new int[blocks]; fileno = new short[blocks]; for (int i = 0; i < blocks; i++) { docnos[i] = in.readInt(); offsets[i] = in.readInt(); fileno[i] = in.readShort(); if (i > 0 && i % 100000 == 0) LOG.info(i + " blocks read"); } in.close(); }
@Override public void loadIndex(Path index, Path mapping, FileSystem fs) throws IOException { LOG.info("Loading forward index: " + index); docnoMapping.loadMapping(mapping, fs); FSDataInputStream in = fs.open(index); // Class name; throw away. in.readUTF(); collectionPath = in.readUTF(); int blocks = in.readInt(); LOG.info(blocks + " blocks expected"); docnos = new int[blocks]; offsets = new int[blocks]; fileno = new short[blocks]; for (int i = 0; i < blocks; i++) { docnos[i] = in.readInt(); offsets[i] = in.readInt(); fileno[i] = in.readShort(); if (i > 0 && i % 100000 == 0) LOG.info(i + " blocks read"); } in.close(); }
@Override public void loadIndex(Path index, Path mapping, FileSystem fs) throws IOException { docnoMapping.loadMapping(mapping, fs); FSDataInputStream in = fs.open(index); // class name; throw away in.readUTF(); collectionPath = in.readUTF(); int blocks = in.readInt(); docnos = new int[blocks]; offsets = new int[blocks]; filenos = new short[blocks]; for (int i = 0; i < blocks; i++) { docnos[i] = in.readInt(); offsets[i] = in.readInt(); filenos[i] = in.readShort(); } in.close(); }
Assert.isTrue(srcFs.isFile(src), "Source must be a file"); i = srcFs.open(src); switch (i.readShort()) { case 0x1f8b: // RFC 1952 i.seek(0);
leadBytes = i.readShort(); } catch (EOFException e) { i.seek(0);
leadBytes = i.readShort(); } catch (EOFException e) { i.seek(0);