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); } }
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); }
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); } }
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); } }
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); }
/** * Get note text. This method open and read the note blob each time it is * called. * * @return note text or empty string if lookup failed. */ public String getNoteText() { try { ObjectLoader loader = commit.getRepository().open(note.getData(), Constants.OBJ_BLOB); byte[] contents; if (loader.isLarge()) contents = IO.readWholeStream(loader.openStream(), (int) loader.getSize()).array(); else contents = loader.getCachedBytes(); return new String(contents); } catch (IOException e) { Activator.logError("Error loading note text", e); //$NON-NLS-1$ } return ""; //$NON-NLS-1$ }
ByteBuffer rawbuf = IO.readWholeStream(is, (int) len); byte[] raw = rawbuf.array(); int n = rawbuf.limit();