Fix checkstyle

This commit is contained in:
Norman Maurer 2012-06-10 20:45:38 +02:00
parent ad4f05f5d6
commit ed47feeed8
7 changed files with 9 additions and 17 deletions

View File

@ -143,14 +143,13 @@ public class ChunkedFile implements ChunkedByteInput {
} }
int chunkSize = (int) Math.min(this.chunkSize, endOffset - offset); int chunkSize = (int) Math.min(this.chunkSize, endOffset - offset);
// Check if the buffer is backed by an byte array. If so we can optimize it a bit an safe a copy // Check if the buffer is backed by an byte array. If so we can optimize it a bit an safe a copy
byte[] chunk = new byte[chunkSize]; byte[] chunk = new byte[chunkSize];
file.readFully(chunk); file.readFully(chunk);
buffer.writeBytes(chunk); buffer.writeBytes(chunk);
this.offset = offset + chunkSize; this.offset = offset + chunkSize;
return true; return true;
} }
} }

View File

@ -32,8 +32,7 @@ public interface ChunkedInput<B> {
* Releases the resources associated with the stream. * Releases the resources associated with the stream.
*/ */
void close() throws Exception; void close() throws Exception;
/** /**
* Fetches a chunked data from the stream. The chunk is then * Fetches a chunked data from the stream. The chunk is then
* transfered to the given buffer. Once this method returns the last chunk * transfered to the given buffer. Once this method returns the last chunk

View File

@ -19,7 +19,6 @@ import java.util.Queue;
/** /**
* {@link ChunkedInput} which reads its chunks and transfer it to a {@link Queue} * {@link ChunkedInput} which reads its chunks and transfer it to a {@link Queue}
*
* *
*/ */
public interface ChunkedMessageInput extends ChunkedInput<Queue<Object>> { public interface ChunkedMessageInput extends ChunkedInput<Queue<Object>> {

View File

@ -164,7 +164,7 @@ public class ChunkedNioFile implements ChunkedByteInput {
chunk.flip(); chunk.flip();
buffer.writeBytes(chunk); buffer.writeBytes(chunk);
this.offset += readBytes; this.offset += readBytes;
return true; return true;
} }
} }

View File

@ -100,7 +100,6 @@ public class ChunkedNioStream implements ChunkedByteInput {
if (isEndOfInput()) { if (isEndOfInput()) {
return false; return false;
} }
// buffer cannot be not be empty from there // buffer cannot be not be empty from there
int readBytes = byteBuffer.position(); int readBytes = byteBuffer.position();
for (;;) { for (;;) {
@ -110,7 +109,6 @@ public class ChunkedNioStream implements ChunkedByteInput {
} }
readBytes += localReadBytes; readBytes += localReadBytes;
offset += localReadBytes; offset += localReadBytes;
if (readBytes == chunkSize) { if (readBytes == chunkSize) {
break; break;
} }
@ -118,7 +116,7 @@ public class ChunkedNioStream implements ChunkedByteInput {
byteBuffer.flip(); byteBuffer.flip();
buffer.writeBytes(byteBuffer); buffer.writeBytes(byteBuffer);
byteBuffer.clear(); byteBuffer.clear();
return true; return true;
} }
} }

View File

@ -105,9 +105,9 @@ public class ChunkedStream implements ChunkedByteInput {
} else { } else {
chunkSize = Math.min(this.chunkSize, in.available()); chunkSize = Math.min(this.chunkSize, in.available());
} }
// transfer to buffer // transfer to buffer
offset =+ buffer.writeBytes(in, chunkSize); offset += buffer.writeBytes(in, chunkSize);
return true; return true;
} }
} }

View File

@ -274,13 +274,10 @@ public class ChunkedWriteHandler
return; return;
} }
} }
} }
/** /**
* Read the next {@link ChunkedInput} and transfer it the the outbound buffer. * Read the next {@link ChunkedInput} and transfer it the the outbound buffer.
*
* @param ctx the {@link ChannelHandlerContext} this handler is bound to * @param ctx the {@link ChannelHandlerContext} this handler is bound to
* @param chunks the {@link ChunkedInput} to read from * @param chunks the {@link ChunkedInput} to read from
* @return read <code>true</code> if something could be transfered to the outbound buffer * @return read <code>true</code> if something could be transfered to the outbound buffer
@ -295,7 +292,7 @@ public class ChunkedWriteHandler
throw new IllegalArgumentException("ChunkedInput instance " + chunks + " not supported"); throw new IllegalArgumentException("ChunkedInput instance " + chunks + " not supported");
} }
} }
static void closeInput(ChunkedInput<?> chunks) { static void closeInput(ChunkedInput<?> chunks) {
try { try {
chunks.close(); chunks.close();