本文整理汇总了Java中org.apache.sanselan.common.byteSources.ByteSource.getBlock方法的典型用法代码示例。如果您正苦于以下问题:Java ByteSource.getBlock方法的具体用法?Java ByteSource.getBlock怎么用?Java ByteSource.getBlock使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.sanselan.common.byteSources.ByteSource
的用法示例。
在下文中一共展示了ByteSource.getBlock方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: collectRawImageData
import org.apache.sanselan.common.byteSources.ByteSource; //导入方法依赖的package包/类
public List collectRawImageData(ByteSource byteSource, Map params)
throws ImageReadException, IOException
{
FormatCompliance formatCompliance = FormatCompliance.getDefault();
TiffContents contents = new TiffReader(isStrict(params))
.readDirectories(byteSource, true, formatCompliance);
List result = new ArrayList();
for (int i = 0; i < contents.directories.size(); i++)
{
TiffDirectory directory = (TiffDirectory) contents.directories
.get(i);
List dataElements = directory.getTiffRawImageDataElements();
for (int j = 0; j < dataElements.size(); j++)
{
TiffDirectory.ImageDataElement element = (TiffDirectory.ImageDataElement) dataElements
.get(j);
byte bytes[] = byteSource.getBlock(element.offset,
element.length);
result.add(bytes);
}
}
return result;
}
示例2: fillInValue
import org.apache.sanselan.common.byteSources.ByteSource; //导入方法依赖的package包/类
public void fillInValue(ByteSource byteSource) throws ImageReadException,
IOException
{
if (fieldType.isLocalValue(this))
return;
int valueLength = getValueLengthInBytes();
// Debug.debug("fillInValue tag", tag);
// Debug.debug("fillInValue tagInfo", tagInfo);
// Debug.debug("fillInValue valueOffset", valueOffset);
// Debug.debug("fillInValue valueLength", valueLength);
byte bytes[] = byteSource.getBlock(valueOffset, valueLength);
setOversizeValue(bytes);
}
示例3: collectRawImageData
import org.apache.sanselan.common.byteSources.ByteSource; //导入方法依赖的package包/类
public List collectRawImageData(ByteSource byteSource, Map params)
throws ImageReadException, IOException
{
FormatCompliance formatCompliance = FormatCompliance.getDefault();
TiffContents contents = new TiffReader(isStrict(params))
.readDirectories(byteSource, true, formatCompliance);
List result = new ArrayList();
for (int i = 0; i < contents.directories.size(); i++)
{
TiffDirectory directory = (TiffDirectory) contents.directories
.get(i);
List dataElements = directory.getTiffRawImageDataElements();
for (int j = 0; j < dataElements.size(); j++)
{
TiffDirectory.ImageDataElement element = (TiffDirectory.ImageDataElement) dataElements
.get(j);
byte bytes[] = byteSource.getBlock(element.offset,
element.length);
result.add(bytes);
}
}
return result;
}
示例4: fillInValue
import org.apache.sanselan.common.byteSources.ByteSource; //导入方法依赖的package包/类
public void fillInValue(ByteSource byteSource) throws ImageReadException,
IOException
{
if (fieldType.isLocalValue(this))
return;
int valueLength = getValueLengthInBytes();
// Debug.debug("fillInValue tag", tag);
// Debug.debug("fillInValue tagInfo", tagInfo);
// Debug.debug("fillInValue valueOffset", valueOffset);
// Debug.debug("fillInValue valueLength", valueLength);
byte bytes[] = byteSource.getBlock(valueOffset, valueLength);
setOversizeValue(bytes);
}
示例5: getJpegRawImageData
import org.apache.sanselan.common.byteSources.ByteSource; //导入方法依赖的package包/类
private JpegImageData getJpegRawImageData(ByteSource byteSource,
TiffDirectory directory) throws ImageReadException, IOException
{
ImageDataElement element = directory.getJpegRawImageDataElement();
int offset = element.offset;
int length = element.length;
// Sony DCR-PC110 has an off-by-one error.
if (offset + length == byteSource.getLength() + 1)
length--;
byte data[] = byteSource.getBlock(offset, length);
return new JpegImageData(offset, length, data);
}
示例6: dumpElements
import org.apache.sanselan.common.byteSources.ByteSource; //导入方法依赖的package包/类
private void dumpElements(ByteSource byteSource, List elements)
throws IOException
{
int last = TIFF_HEADER_SIZE;
for (int i = 0; i < elements.size(); i++)
{
TiffElement element = (TiffElement) elements.get(i);
if (element.offset > last)
{
final int SLICE_SIZE = 32;
int gepLength = element.offset - last;
Debug.debug("gap of " + gepLength + " bytes.");
byte bytes[] = byteSource.getBlock(last, gepLength);
if (bytes.length > 2 * SLICE_SIZE)
{
Debug.debug("\t" + "head", BinaryFileFunctions.head(bytes,
SLICE_SIZE));
Debug.debug("\t" + "tail", BinaryFileFunctions.tail(bytes,
SLICE_SIZE));
}
else
Debug.debug("\t" + "bytes", bytes);
}
Debug.debug("element[" + i + "]:" + element.getElementDescription()
+ " (" + element.offset + " + " + element.length + " = "
+ (element.offset + element.length) + ")");
if (element instanceof TiffDirectory)
{
TiffDirectory dir = (TiffDirectory) element;
Debug.debug("\t" + "next Directory Offset: "
+ dir.nextDirectoryOffset);
}
last = element.offset + element.length;
}
Debug.debug();
}
示例7: readImage
import org.apache.sanselan.common.byteSources.ByteSource; //导入方法依赖的package包/类
private ImageContents readImage(ByteSource byteSource)
throws ImageReadException, IOException
{
InputStream is = null;
try
{
is = byteSource.getInputStream();
FileHeader fileHeader = readFileHeader(is);
IconInfo fIconInfos[] = new IconInfo[fileHeader.iconCount];
for (int i = 0; i < fileHeader.iconCount; i++)
{
fIconInfos[i] = readIconInfo(is);
}
IconData fIconDatas[] = new IconData[fileHeader.iconCount];
for (int i = 0; i < fileHeader.iconCount; i++)
{
byte[] iconData = byteSource.getBlock(fIconInfos[i].ImageOffset,
fIconInfos[i].ImageSize);
fIconDatas[i] = readIconData(iconData, fIconInfos[i]);
}
return new ImageContents(fileHeader, fIconDatas);
}
finally
{
try
{
if (is != null) {
is.close();
}
}
catch (Exception e)
{
Debug.debug(e);
}
}
}
示例8: getTiffRawImageData
import org.apache.sanselan.common.byteSources.ByteSource; //导入方法依赖的package包/类
private TiffImageData getTiffRawImageData(ByteSource byteSource,
TiffDirectory directory) throws ImageReadException, IOException
{
ArrayList elements = directory.getTiffRawImageDataElements();
TiffImageData.Data data[] = new TiffImageData.Data[elements.size()];
for (int i = 0; i < elements.size(); i++)
{
TiffDirectory.ImageDataElement element = (TiffDirectory.ImageDataElement) elements
.get(i);
byte bytes[] = byteSource.getBlock(element.offset, element.length);
data[i] = new TiffImageData.Data(element.offset, element.length,
bytes);
}
if (directory.imageDataInStrips())
{
TiffField rowsPerStripField = directory
.findField(TIFF_TAG_ROWS_PER_STRIP);
if (null == rowsPerStripField)
throw new ImageReadException("Can't find rows per strip field.");
int rowsPerStrip = rowsPerStripField.getIntValue();
return new TiffImageData.Strips(data, rowsPerStrip);
} else
{
TiffField tileWidthField = directory.findField(TIFF_TAG_TILE_WIDTH);
if (null == tileWidthField)
throw new ImageReadException("Can't find tile width field.");
int tileWidth = tileWidthField.getIntValue();
TiffField tileLengthField = directory
.findField(TIFF_TAG_TILE_LENGTH);
if (null == tileLengthField)
throw new ImageReadException("Can't find tile length field.");
int tileLength = tileLengthField.getIntValue();
return new TiffImageData.Tiles(data, tileWidth, tileLength);
}
}
示例9: getJpegRawImageData
import org.apache.sanselan.common.byteSources.ByteSource; //导入方法依赖的package包/类
private JpegImageData getJpegRawImageData(ByteSource byteSource,
TiffDirectory directory) throws ImageReadException, IOException
{
ImageDataElement element = directory.getJpegRawImageDataElement();
int offset = element.offset;
int length = element.length;
// Sony DCR-PC110 has an off-by-one error.
if (offset + length == byteSource.getLength() + 1)
length--;
byte data[] = byteSource.getBlock(offset, length);
return new JpegImageData(offset, length, data);
}
示例10: dumpElements
import org.apache.sanselan.common.byteSources.ByteSource; //导入方法依赖的package包/类
private void dumpElements(ByteSource byteSource, List elements)
throws IOException
{
int last = TIFF_HEADER_SIZE;
for (int i = 0; i < elements.size(); i++)
{
TiffElement element = (TiffElement) elements.get(i);
if (element.offset > last)
{
final int SLICE_SIZE = 32;
int gepLength = element.offset - last;
Debug.debug("gap of " + gepLength + " bytes.");
byte bytes[] = byteSource.getBlock(last, gepLength);
if (bytes.length > 2 * SLICE_SIZE)
{
Debug.debug("\t" + "head", BinaryFileFunctions.head(bytes,
SLICE_SIZE));
Debug.debug("\t" + "tail", BinaryFileFunctions.tail(bytes,
SLICE_SIZE));
}
else
Debug.debug("\t" + "bytes", bytes);
}
Debug.debug("element[" + i + "]:" + element.getElementDescription()
+ " (" + element.offset + " + " + element.length + " = "
+ (element.offset + element.length) + ")");
if (element instanceof TiffDirectory)
{
TiffDirectory dir = (TiffDirectory) element;
Debug.debug("\t" + "next Directory Offset: "
+ dir.nextDirectoryOffset);
}
last = element.offset + element.length;
}
Debug.debug();
}