Add TemporaryBuffer.toString(int limit)
Change-Id: I8603fcdfd0244088b3b217f002a78e7a646ea205 Signed-off-by: Matthias Sohn <matthias.sohn@sap.com>
This commit is contained in:
parent
a9579ba60c
commit
cc07a471dc
|
@ -1610,11 +1610,9 @@ private static void runExternalFilterCommand(Repository repo, String path,
|
||||||
}
|
}
|
||||||
if (rc != 0) {
|
if (rc != 0) {
|
||||||
throw new IOException(new FilterFailedException(rc,
|
throw new IOException(new FilterFailedException(rc,
|
||||||
checkoutMetadata.smudgeFilterCommand,
|
checkoutMetadata.smudgeFilterCommand, path,
|
||||||
path,
|
|
||||||
result.getStdout().toByteArray(MAX_EXCEPTION_TEXT_SIZE),
|
result.getStdout().toByteArray(MAX_EXCEPTION_TEXT_SIZE),
|
||||||
RawParseUtils.decode(result.getStderr()
|
result.getStderr().toString(MAX_EXCEPTION_TEXT_SIZE)));
|
||||||
.toByteArray(MAX_EXCEPTION_TEXT_SIZE))));
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -502,8 +502,7 @@ private InputStream filterClean(InputStream in, OperationType opType)
|
||||||
throw new IOException(new FilterFailedException(rc,
|
throw new IOException(new FilterFailedException(rc,
|
||||||
filterCommand, getEntryPathString(),
|
filterCommand, getEntryPathString(),
|
||||||
result.getStdout().toByteArray(MAX_EXCEPTION_TEXT_SIZE),
|
result.getStdout().toByteArray(MAX_EXCEPTION_TEXT_SIZE),
|
||||||
RawParseUtils.decode(result.getStderr()
|
result.getStderr().toString(MAX_EXCEPTION_TEXT_SIZE)));
|
||||||
.toByteArray(MAX_EXCEPTION_TEXT_SIZE))));
|
|
||||||
}
|
}
|
||||||
return result.getStdout().openInputStreamWithAutoDestroy();
|
return result.getStdout().openInputStreamWithAutoDestroy();
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,6 +18,7 @@
|
||||||
import java.io.IOException;
|
import java.io.IOException;
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.OutputStream;
|
import java.io.OutputStream;
|
||||||
|
import java.io.UncheckedIOException;
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
|
|
||||||
import org.eclipse.jgit.internal.JGitText;
|
import org.eclipse.jgit.internal.JGitText;
|
||||||
|
@ -212,6 +213,24 @@ public byte[] toByteArray() throws IOException {
|
||||||
return out;
|
return out;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Convert first {@code limit} number of bytes of the buffer content to
|
||||||
|
* String.
|
||||||
|
*
|
||||||
|
* @param limit
|
||||||
|
* the maximum number of bytes to be converted to String
|
||||||
|
* @return first {@code limit} number of bytes of the buffer content
|
||||||
|
* converted to String.
|
||||||
|
* @since 5.12
|
||||||
|
*/
|
||||||
|
public String toString(int limit) {
|
||||||
|
try {
|
||||||
|
return RawParseUtils.decode(toByteArray(limit));
|
||||||
|
} catch (IOException e) {
|
||||||
|
throw new UncheckedIOException(e);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Convert this buffer's contents into a contiguous byte array. If this size
|
* Convert this buffer's contents into a contiguous byte array. If this size
|
||||||
* of the buffer exceeds the limit only return the first {@code limit} bytes
|
* of the buffer exceeds the limit only return the first {@code limit} bytes
|
||||||
|
|
Loading…
Reference in New Issue