@Override public GlobalDictMetadata readIndexFile(Path dir) throws IOException { Path indexFile = new Path(dir, V2_INDEX_NAME); try (FSDataInputStream in = fs.open(indexFile)) { byte minorVersion = in.readByte(); // include a header to allow minor format changes if (minorVersion != MINOR_VERSION_V1) { throw new RuntimeException("Unsupported minor version " + minorVersion); } int baseId = in.readInt(); int maxId = in.readInt(); int maxValueLength = in.readInt(); int nValues = in.readInt(); String converterName = in.readUTF(); BytesConverter converter; try { converter = ClassUtil.forName(converterName, BytesConverter.class).getDeclaredConstructor().newInstance(); } catch (Exception e) { throw new RuntimeException("Fail to instantiate BytesConverter: " + converterName, e); } int nSlices = in.readInt(); TreeMap<AppendDictSliceKey, String> sliceFileMap = new TreeMap<>(); for (int i = 0; i < nSlices; i++) { AppendDictSliceKey key = new AppendDictSliceKey(); key.readFields(in); String sliceFileName = in.readUTF(); sliceFileMap.put(key, sliceFileName); } return new GlobalDictMetadata(baseId, maxId, maxValueLength, nValues, converter, sliceFileMap); } }
syncCheck[i%syncLen] = in.readByte();
private static long seekToHeader(final FSDataInputStream inputStream, final long start) throws IOException { inputStream.seek(start); long nextStart = start; final byte[] buffer = new byte[PATTERN.length]; while (true) { if ((buffer[0] = PATTERN[0]) == inputStream.readByte()) { inputStream.read(nextStart + 1, buffer, 1, PATTERN.length - 1); if (patternMatch(buffer)) { inputStream.seek(nextStart); return nextStart; } } else { nextStart = nextStart + 1; inputStream.seek(nextStart); } } }
/** * @see java.io.DataInput#readByte() */ @Override public byte readByte() throws IOException { return this.fis.readByte(); }
/** * @see java.io.DataInput#readByte() */ @Override public byte readByte() throws IOException { return this.fis.readByte(); }
/** * @see java.io.DataInput#readByte() */ @Override public byte readByte() throws IOException { return this.fis.readByte(); }
@Override public byte readByte() throws IOException { return in.readByte(); }
public final byte readByte() throws IOException { return in.readByte(); }
public final byte readByte() throws IOException { return in.readByte(); }
public byte get(int i) throws IOException { if (i < 0 || i >= size) { throw new ArrayIndexOutOfBoundsException("i = " + i + " size = " + size); } stream.seek(startPos + i); return stream.readByte(); }
public byte get(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); byte returnValue = stream.readByte(); stream.seek(currentPos); return returnValue; }
public byte get() throws IOException { if (stream.getPos() >= startPos + limit) { throw new ArrayIndexOutOfBoundsException( "Stream out of bounds: startPos = " + startPos + " limit = " + limit); } return stream.readByte(); }
public Mutation next() { try { mutation.readFields(login); eventType = login.readByte(); } catch (IOException e) { throw new RuntimeException(e); } return mutation; }
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; }
private static long seekToHeader(final FSDataInputStream inputStream, final long start) throws IOException { inputStream.seek(start); long nextStart = start; final byte[] buffer = new byte[PATTERN.length]; while (true) { if ((buffer[0] = PATTERN[0]) == inputStream.readByte()) { inputStream.read(nextStart + 1, buffer, 1, PATTERN.length - 1); if (patternMatch(buffer)) { inputStream.seek(nextStart); return nextStart; } } else { nextStart = nextStart + 1; inputStream.seek(nextStart); } } }