提交 a43efeab 编写于 作者: J Josh Soref

use java style array declaration instead of C style

上级 007dca59
......@@ -159,7 +159,7 @@ public class UsageStatistics extends PageDecorator implements PersistentDescript
// capture the descriptors as these should be small compared with the number of items
// so we will walk all items only once and we can short-cut the search of descriptors
TopLevelItemDescriptor[] descriptors = Items.all().toArray(new TopLevelItemDescriptor[0]);
int counts[] = new int[descriptors.length];
int[] counts = new int[descriptors.length];
for (TopLevelItem item: j.allItems(TopLevelItem.class)) {
TopLevelItemDescriptor d = item.getDescriptor();
for (int i = 0; i < descriptors.length; i++) {
......
......@@ -73,7 +73,7 @@ public abstract class AbstractCommandInstaller extends ToolInstaller {
// TODO support Unix scripts with interpreter line (see Shell.buildCommandLine)
FilePath script = dir.createTextTempFile("hudson", getCommandFileExtension(), command);
try {
String cmd[] = getCommandCall(script);
String[] cmd = getCommandCall(script);
int r = node.createLauncher(log).launch().cmds(cmd).stdout(log).pwd(dir).join();
if (r != 0) {
throw new IOException("Command returned status " + r);
......
......@@ -162,7 +162,7 @@ public class AtomicFileWriter extends Writer {
core.write(str,off,len);
}
public void write(char cbuf[], int off, int len) throws IOException {
public void write(char[] cbuf, int off, int len) throws IOException {
core.write(cbuf,off,len);
}
......
......@@ -46,7 +46,7 @@ public class ByteBuffer extends OutputStream {
private int size = 0;
public synchronized void write(byte b[], int off, int len) throws IOException {
public synchronized void write(byte[] b, int off, int len) throws IOException {
ensureCapacity(len);
System.arraycopy(b,off,buf,size,len);
size+=len;
......@@ -94,7 +94,7 @@ public class ByteBuffer extends OutputStream {
}
}
public int read(byte b[], int off, int len) throws IOException {
public int read(byte[] b, int off, int len) throws IOException {
synchronized(ByteBuffer.this) {
if(size==pos)
return -1;
......
......@@ -41,7 +41,7 @@ public final class CharSpool extends Writer {
private char[] last = new char[1024];
private int pos;
public void write(char cbuf[], int off, int len) {
public void write(char[] cbuf, int off, int len) {
while(len>0) {
int sz = Math.min(last.length-pos,len);
System.arraycopy(cbuf,off,last,pos,sz);
......
......@@ -342,7 +342,7 @@ public class ChunkedInputStream extends InputStream {
*/
static void exhaustInputStream(InputStream inStream) throws IOException {
// read and discard the remainder of the message
byte buffer[] = new byte[1024];
byte[] buffer = new byte[1024];
while (inStream.read(buffer) >= 0) {
;
}
......
......@@ -42,13 +42,17 @@ import java.io.OutputStream;
public class ChunkedOutputStream extends OutputStream {
// ------------------------------------------------------- Static Variables
private static final byte CRLF[] = new byte[] {(byte) 13, (byte) 10};
private static final byte[] CRLF = new byte[]{(byte) 13, (byte) 10};
/** End chunk */
private static final byte ENDCHUNK[] = CRLF;
/**
* End chunk
*/
private static final byte[] ENDCHUNK = CRLF;
/** 0 */
private static final byte ZERO[] = new byte[] {(byte) '0'};
/**
* 0
*/
private static final byte[] ZERO = new byte[]{(byte) '0'};
// ----------------------------------------------------- Instance Variables
private OutputStream stream = null;
......@@ -92,7 +96,7 @@ public class ChunkedOutputStream extends OutputStream {
*/
protected void flushCache() throws IOException {
if (cachePosition > 0) {
byte chunkHeader[] = (Integer.toHexString(cachePosition) + "\r\n").getBytes("US-ASCII");
byte[] chunkHeader = (Integer.toHexString(cachePosition) + "\r\n").getBytes("US-ASCII");
stream.write(chunkHeader, 0, chunkHeader.length);
stream.write(cache, 0, cachePosition);
stream.write(ENDCHUNK, 0, ENDCHUNK.length);
......@@ -110,8 +114,8 @@ public class ChunkedOutputStream extends OutputStream {
*
* @since 3.0
*/
protected void flushCacheWithAppend(byte bufferToAppend[], int off, int len) throws IOException {
byte chunkHeader[] = (Integer.toHexString(cachePosition + len) + "\r\n").getBytes("US-ASCII");
protected void flushCacheWithAppend(byte[] bufferToAppend, int off, int len) throws IOException {
byte[] chunkHeader = (Integer.toHexString(cachePosition + len) + "\r\n").getBytes("US-ASCII");
stream.write(chunkHeader, 0, chunkHeader.length);
stream.write(cache, 0, cachePosition);
stream.write(bufferToAppend, off, len);
......@@ -167,12 +171,12 @@ public class ChunkedOutputStream extends OutputStream {
* @since 3.0
*/
@Override
public void write(byte b[]) throws IOException {
public void write(byte[] b) throws IOException {
this.write(b, 0, b.length);
}
@Override
public void write(byte src[], int off, int len) throws IOException {
public void write(byte[] src, int off, int len) throws IOException {
if (len >= cache.length - cachePosition) {
flushCacheWithAppend(src, off, len);
} else {
......
......@@ -66,7 +66,7 @@ public class FileChannelWriter extends Writer {
}
@Override
public void write(char cbuf[], int off, int len) throws IOException {
public void write(char[] cbuf, int off, int len) throws IOException {
final CharBuffer charBuffer = CharBuffer.wrap(cbuf, off, len);
ByteBuffer byteBuffer = charset.encode(charBuffer);
channel.write(byteBuffer);
......
......@@ -57,7 +57,7 @@ public class HeadBufferingStream extends FilterInputStream {
}
@Override
public int read(byte b[], int off, int len) throws IOException {
public int read(byte[] b, int off, int len) throws IOException {
int r = in.read(b, off, len);
if(r>0) {
int sp = space();
......
......@@ -48,7 +48,7 @@ public class LineEndNormalizingWriter extends FilterWriter {
super(out);
}
public void write(char cbuf[]) throws IOException {
public void write(char[] cbuf) throws IOException {
write(cbuf, 0, cbuf.length);
}
......@@ -64,7 +64,7 @@ public class LineEndNormalizingWriter extends FilterWriter {
seenCR = (c==CR);
}
public void write(char cbuf[], int off, int len) throws IOException {
public void write(char[] cbuf, int off, int len) throws IOException {
int end = off+len;
int writeBegin = off;
......
......@@ -32,11 +32,11 @@ public final class NullStream extends OutputStream {
public NullStream() {}
@Override
public void write(byte b[]) {
public void write(byte[] b) {
}
@Override
public void write(byte b[], int off, int len) {
public void write(byte[] b, int off, int len) {
}
public void write(int b) {
......
......@@ -62,7 +62,7 @@ public class WriterOutputStream extends OutputStream {
buf.put((byte)b);
}
public void write(byte b[], int off, int len) throws IOException {
public void write(byte[] b, int off, int len) throws IOException {
while(len>0) {
if(buf.remaining()==0)
decode(false);
......
......@@ -1961,7 +1961,7 @@ public class DomainValidator implements Serializable {
* @since 1.5.1
*/
public static String [] getTLDEntries(DomainValidator.ArrayType table) {
final String array[];
final String[] array;
switch(table) {
case COUNTRY_CODE_MINUS:
array = countryCodeTLDsMinus;
......
......@@ -46,7 +46,7 @@ public abstract class MarkFindingOutputStream extends OutputStream {
}
}
public void write(byte b[], int off, int len) throws IOException {
public void write(byte[] b, int off, int len) throws IOException {
final int start = off;
final int end = off + len;
for (int i=off; i<end; ) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册