Add missing @Override annotation

This commit is contained in:
Trustin Lee 2012-11-09 17:34:34 +09:00
parent 1ec7f55ac6
commit 8842f8ef90
13 changed files with 116 additions and 0 deletions

View File

@ -94,6 +94,7 @@ public abstract class AbstractDiskHttpData extends AbstractHttpData {
return tmpFile; return tmpFile;
} }
@Override
public void setContent(ByteBuf buffer) throws IOException { public void setContent(ByteBuf buffer) throws IOException {
if (buffer == null) { if (buffer == null) {
throw new NullPointerException("buffer"); throw new NullPointerException("buffer");
@ -124,6 +125,7 @@ public abstract class AbstractDiskHttpData extends AbstractHttpData {
completed = true; completed = true;
} }
@Override
public void addContent(ByteBuf buffer, boolean last) public void addContent(ByteBuf buffer, boolean last)
throws IOException { throws IOException {
if (buffer != null) { if (buffer != null) {
@ -166,6 +168,7 @@ public abstract class AbstractDiskHttpData extends AbstractHttpData {
} }
} }
@Override
public void setContent(File file) throws IOException { public void setContent(File file) throws IOException {
if (this.file != null) { if (this.file != null) {
delete(); delete();
@ -176,6 +179,7 @@ public abstract class AbstractDiskHttpData extends AbstractHttpData {
completed = true; completed = true;
} }
@Override
public void setContent(InputStream inputStream) throws IOException { public void setContent(InputStream inputStream) throws IOException {
if (inputStream == null) { if (inputStream == null) {
throw new NullPointerException("inputStream"); throw new NullPointerException("inputStream");
@ -207,6 +211,7 @@ public abstract class AbstractDiskHttpData extends AbstractHttpData {
completed = true; completed = true;
} }
@Override
public void delete() { public void delete() {
if (! isRenamed) { if (! isRenamed) {
if (file != null) { if (file != null) {
@ -215,6 +220,7 @@ public abstract class AbstractDiskHttpData extends AbstractHttpData {
} }
} }
@Override
public byte[] get() throws IOException { public byte[] get() throws IOException {
if (file == null) { if (file == null) {
return new byte[0]; return new byte[0];
@ -222,6 +228,7 @@ public abstract class AbstractDiskHttpData extends AbstractHttpData {
return readFrom(file); return readFrom(file);
} }
@Override
public ByteBuf getByteBuf() throws IOException { public ByteBuf getByteBuf() throws IOException {
if (file == null) { if (file == null) {
return EMPTY_BUFFER; return EMPTY_BUFFER;
@ -230,6 +237,7 @@ public abstract class AbstractDiskHttpData extends AbstractHttpData {
return wrappedBuffer(array); return wrappedBuffer(array);
} }
@Override
public ByteBuf getChunk(int length) throws IOException { public ByteBuf getChunk(int length) throws IOException {
if (file == null || length == 0) { if (file == null || length == 0) {
return EMPTY_BUFFER; return EMPTY_BUFFER;
@ -260,10 +268,12 @@ public abstract class AbstractDiskHttpData extends AbstractHttpData {
return buffer; return buffer;
} }
@Override
public String getString() throws IOException { public String getString() throws IOException {
return getString(HttpConstants.DEFAULT_CHARSET); return getString(HttpConstants.DEFAULT_CHARSET);
} }
@Override
public String getString(Charset encoding) throws IOException { public String getString(Charset encoding) throws IOException {
if (file == null) { if (file == null) {
return ""; return "";
@ -276,10 +286,12 @@ public abstract class AbstractDiskHttpData extends AbstractHttpData {
return new String(array, encoding.name()); return new String(array, encoding.name());
} }
@Override
public boolean isInMemory() { public boolean isInMemory() {
return false; return false;
} }
@Override
public boolean renameTo(File dest) throws IOException { public boolean renameTo(File dest) throws IOException {
if (dest == null) { if (dest == null) {
throw new NullPointerException("dest"); throw new NullPointerException("dest");
@ -339,6 +351,7 @@ public abstract class AbstractDiskHttpData extends AbstractHttpData {
return array; return array;
} }
@Override
public File getFile() throws IOException { public File getFile() throws IOException {
return file; return file;
} }

View File

@ -69,18 +69,22 @@ public abstract class AbstractHttpData implements HttpData {
definedSize = size; definedSize = size;
} }
@Override
public String getName() { public String getName() {
return name; return name;
} }
@Override
public boolean isCompleted() { public boolean isCompleted() {
return completed; return completed;
} }
@Override
public Charset getCharset() { public Charset getCharset() {
return charset; return charset;
} }
@Override
public void setCharset(Charset charset) { public void setCharset(Charset charset) {
if (charset == null) { if (charset == null) {
throw new NullPointerException("charset"); throw new NullPointerException("charset");
@ -88,6 +92,7 @@ public abstract class AbstractHttpData implements HttpData {
this.charset = charset; this.charset = charset;
} }
@Override
public long length() { public long length() {
return size; return size;
} }

View File

@ -43,6 +43,7 @@ public abstract class AbstractMemoryHttpData extends AbstractHttpData {
super(name, charset, size); super(name, charset, size);
} }
@Override
public void setContent(ByteBuf buffer) throws IOException { public void setContent(ByteBuf buffer) throws IOException {
if (buffer == null) { if (buffer == null) {
throw new NullPointerException("buffer"); throw new NullPointerException("buffer");
@ -57,6 +58,7 @@ public abstract class AbstractMemoryHttpData extends AbstractHttpData {
completed = true; completed = true;
} }
@Override
public void setContent(InputStream inputStream) throws IOException { public void setContent(InputStream inputStream) throws IOException {
if (inputStream == null) { if (inputStream == null) {
throw new NullPointerException("inputStream"); throw new NullPointerException("inputStream");
@ -78,6 +80,7 @@ public abstract class AbstractMemoryHttpData extends AbstractHttpData {
completed = true; completed = true;
} }
@Override
public void addContent(ByteBuf buffer, boolean last) public void addContent(ByteBuf buffer, boolean last)
throws IOException { throws IOException {
if (buffer != null) { if (buffer != null) {
@ -102,6 +105,7 @@ public abstract class AbstractMemoryHttpData extends AbstractHttpData {
} }
} }
@Override
public void setContent(File file) throws IOException { public void setContent(File file) throws IOException {
if (file == null) { if (file == null) {
throw new NullPointerException("file"); throw new NullPointerException("file");
@ -127,10 +131,12 @@ public abstract class AbstractMemoryHttpData extends AbstractHttpData {
completed = true; completed = true;
} }
@Override
public void delete() { public void delete() {
// nothing to do // nothing to do
} }
@Override
public byte[] get() { public byte[] get() {
if (byteBuf == null) { if (byteBuf == null) {
return new byte[0]; return new byte[0];
@ -140,10 +146,12 @@ public abstract class AbstractMemoryHttpData extends AbstractHttpData {
return array; return array;
} }
@Override
public String getString() { public String getString() {
return getString(HttpConstants.DEFAULT_CHARSET); return getString(HttpConstants.DEFAULT_CHARSET);
} }
@Override
public String getString(Charset encoding) { public String getString(Charset encoding) {
if (byteBuf == null) { if (byteBuf == null) {
return ""; return "";
@ -159,10 +167,12 @@ public abstract class AbstractMemoryHttpData extends AbstractHttpData {
* to a Disk (or another implementation) FileUpload * to a Disk (or another implementation) FileUpload
* @return the attached ByteBuf containing the actual bytes * @return the attached ByteBuf containing the actual bytes
*/ */
@Override
public ByteBuf getByteBuf() { public ByteBuf getByteBuf() {
return byteBuf; return byteBuf;
} }
@Override
public ByteBuf getChunk(int length) throws IOException { public ByteBuf getChunk(int length) throws IOException {
if (byteBuf == null || length == 0 || byteBuf.readableBytes() == 0) { if (byteBuf == null || length == 0 || byteBuf.readableBytes() == 0) {
chunkPosition = 0; chunkPosition = 0;
@ -182,10 +192,12 @@ public abstract class AbstractMemoryHttpData extends AbstractHttpData {
return chunk; return chunk;
} }
@Override
public boolean isInMemory() { public boolean isInMemory() {
return true; return true;
} }
@Override
public boolean renameTo(File dest) throws IOException { public boolean renameTo(File dest) throws IOException {
if (dest == null) { if (dest == null) {
throw new NullPointerException("dest"); throw new NullPointerException("dest");
@ -211,6 +223,7 @@ public abstract class AbstractMemoryHttpData extends AbstractHttpData {
return written == length; return written == length;
} }
@Override
public File getFile() throws IOException { public File getFile() throws IOException {
throw new IOException("Not represented by a file"); throw new IOException("Not represented by a file");
} }

View File

@ -28,6 +28,7 @@ public final class CaseIgnoringComparator implements Comparator<String>, Seriali
super(); super();
} }
@Override
public int compare(String o1, String o2) { public int compare(String o1, String o2) {
return o1.compareToIgnoreCase(o2); return o1.compareToIgnoreCase(o2);
} }

View File

@ -92,6 +92,7 @@ public class DefaultHttpDataFactory implements HttpDataFactory {
return list; return list;
} }
@Override
public Attribute createAttribute(HttpRequest request, String name) { public Attribute createAttribute(HttpRequest request, String name) {
if (useDisk) { if (useDisk) {
Attribute attribute = new DiskAttribute(name); Attribute attribute = new DiskAttribute(name);
@ -107,6 +108,7 @@ public class DefaultHttpDataFactory implements HttpDataFactory {
return new MemoryAttribute(name); return new MemoryAttribute(name);
} }
@Override
public Attribute createAttribute(HttpRequest request, String name, String value) { public Attribute createAttribute(HttpRequest request, String name, String value) {
if (useDisk) { if (useDisk) {
Attribute attribute; Attribute attribute;
@ -132,6 +134,7 @@ public class DefaultHttpDataFactory implements HttpDataFactory {
} }
} }
@Override
public FileUpload createFileUpload(HttpRequest request, String name, String filename, public FileUpload createFileUpload(HttpRequest request, String name, String filename,
String contentType, String contentTransferEncoding, Charset charset, String contentType, String contentTransferEncoding, Charset charset,
long size) { long size) {
@ -152,6 +155,7 @@ public class DefaultHttpDataFactory implements HttpDataFactory {
contentTransferEncoding, charset, size); contentTransferEncoding, charset, size);
} }
@Override
public void removeHttpDataFromClean(HttpRequest request, InterfaceHttpData data) { public void removeHttpDataFromClean(HttpRequest request, InterfaceHttpData data) {
if (data instanceof HttpData) { if (data instanceof HttpData) {
List<HttpData> fileToDelete = getList(request); List<HttpData> fileToDelete = getList(request);
@ -159,6 +163,7 @@ public class DefaultHttpDataFactory implements HttpDataFactory {
} }
} }
@Override
public void cleanRequestHttpDatas(HttpRequest request) { public void cleanRequestHttpDatas(HttpRequest request) {
List<HttpData> fileToDelete = requestFileDeleteMap.remove(request); List<HttpData> fileToDelete = requestFileDeleteMap.remove(request);
if (fileToDelete != null) { if (fileToDelete != null) {
@ -169,6 +174,7 @@ public class DefaultHttpDataFactory implements HttpDataFactory {
} }
} }
@Override
public void cleanAllHttpDatas() { public void cleanAllHttpDatas() {
for (HttpRequest request : requestFileDeleteMap.keySet()) { for (HttpRequest request : requestFileDeleteMap.keySet()) {
List<HttpData> fileToDelete = requestFileDeleteMap.get(request); List<HttpData> fileToDelete = requestFileDeleteMap.get(request);

View File

@ -53,15 +53,18 @@ public class DiskAttribute extends AbstractDiskHttpData implements Attribute {
setValue(value); setValue(value);
} }
@Override
public HttpDataType getHttpDataType() { public HttpDataType getHttpDataType() {
return HttpDataType.Attribute; return HttpDataType.Attribute;
} }
@Override
public String getValue() throws IOException { public String getValue() throws IOException {
byte [] bytes = get(); byte [] bytes = get();
return new String(bytes, charset.name()); return new String(bytes, charset.name());
} }
@Override
public void setValue(String value) throws IOException { public void setValue(String value) throws IOException {
if (value == null) { if (value == null) {
throw new NullPointerException("value"); throw new NullPointerException("value");
@ -96,6 +99,7 @@ public class DiskAttribute extends AbstractDiskHttpData implements Attribute {
return getName().equalsIgnoreCase(attribute.getName()); return getName().equalsIgnoreCase(attribute.getName());
} }
@Override
public int compareTo(InterfaceHttpData arg0) { public int compareTo(InterfaceHttpData arg0) {
if (!(arg0 instanceof Attribute)) { if (!(arg0 instanceof Attribute)) {
throw new ClassCastException("Cannot compare " + getHttpDataType() + throw new ClassCastException("Cannot compare " + getHttpDataType() +

View File

@ -46,14 +46,17 @@ public class DiskFileUpload extends AbstractDiskHttpData implements FileUpload {
setContentTransferEncoding(contentTransferEncoding); setContentTransferEncoding(contentTransferEncoding);
} }
@Override
public HttpDataType getHttpDataType() { public HttpDataType getHttpDataType() {
return HttpDataType.FileUpload; return HttpDataType.FileUpload;
} }
@Override
public String getFilename() { public String getFilename() {
return filename; return filename;
} }
@Override
public void setFilename(String filename) { public void setFilename(String filename) {
if (filename == null) { if (filename == null) {
throw new NullPointerException("filename"); throw new NullPointerException("filename");
@ -75,6 +78,7 @@ public class DiskFileUpload extends AbstractDiskHttpData implements FileUpload {
return getName().equalsIgnoreCase(attribute.getName()); return getName().equalsIgnoreCase(attribute.getName());
} }
@Override
public int compareTo(InterfaceHttpData arg0) { public int compareTo(InterfaceHttpData arg0) {
if (!(arg0 instanceof FileUpload)) { if (!(arg0 instanceof FileUpload)) {
throw new ClassCastException("Cannot compare " + getHttpDataType() + throw new ClassCastException("Cannot compare " + getHttpDataType() +
@ -93,6 +97,7 @@ public class DiskFileUpload extends AbstractDiskHttpData implements FileUpload {
return v; return v;
} }
@Override
public void setContentType(String contentType) { public void setContentType(String contentType) {
if (contentType == null) { if (contentType == null) {
throw new NullPointerException("contentType"); throw new NullPointerException("contentType");
@ -100,14 +105,17 @@ public class DiskFileUpload extends AbstractDiskHttpData implements FileUpload {
this.contentType = contentType; this.contentType = contentType;
} }
@Override
public String getContentType() { public String getContentType() {
return contentType; return contentType;
} }
@Override
public String getContentTransferEncoding() { public String getContentTransferEncoding() {
return contentTransferEncoding; return contentTransferEncoding;
} }
@Override
public void setContentTransferEncoding(String contentTransferEncoding) { public void setContentTransferEncoding(String contentTransferEncoding) {
this.contentTransferEncoding = contentTransferEncoding; this.contentTransferEncoding = contentTransferEncoding;
} }

View File

@ -885,6 +885,7 @@ public class HttpPostRequestEncoder implements ChunkedMessageInput<HttpChunk> {
return new DefaultHttpChunk(buffer); return new DefaultHttpChunk(buffer);
} }
@Override
public void close() throws Exception { public void close() throws Exception {
// NO since the user can want to reuse (broadcast for instance) // NO since the user can want to reuse (broadcast for instance)
// cleanFiles(); // cleanFiles();
@ -898,6 +899,7 @@ public class HttpPostRequestEncoder implements ChunkedMessageInput<HttpChunk> {
* @throws ErrorDataEncoderException * @throws ErrorDataEncoderException
* if the encoding is in error * if the encoding is in error
*/ */
@Override
public boolean readChunk(MessageBuf<HttpChunk> buffer) throws ErrorDataEncoderException { public boolean readChunk(MessageBuf<HttpChunk> buffer) throws ErrorDataEncoderException {
if (isLastChunkSent) { if (isLastChunkSent) {
return false; return false;
@ -984,6 +986,7 @@ public class HttpPostRequestEncoder implements ChunkedMessageInput<HttpChunk> {
return new DefaultHttpChunk(buffer); return new DefaultHttpChunk(buffer);
} }
@Override
public boolean isEndOfInput() throws Exception { public boolean isEndOfInput() throws Exception {
return isLastChunkSent; return isLastChunkSent;
} }

View File

@ -25,6 +25,7 @@ import java.util.List;
public class InternalAttribute implements InterfaceHttpData { public class InternalAttribute implements InterfaceHttpData {
protected List<String> value = new ArrayList<String>(); protected List<String> value = new ArrayList<String>();
@Override
public HttpDataType getHttpDataType() { public HttpDataType getHttpDataType() {
return HttpDataType.InternalAttribute; return HttpDataType.InternalAttribute;
} }
@ -68,6 +69,7 @@ public class InternalAttribute implements InterfaceHttpData {
return getName().equalsIgnoreCase(attribute.getName()); return getName().equalsIgnoreCase(attribute.getName());
} }
@Override
public int compareTo(InterfaceHttpData arg0) { public int compareTo(InterfaceHttpData arg0) {
if (!(arg0 instanceof InternalAttribute)) { if (!(arg0 instanceof InternalAttribute)) {
throw new ClassCastException("Cannot compare " + getHttpDataType() + throw new ClassCastException("Cannot compare " + getHttpDataType() +
@ -96,6 +98,7 @@ public class InternalAttribute implements InterfaceHttpData {
return result.toString(); return result.toString();
} }
@Override
public String getName() { public String getName() {
return "InternalAttribute"; return "InternalAttribute";
} }

View File

@ -42,14 +42,17 @@ public class MemoryAttribute extends AbstractMemoryHttpData implements Attribute
setValue(value); setValue(value);
} }
@Override
public HttpDataType getHttpDataType() { public HttpDataType getHttpDataType() {
return HttpDataType.Attribute; return HttpDataType.Attribute;
} }
@Override
public String getValue() { public String getValue() {
return getByteBuf().toString(charset); return getByteBuf().toString(charset);
} }
@Override
public void setValue(String value) throws IOException { public void setValue(String value) throws IOException {
if (value == null) { if (value == null) {
throw new NullPointerException("value"); throw new NullPointerException("value");
@ -85,6 +88,7 @@ public class MemoryAttribute extends AbstractMemoryHttpData implements Attribute
return getName().equalsIgnoreCase(attribute.getName()); return getName().equalsIgnoreCase(attribute.getName());
} }
@Override
public int compareTo(InterfaceHttpData arg0) { public int compareTo(InterfaceHttpData arg0) {
if (!(arg0 instanceof Attribute)) { if (!(arg0 instanceof Attribute)) {
throw new ClassCastException("Cannot compare " + getHttpDataType() + throw new ClassCastException("Cannot compare " + getHttpDataType() +

View File

@ -40,14 +40,17 @@ public class MemoryFileUpload extends AbstractMemoryHttpData implements FileUplo
setContentTransferEncoding(contentTransferEncoding); setContentTransferEncoding(contentTransferEncoding);
} }
@Override
public HttpDataType getHttpDataType() { public HttpDataType getHttpDataType() {
return HttpDataType.FileUpload; return HttpDataType.FileUpload;
} }
@Override
public String getFilename() { public String getFilename() {
return filename; return filename;
} }
@Override
public void setFilename(String filename) { public void setFilename(String filename) {
if (filename == null) { if (filename == null) {
throw new NullPointerException("filename"); throw new NullPointerException("filename");
@ -69,6 +72,7 @@ public class MemoryFileUpload extends AbstractMemoryHttpData implements FileUplo
return getName().equalsIgnoreCase(attribute.getName()); return getName().equalsIgnoreCase(attribute.getName());
} }
@Override
public int compareTo(InterfaceHttpData arg0) { public int compareTo(InterfaceHttpData arg0) {
if (!(arg0 instanceof FileUpload)) { if (!(arg0 instanceof FileUpload)) {
throw new ClassCastException("Cannot compare " + getHttpDataType() + throw new ClassCastException("Cannot compare " + getHttpDataType() +
@ -87,6 +91,7 @@ public class MemoryFileUpload extends AbstractMemoryHttpData implements FileUplo
return v; return v;
} }
@Override
public void setContentType(String contentType) { public void setContentType(String contentType) {
if (contentType == null) { if (contentType == null) {
throw new NullPointerException("contentType"); throw new NullPointerException("contentType");
@ -94,14 +99,17 @@ public class MemoryFileUpload extends AbstractMemoryHttpData implements FileUplo
this.contentType = contentType; this.contentType = contentType;
} }
@Override
public String getContentType() { public String getContentType() {
return contentType; return contentType;
} }
@Override
public String getContentTransferEncoding() { public String getContentTransferEncoding() {
return contentTransferEncoding; return contentTransferEncoding;
} }
@Override
public void setContentTransferEncoding(String contentTransferEncoding) { public void setContentTransferEncoding(String contentTransferEncoding) {
this.contentTransferEncoding = contentTransferEncoding; this.contentTransferEncoding = contentTransferEncoding;
} }

View File

@ -57,6 +57,7 @@ public class MixedAttribute implements Attribute {
} }
} }
@Override
public void addContent(ByteBuf buffer, boolean last) throws IOException { public void addContent(ByteBuf buffer, boolean last) throws IOException {
if (attribute instanceof MemoryAttribute) { if (attribute instanceof MemoryAttribute) {
if (attribute.length() + buffer.readableBytes() > limitSize) { if (attribute.length() + buffer.readableBytes() > limitSize) {
@ -72,50 +73,62 @@ public class MixedAttribute implements Attribute {
attribute.addContent(buffer, last); attribute.addContent(buffer, last);
} }
@Override
public void delete() { public void delete() {
attribute.delete(); attribute.delete();
} }
@Override
public byte[] get() throws IOException { public byte[] get() throws IOException {
return attribute.get(); return attribute.get();
} }
@Override
public ByteBuf getByteBuf() throws IOException { public ByteBuf getByteBuf() throws IOException {
return attribute.getByteBuf(); return attribute.getByteBuf();
} }
@Override
public Charset getCharset() { public Charset getCharset() {
return attribute.getCharset(); return attribute.getCharset();
} }
@Override
public String getString() throws IOException { public String getString() throws IOException {
return attribute.getString(); return attribute.getString();
} }
@Override
public String getString(Charset encoding) throws IOException { public String getString(Charset encoding) throws IOException {
return attribute.getString(encoding); return attribute.getString(encoding);
} }
@Override
public boolean isCompleted() { public boolean isCompleted() {
return attribute.isCompleted(); return attribute.isCompleted();
} }
@Override
public boolean isInMemory() { public boolean isInMemory() {
return attribute.isInMemory(); return attribute.isInMemory();
} }
@Override
public long length() { public long length() {
return attribute.length(); return attribute.length();
} }
@Override
public boolean renameTo(File dest) throws IOException { public boolean renameTo(File dest) throws IOException {
return attribute.renameTo(dest); return attribute.renameTo(dest);
} }
@Override
public void setCharset(Charset charset) { public void setCharset(Charset charset) {
attribute.setCharset(charset); attribute.setCharset(charset);
} }
@Override
public void setContent(ByteBuf buffer) throws IOException { public void setContent(ByteBuf buffer) throws IOException {
if (buffer.readableBytes() > limitSize) { if (buffer.readableBytes() > limitSize) {
if (attribute instanceof MemoryAttribute) { if (attribute instanceof MemoryAttribute) {
@ -126,6 +139,7 @@ public class MixedAttribute implements Attribute {
attribute.setContent(buffer); attribute.setContent(buffer);
} }
@Override
public void setContent(File file) throws IOException { public void setContent(File file) throws IOException {
if (file.length() > limitSize) { if (file.length() > limitSize) {
if (attribute instanceof MemoryAttribute) { if (attribute instanceof MemoryAttribute) {
@ -136,6 +150,7 @@ public class MixedAttribute implements Attribute {
attribute.setContent(file); attribute.setContent(file);
} }
@Override
public void setContent(InputStream inputStream) throws IOException { public void setContent(InputStream inputStream) throws IOException {
if (attribute instanceof MemoryAttribute) { if (attribute instanceof MemoryAttribute) {
// change to Disk even if we don't know the size // change to Disk even if we don't know the size
@ -144,14 +159,17 @@ public class MixedAttribute implements Attribute {
attribute.setContent(inputStream); attribute.setContent(inputStream);
} }
@Override
public HttpDataType getHttpDataType() { public HttpDataType getHttpDataType() {
return attribute.getHttpDataType(); return attribute.getHttpDataType();
} }
@Override
public String getName() { public String getName() {
return attribute.getName(); return attribute.getName();
} }
@Override
public int compareTo(InterfaceHttpData o) { public int compareTo(InterfaceHttpData o) {
return attribute.compareTo(o); return attribute.compareTo(o);
} }
@ -161,18 +179,22 @@ public class MixedAttribute implements Attribute {
return "Mixed: " + attribute.toString(); return "Mixed: " + attribute.toString();
} }
@Override
public String getValue() throws IOException { public String getValue() throws IOException {
return attribute.getValue(); return attribute.getValue();
} }
@Override
public void setValue(String value) throws IOException { public void setValue(String value) throws IOException {
attribute.setValue(value); attribute.setValue(value);
} }
@Override
public ByteBuf getChunk(int length) throws IOException { public ByteBuf getChunk(int length) throws IOException {
return attribute.getChunk(length); return attribute.getChunk(length);
} }
@Override
public File getFile() throws IOException { public File getFile() throws IOException {
return attribute.getFile(); return attribute.getFile();
} }

View File

@ -46,6 +46,7 @@ public class MixedFileUpload implements FileUpload {
definedSize = size; definedSize = size;
} }
@Override
public void addContent(ByteBuf buffer, boolean last) public void addContent(ByteBuf buffer, boolean last)
throws IOException { throws IOException {
if (fileUpload instanceof MemoryFileUpload) { if (fileUpload instanceof MemoryFileUpload) {
@ -65,62 +66,77 @@ public class MixedFileUpload implements FileUpload {
fileUpload.addContent(buffer, last); fileUpload.addContent(buffer, last);
} }
@Override
public void delete() { public void delete() {
fileUpload.delete(); fileUpload.delete();
} }
@Override
public byte[] get() throws IOException { public byte[] get() throws IOException {
return fileUpload.get(); return fileUpload.get();
} }
@Override
public ByteBuf getByteBuf() throws IOException { public ByteBuf getByteBuf() throws IOException {
return fileUpload.getByteBuf(); return fileUpload.getByteBuf();
} }
@Override
public Charset getCharset() { public Charset getCharset() {
return fileUpload.getCharset(); return fileUpload.getCharset();
} }
@Override
public String getContentType() { public String getContentType() {
return fileUpload.getContentType(); return fileUpload.getContentType();
} }
@Override
public String getContentTransferEncoding() { public String getContentTransferEncoding() {
return fileUpload.getContentTransferEncoding(); return fileUpload.getContentTransferEncoding();
} }
@Override
public String getFilename() { public String getFilename() {
return fileUpload.getFilename(); return fileUpload.getFilename();
} }
@Override
public String getString() throws IOException { public String getString() throws IOException {
return fileUpload.getString(); return fileUpload.getString();
} }
@Override
public String getString(Charset encoding) throws IOException { public String getString(Charset encoding) throws IOException {
return fileUpload.getString(encoding); return fileUpload.getString(encoding);
} }
@Override
public boolean isCompleted() { public boolean isCompleted() {
return fileUpload.isCompleted(); return fileUpload.isCompleted();
} }
@Override
public boolean isInMemory() { public boolean isInMemory() {
return fileUpload.isInMemory(); return fileUpload.isInMemory();
} }
@Override
public long length() { public long length() {
return fileUpload.length(); return fileUpload.length();
} }
@Override
public boolean renameTo(File dest) throws IOException { public boolean renameTo(File dest) throws IOException {
return fileUpload.renameTo(dest); return fileUpload.renameTo(dest);
} }
@Override
public void setCharset(Charset charset) { public void setCharset(Charset charset) {
fileUpload.setCharset(charset); fileUpload.setCharset(charset);
} }
@Override
public void setContent(ByteBuf buffer) throws IOException { public void setContent(ByteBuf buffer) throws IOException {
if (buffer.readableBytes() > limitSize) { if (buffer.readableBytes() > limitSize) {
if (fileUpload instanceof MemoryFileUpload) { if (fileUpload instanceof MemoryFileUpload) {
@ -135,6 +151,7 @@ public class MixedFileUpload implements FileUpload {
fileUpload.setContent(buffer); fileUpload.setContent(buffer);
} }
@Override
public void setContent(File file) throws IOException { public void setContent(File file) throws IOException {
if (file.length() > limitSize) { if (file.length() > limitSize) {
if (fileUpload instanceof MemoryFileUpload) { if (fileUpload instanceof MemoryFileUpload) {
@ -149,6 +166,7 @@ public class MixedFileUpload implements FileUpload {
fileUpload.setContent(file); fileUpload.setContent(file);
} }
@Override
public void setContent(InputStream inputStream) throws IOException { public void setContent(InputStream inputStream) throws IOException {
if (fileUpload instanceof MemoryFileUpload) { if (fileUpload instanceof MemoryFileUpload) {
// change to Disk // change to Disk
@ -161,26 +179,32 @@ public class MixedFileUpload implements FileUpload {
fileUpload.setContent(inputStream); fileUpload.setContent(inputStream);
} }
@Override
public void setContentType(String contentType) { public void setContentType(String contentType) {
fileUpload.setContentType(contentType); fileUpload.setContentType(contentType);
} }
@Override
public void setContentTransferEncoding(String contentTransferEncoding) { public void setContentTransferEncoding(String contentTransferEncoding) {
fileUpload.setContentTransferEncoding(contentTransferEncoding); fileUpload.setContentTransferEncoding(contentTransferEncoding);
} }
@Override
public void setFilename(String filename) { public void setFilename(String filename) {
fileUpload.setFilename(filename); fileUpload.setFilename(filename);
} }
@Override
public HttpDataType getHttpDataType() { public HttpDataType getHttpDataType() {
return fileUpload.getHttpDataType(); return fileUpload.getHttpDataType();
} }
@Override
public String getName() { public String getName() {
return fileUpload.getName(); return fileUpload.getName();
} }
@Override
public int compareTo(InterfaceHttpData o) { public int compareTo(InterfaceHttpData o) {
return fileUpload.compareTo(o); return fileUpload.compareTo(o);
} }
@ -190,10 +214,12 @@ public class MixedFileUpload implements FileUpload {
return "Mixed: " + fileUpload.toString(); return "Mixed: " + fileUpload.toString();
} }
@Override
public ByteBuf getChunk(int length) throws IOException { public ByteBuf getChunk(int length) throws IOException {
return fileUpload.getChunk(length); return fileUpload.getChunk(length);
} }
@Override
public File getFile() throws IOException { public File getFile() throws IOException {
return fileUpload.getFile(); return fileUpload.getFile();
} }