@Nullable private TemporaryBuffer.Heap maybeGetTemporaryBuffer( List<PackedObjectInfo> list) { if (list.size() <= 58000) { return new TemporaryBuffer.Heap(2 << 20); } return null; }
TemporaryBuffer.Heap tmp = new TemporaryBuffer.Heap(Integer.MAX_VALUE); tmp.write(out); tmp.write(last);
private String[] extractFileLines(Charset[] csGuess) { final TemporaryBuffer[] tmp = new TemporaryBuffer[getParentCount() + 1]; try { for (int i = 0; i < tmp.length; i++) tmp[i] = new TemporaryBuffer.Heap(Integer.MAX_VALUE); for (HunkHeader h : getHunks()) h.extractFileLines(tmp); final String[] r = new String[tmp.length]; for (int i = 0; i < tmp.length; i++) { Charset cs = csGuess != null ? csGuess[i] : null; if (cs == null) { cs = UTF_8; } r[i] = RawParseUtils.decode(cs, tmp[i].toByteArray()); } return r; } catch (IOException ioe) { throw new RuntimeException(JGitText.get().cannotConvertScriptToText, ioe); } }
/** * Execute a command defined by a {@link java.lang.ProcessBuilder}. * * @param pb * The command to be executed * @param in * The standard input stream passed to the process * @return The result of the executed command * @throws java.lang.InterruptedException * @throws java.io.IOException * @since 4.2 */ public ExecutionResult execute(ProcessBuilder pb, InputStream in) throws IOException, InterruptedException { try (TemporaryBuffer stdout = new TemporaryBuffer.LocalFile(null); TemporaryBuffer stderr = new TemporaryBuffer.Heap(1024, 1024 * 1024)) { int rc = runProcess(pb, stdout, stderr, in); return new ExecutionResult(stdout, stderr, rc); } }
private String[] extractFileLines(Charset[] csGuess) { final TemporaryBuffer[] tmp = new TemporaryBuffer[getParentCount() + 1]; try { for (int i = 0; i < tmp.length; i++) tmp[i] = new TemporaryBuffer.Heap(Integer.MAX_VALUE); for (HunkHeader h : getHunks()) h.extractFileLines(tmp); final String[] r = new String[tmp.length]; for (int i = 0; i < tmp.length; i++) { Charset cs = csGuess != null ? csGuess[i] : null; if (cs == null) { cs = UTF_8; } r[i] = RawParseUtils.decode(cs, tmp[i].toByteArray()); } return r; } catch (IOException ioe) { throw new RuntimeException(JGitText.get().cannotConvertScriptToText, ioe); } }
private String[] extractFileLines(final Charset[] csGuess) { final TemporaryBuffer[] tmp = new TemporaryBuffer[getParentCount() + 1]; try { for (int i = 0; i < tmp.length; i++) tmp[i] = new TemporaryBuffer.Heap(Integer.MAX_VALUE); for (final HunkHeader h : getHunks()) h.extractFileLines(tmp); final String[] r = new String[tmp.length]; for (int i = 0; i < tmp.length; i++) { Charset cs = csGuess != null ? csGuess[i] : null; if (cs == null) cs = Constants.CHARSET; r[i] = RawParseUtils.decode(cs, tmp[i].toByteArray()); } return r; } catch (IOException ioe) { throw new RuntimeException(JGitText.get().cannotConvertScriptToText, ioe); } }
@Nullable private TemporaryBuffer.Heap maybeGetTemporaryBuffer( List<PackedObjectInfo> list) { if (list.size() <= 58000) { return new TemporaryBuffer.Heap(2 << 20); } return null; }
private void fmtOverflowBuffer(byte[] nameBuf, int namePos, int nameLen, FileMode mode) throws IOException { if (buf != null) { overflowBuffer = new TemporaryBuffer.Heap(Integer.MAX_VALUE); overflowBuffer.write(buf, 0, ptr); buf = null; } mode.copyTo(overflowBuffer); overflowBuffer.write((byte) ' '); overflowBuffer.write(nameBuf, namePos, nameLen); overflowBuffer.write((byte) 0); }
private static byte[] readFully(InputStream is) throws IOException { try (TemporaryBuffer b = new TemporaryBuffer.Heap(Integer.MAX_VALUE)) { b.copy(is); return b.toByteArray(); } }
private TemporaryBuffer.Heap delta(ObjectToPack otp) throws IOException { DeltaIndex index = new DeltaIndex(buffer(otp.getDeltaBaseId())); byte[] res = buffer(otp); // We never would have proposed this pair if the delta would be // larger than the unpacked version of the object. So using it // as our buffer limit is valid: we will never reach it. // TemporaryBuffer.Heap delta = new TemporaryBuffer.Heap(res.length); index.encode(delta, res); return delta; }
private void fmtOverflowBuffer(byte[] nameBuf, int namePos, int nameLen, FileMode mode) throws IOException { if (buf != null) { overflowBuffer = new TemporaryBuffer.Heap(Integer.MAX_VALUE); overflowBuffer.write(buf, 0, ptr); buf = null; } mode.copyTo(overflowBuffer); overflowBuffer.write((byte) ' '); overflowBuffer.write(nameBuf, namePos, nameLen); overflowBuffer.write((byte) 0); }
private TemporaryBuffer.Heap delta(final ObjectToPack otp) throws IOException { DeltaIndex index = new DeltaIndex(buffer(otp.getDeltaBaseId())); byte[] res = buffer(otp); // We never would have proposed this pair if the delta would be // larger than the unpacked version of the object. So using it // as our buffer limit is valid: we will never reach it. // TemporaryBuffer.Heap delta = new TemporaryBuffer.Heap(res.length); index.encode(delta, res); return delta; }
private static byte[] readFully(final InputStream is) throws IOException { TemporaryBuffer b = new TemporaryBuffer.Heap(Integer.MAX_VALUE); b.copy(is); b.close(); return b.toByteArray(); }
void sendRequest() throws IOException { TemporaryBuffer buf = new TemporaryBuffer.Heap( http.getPostBuffer()); try (GZIPOutputStream gzip = new GZIPOutputStream(buf)) {
state = new TemporaryBuffer.Heap(Integer.MAX_VALUE); pckState = new PacketLineOut(state);
OutputStream delta = msz <= (8 << 10) ? new ArrayStream(msz) : new TemporaryBuffer.Heap(msz); if (srcIndex.encode(delta, resBuf, msz)) selectDeltaBase(src, delta);
/** * Execute a command defined by a {@link java.lang.ProcessBuilder}. * * @param pb * The command to be executed * @param in * The standard input stream passed to the process * @return The result of the executed command * @throws java.lang.InterruptedException * @throws java.io.IOException * @since 4.2 */ public ExecutionResult execute(ProcessBuilder pb, InputStream in) throws IOException, InterruptedException { try (TemporaryBuffer stdout = new TemporaryBuffer.LocalFile(null); TemporaryBuffer stderr = new TemporaryBuffer.Heap(1024, 1024 * 1024)) { int rc = runProcess(pb, stdout, stderr, in); return new ExecutionResult(stdout, stderr, rc); } }
private TemporaryBuffer.Heap delta(ObjectToPack otp) throws IOException { DeltaIndex index = new DeltaIndex(buffer(otp.getDeltaBaseId())); byte[] res = buffer(otp); // We never would have proposed this pair if the delta would be // larger than the unpacked version of the object. So using it // as our buffer limit is valid: we will never reach it. // TemporaryBuffer.Heap delta = new TemporaryBuffer.Heap(res.length); index.encode(delta, res); return delta; }
private static byte[] readFully(InputStream is) throws IOException { try (TemporaryBuffer b = new TemporaryBuffer.Heap(Integer.MAX_VALUE)) { b.copy(is); return b.toByteArray(); } }
private void fmtOverflowBuffer(byte[] nameBuf, int namePos, int nameLen, FileMode mode) throws IOException { if (buf != null) { overflowBuffer = new TemporaryBuffer.Heap(Integer.MAX_VALUE); overflowBuffer.write(buf, 0, ptr); buf = null; } mode.copyTo(overflowBuffer); overflowBuffer.write((byte) ' '); overflowBuffer.write(nameBuf, namePos, nameLen); overflowBuffer.write((byte) 0); }