This commit is contained in:
Alexey Kudravtsev
2015-11-16 13:19:17 +03:00
parent cd07899181
commit 17de17c766
4 changed files with 9 additions and 13 deletions
@@ -1,5 +1,5 @@
/*
* Copyright 2000-2013 JetBrains s.r.o.
* Copyright 2000-2015 JetBrains s.r.o.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -24,11 +24,10 @@ import java.io.InputStream;
* @author Konstantin Kolosovsky.
*/
public abstract class BinaryOutputReader extends BaseDataReader {
@NotNull private final InputStream myStream;
@NotNull private final byte[] myBuffer = new byte[8192];
public BinaryOutputReader(@NotNull InputStream stream, SleepingPolicy sleepingPolicy) {
public BinaryOutputReader(@NotNull InputStream stream, @NotNull SleepingPolicy sleepingPolicy) {
super(sleepingPolicy);
myStream = stream;
}
@@ -21,7 +21,6 @@ import com.intellij.execution.process.OSProcessHandler;
import com.intellij.util.io.BaseDataReader;
import com.intellij.util.io.BinaryOutputReader;
import org.jetbrains.annotations.NotNull;
import org.jetbrains.annotations.Nullable;
import java.io.ByteArrayOutputStream;
import java.io.InputStream;
@@ -32,7 +31,7 @@ class HgCommandProcessHandler extends OSProcessHandler {
private final boolean myBinary;
private final ByteArrayOutputStream myBinaryOutput;
public HgCommandProcessHandler(@NotNull GeneralCommandLine commandLine, boolean binary) throws ExecutionException {
HgCommandProcessHandler(@NotNull GeneralCommandLine commandLine, boolean binary) throws ExecutionException {
super(commandLine);
myBinary = binary;
myBinaryOutput = new ByteArrayOutputStream();
@@ -40,7 +39,7 @@ class HgCommandProcessHandler extends OSProcessHandler {
@NotNull
@Override
protected BaseDataReader createOutputDataReader(BaseDataReader.SleepingPolicy sleepingPolicy) {
protected BaseDataReader createOutputDataReader(@NotNull BaseDataReader.SleepingPolicy sleepingPolicy) {
return myBinary ? new MyBinaryOutputReader(myProcess.getInputStream(), sleepingPolicy) : super.createOutputDataReader(sleepingPolicy);
}
@@ -50,8 +49,7 @@ class HgCommandProcessHandler extends OSProcessHandler {
}
private class MyBinaryOutputReader extends BinaryOutputReader {
public MyBinaryOutputReader(@NotNull InputStream stream, @Nullable BaseDataReader.SleepingPolicy simple) {
private MyBinaryOutputReader(@NotNull InputStream stream, @NotNull BaseDataReader.SleepingPolicy simple) {
super(stream, simple);
start();
}
@@ -35,8 +35,8 @@ public final class ShellCommand {
private final GeneralCommandLine myCommandLine;
public ShellCommand(@Nullable List<String> commandLine, @Nullable String dir, @Nullable Charset charset) {
if (commandLine == null || commandLine.isEmpty()) {
public ShellCommand(@NotNull List<String> commandLine, @Nullable String dir, @Nullable Charset charset) {
if (commandLine.isEmpty()) {
throw new IllegalArgumentException("commandLine is empty");
}
myCommandLine = new GeneralCommandLine(commandLine);
@@ -61,7 +61,7 @@ public class SvnProcessHandler extends OSProcessHandler {
@NotNull
@Override
protected BaseDataReader createOutputDataReader(BaseDataReader.SleepingPolicy sleepingPolicy) {
protected BaseDataReader createOutputDataReader(@NotNull BaseDataReader.SleepingPolicy sleepingPolicy) {
if (myForceBinary) {
return new SimpleBinaryOutputReader(myProcess.getInputStream(), sleepingPolicy);
}
@@ -69,8 +69,7 @@ public class SvnProcessHandler extends OSProcessHandler {
}
private class SimpleBinaryOutputReader extends BinaryOutputReader {
public SimpleBinaryOutputReader(@NotNull InputStream stream, SleepingPolicy sleepingPolicy) {
private SimpleBinaryOutputReader(@NotNull InputStream stream, @NotNull SleepingPolicy sleepingPolicy) {
super(stream, sleepingPolicy);
start();
}