/** {@inheritDoc} */ @Override public void readFully(byte[] b, int off, int len) throws IOException { IO.readFully(fd, b, off, len); }
private ByteBuffer filterClean(byte[] src, int n, OperationType opType) throws IOException { InputStream in = new ByteArrayInputStream(src); try { return IO.readWholeStream(filterClean(in, opType), n); } finally { safeClose(in); } }
@Override public String read() throws IOException { // Presize for a command containing 2 SHA-1s and some refname. String line = IO.readLine(reader, 41 * 2 + 64); if (line.isEmpty()) { throw new EOFException(); } else if (line.charAt(line.length() - 1) == '\n') { line = line.substring(0, line.length() - 1); } return line; } }
void discardUntilEnd() throws IOException { for (;;) { int n = readLength(); if (n == 0) { break; } IO.skipFully(in, n - 4); } }
resetAndSkipFully(in, ++i); sb.append(buf, 0, i); return sb.toString(); sb.append(buf, 0, n); resetAndSkipFully(in, n);
FileSnapshot otherSnapshot = FileSnapshot.save(path); try { buf = IO.readSome(path, limit); } catch (FileNotFoundException noFile) { if (path.exists() && path.isFile()) {
infoOffset = infoAt.value; IO.readFully(in, info, infoOffset, INFO_LEN); IO.readFully(in, info, infoOffset + INFO_LEN, INFO_LEN_EXTENDED - INFO_LEN); if (pathLen < NAME_MASK) { path = new byte[pathLen]; IO.readFully(in, path, 0, pathLen); md.update(path, 0, pathLen); } else { IO.readFully(in, buf, 0, NAME_MASK); tmp.write(buf); final int padLen = expLen - actLen - skipped; if (padLen > 0) { IO.skipFully(in, padLen); md.update(nullpad, 0, padLen);
private void inflateAndSkip(Source src, long inflatedSize) throws IOException { try (InputStream inf = inflate(src, inflatedSize)) { IO.skipFully(inf, inflatedSize); } }
resetAndSkipFully(in, ++i); sb.append(buf, 0, i); return sb.toString(); sb.append(buf, 0, n); resetAndSkipFully(in, n);
FileSnapshot otherSnapshot = FileSnapshot.save(path); try { buf = IO.readSome(path, limit); } catch (FileNotFoundException noFile) { if (path.exists() && path.isFile()) {
/** * Create a new sequence from a file. * <p> * The entire file contents are used. * * @param file * the text file. * @throws java.io.IOException * if Exceptions occur while reading the file */ public RawText(File file) throws IOException { this(IO.readFully(file)); }
private void sync() throws IOException { packDigest.update(buf, 0, bOffset); onStoreStream(buf, 0, bOffset); if (expectDataAfterPackFooter) { if (bAvail > 0) { in.reset(); IO.skipFully(in, bOffset); bAvail = 0; } in.mark(buf.length); } else if (bAvail > 0) System.arraycopy(buf, bOffset, buf, 0, bAvail); bBase += bOffset; bOffset = 0; }
private InputStream possiblyFilteredInputStream(final Entry e, final InputStream is, final long len, OperationType opType) throws IOException { if (getCleanFilterCommand() == null && getEolStreamType(opType) == EolStreamType.DIRECT) { canonLen = len; return is; } if (len <= MAXIMUM_FILE_SIZE_TO_READ_FULLY) { ByteBuffer rawbuf = IO.readWholeStream(is, (int) len); rawbuf = filterClean(rawbuf.array(), rawbuf.limit(), opType); canonLen = rawbuf.limit(); return new ByteArrayInputStream(rawbuf.array(), 0, (int) canonLen); } if (getCleanFilterCommand() == null && isBinary(e)) { canonLen = len; return is; } final InputStream lenIs = filterClean(e.openInputStream(), opType); try { canonLen = computeLength(lenIs); } finally { safeClose(lenIs); } return filterClean(is, opType); }
@Override public String read() throws IOException { // Presize for a command containing 2 SHA-1s and some refname. String line = IO.readLine(reader, 41 * 2 + 64); if (line.isEmpty()) { throw new EOFException(); } else if (line.charAt(line.length() - 1) == '\n') { line = line.substring(0, line.length() - 1); } return line; } }
resetAndSkipFully(in, ++i); sb.append(buf, 0, i); return sb.toString(); sb.append(buf, 0, n); resetAndSkipFully(in, n);
FileSnapshot otherSnapshot = FileSnapshot.save(path); try { buf = IO.readSome(path, limit); } catch (FileNotFoundException noFile) { if (path.exists() && path.isFile()) {
/** * Read an entire local file into memory as a byte array. * * @param path * location of the file to read. * @return complete contents of the requested local file. * @throws java.io.FileNotFoundException * the file does not exist. * @throws java.io.IOException * the file exists, but its contents cannot be read. */ public static final byte[] readFully(File path) throws FileNotFoundException, IOException { return IO.readFully(path, Integer.MAX_VALUE); }