@Override public Iterable<Payload> slice(Payload input, long size) { checkNotNull(input, "input"); checkArgument(size >= 0, "size must be non-negative but was: %s", size); ContentMetadata meta = BaseMutableContentMetadata.fromContentMetadata(input.getContentMetadata()) .toBuilder() .contentLength(size) .contentMD5(null) .build(); Object rawContent = input.getRawContent(); if (rawContent instanceof File) { return doSlice((File) rawContent, meta); } else if (rawContent instanceof String) { return doSlice((String) rawContent, meta); } else if (rawContent instanceof byte[]) { return doSlice((byte[]) rawContent, meta); } else if (rawContent instanceof InputStream) { return doSlice((InputStream) rawContent, meta); } else { return doSlice(input, meta); } }
@Override public Iterable<Payload> slice(Payload input, long size) { checkNotNull(input, "input"); checkArgument(size >= 0, "size must be non-negative but was: %s", size); ContentMetadata meta = BaseMutableContentMetadata.fromContentMetadata(input.getContentMetadata()) .toBuilder() .contentLength(size) .contentMD5((HashCode) null) .build(); Object rawContent = input.getRawContent(); if (rawContent instanceof File) { return doSlice((File) rawContent, meta); } else if (rawContent instanceof String) { return doSlice((String) rawContent, meta); } else if (rawContent instanceof byte[]) { return doSlice((byte[]) rawContent, meta); } else if (rawContent instanceof InputStream) { return doSlice((InputStream) rawContent, meta); } else if (rawContent instanceof ByteSource) { return doSlice((ByteSource) rawContent, meta); } else { return doSlice(input, meta); } }
@Override public Iterable<Payload> slice(Payload input, long size) { checkNotNull(input, "input"); checkArgument(size >= 0, "size must be non-negative but was: %s", size); ContentMetadata meta = BaseMutableContentMetadata.fromContentMetadata(input.getContentMetadata()) .toBuilder() .contentLength(size) .contentMD5((HashCode) null) .build(); Object rawContent = input.getRawContent(); if (rawContent instanceof File) { return doSlice((File) rawContent, meta); } else if (rawContent instanceof String) { return doSlice((String) rawContent, meta); } else if (rawContent instanceof byte[]) { return doSlice((byte[]) rawContent, meta); } else if (rawContent instanceof InputStream) { return doSlice((InputStream) rawContent, meta); } else if (rawContent instanceof ByteSource) { return doSlice((ByteSource) rawContent, meta); } else { return doSlice(input, meta); } }
@Override public Iterable<Payload> slice(Payload input, long size) { checkNotNull(input, "input"); checkArgument(size >= 0, "size must be non-negative but was: %s", size); ContentMetadata meta = BaseMutableContentMetadata.fromContentMetadata(input.getContentMetadata()) .toBuilder() .contentLength(size) .contentMD5((HashCode) null) .build(); Object rawContent = input.getRawContent(); if (rawContent instanceof File) { return doSlice((File) rawContent, meta); } else if (rawContent instanceof String) { return doSlice((String) rawContent, meta); } else if (rawContent instanceof byte[]) { return doSlice((byte[]) rawContent, meta); } else if (rawContent instanceof InputStream) { return doSlice((InputStream) rawContent, meta); } else if (rawContent instanceof ByteSource) { return doSlice((ByteSource) rawContent, meta); } else { return doSlice(input, meta); } }