本文整理汇总了Java中org.apache.sanselan.common.byteSources.ByteSource.getInputStream方法的典型用法代码示例。如果您正苦于以下问题:Java ByteSource.getInputStream方法的具体用法?Java ByteSource.getInputStream怎么用?Java ByteSource.getInputStream使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类org.apache.sanselan.common.byteSources.ByteSource
的用法示例。
在下文中一共展示了ByteSource.getInputStream方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: readTiffHeader
import org.apache.sanselan.common.byteSources.ByteSource; //导入方法依赖的package包/类
private TiffHeader readTiffHeader(ByteSource byteSource,
FormatCompliance formatCompliance) throws ImageReadException,
IOException
{
InputStream is = null;
try
{
is = byteSource.getInputStream();
return readTiffHeader(is, formatCompliance);
} finally
{
try
{
if (is != null)
is.close();
} catch (Exception e)
{
Debug.debug(e);
}
}
}
示例2: readHeader
import org.apache.sanselan.common.byteSources.ByteSource; //导入方法依赖的package包/类
private GIFHeaderInfo readHeader(ByteSource byteSource)
throws ImageReadException, IOException
{
InputStream is = null;
try
{
is = byteSource.getInputStream();
return readHeader(is, FormatCompliance.getDefault());
} finally
{
try
{
if (is != null) {
is.close();
}
} catch (Exception e)
{
Debug.debug(e);
}
}
}
示例3: readBmpHeaderInfo
import org.apache.sanselan.common.byteSources.ByteSource; //导入方法依赖的package包/类
private BmpHeaderInfo readBmpHeaderInfo(ByteSource byteSource,
boolean verbose) throws ImageReadException, IOException
{
InputStream is = null;
try
{
is = byteSource.getInputStream();
// readSignature(is);
return readBmpHeaderInfo(is, null, verbose);
} finally
{
try
{
if (is != null) {
is.close();
}
} catch (Exception e)
{
Debug.debug(e);
}
}
}
示例4: readHeader
import org.apache.sanselan.common.byteSources.ByteSource; //导入方法依赖的package包/类
private FileInfo readHeader(ByteSource byteSource)
throws ImageReadException, IOException
{
InputStream is = null;
try
{
is = byteSource.getInputStream();
return readHeader(is);
} finally
{
try
{
if (is != null) {
is.close();
}
} catch (Exception e)
{
Debug.debug(e);
}
}
}
示例5: readHeader
import org.apache.sanselan.common.byteSources.ByteSource; //导入方法依赖的package包/类
private PSDHeaderInfo readHeader(ByteSource byteSource)
throws ImageReadException, IOException
{
InputStream is = null;
try
{
is = byteSource.getInputStream();
return readHeader(is);
} finally
{
try
{
if (is != null) {
is.close();
}
} catch (Exception e)
{
Debug.debug(e);
}
}
}
示例6: readImageContents
import org.apache.sanselan.common.byteSources.ByteSource; //导入方法依赖的package包/类
private ImageContents readImageContents(ByteSource byteSource)
throws ImageReadException, IOException
{
InputStream is = null;
try
{
is = byteSource.getInputStream();
ImageContents imageContents = readImageContents(is);
return imageContents;
} finally
{
try
{
if (is != null) {
is.close();
}
} catch (Exception e)
{
Debug.debug(e);
}
}
}
示例7: readTiffHeader
import org.apache.sanselan.common.byteSources.ByteSource; //导入方法依赖的package包/类
private TiffHeader readTiffHeader(ByteSource byteSource,
FormatCompliance formatCompliance) throws ImageReadException,
IOException
{
InputStream is = null;
try
{
is = byteSource.getInputStream();
return readTiffHeader(is, formatCompliance);
} finally
{
try
{
if (is != null)
is.close();
} catch (Exception e)
{
Debug.debug(e);
}
}
}
示例8: hasChuckType
import org.apache.sanselan.common.byteSources.ByteSource; //导入方法依赖的package包/类
public boolean hasChuckType(ByteSource byteSource, int chunkType) throws ImageReadException, IOException
{
InputStream is = null;
try
{
is = byteSource.getInputStream();
ArrayList chunks = null;
readSignature(is);
chunks = readChunks(is, new int[] { chunkType, }, true);
return chunks.size() > 0;
} finally
{
try
{
if (is != null) {
is.close();
}
} catch (Exception e)
{
Debug.debug(e);
}
}
}
示例9: readImage
import org.apache.sanselan.common.byteSources.ByteSource; //导入方法依赖的package包/类
private IcnsContents readImage(ByteSource byteSource)
throws ImageReadException, IOException
{
InputStream is = null;
try
{
is = byteSource.getInputStream();
IcnsHeader icnsHeader = readIcnsHeader(is);
ArrayList icnsElementList = new ArrayList();
for (int remainingSize = icnsHeader.fileSize - 8;
remainingSize > 0; )
{
IcnsElement icnsElement = readIcnsElement(is);
icnsElementList.add(icnsElement);
remainingSize -= icnsElement.elementSize;
}
IcnsElement[] icnsElements = new IcnsElement[icnsElementList.size()];
for (int i = 0; i < icnsElements.length; i++)
icnsElements[i] = (IcnsElement) icnsElementList.get(i);
return new IcnsContents(icnsHeader, icnsElements);
}
finally
{
try
{
is.close();
}
catch (Exception e)
{
Debug.debug(e);
}
}
}
示例10: readFile
import org.apache.sanselan.common.byteSources.ByteSource; //导入方法依赖的package包/类
private ImageContents readFile(ByteSource byteSource,
boolean stopBeforeImageData, FormatCompliance formatCompliance)
throws ImageReadException, IOException
{
InputStream is = null;
try
{
is = byteSource.getInputStream();
GIFHeaderInfo ghi = readHeader(is, formatCompliance);
byte globalColorTable[] = null;
if (ghi.globalColorTableFlag)
globalColorTable = readColorTable(is,
ghi.sizeOfGlobalColorTable, formatCompliance);
ArrayList blocks = readBlocks(ghi, is, stopBeforeImageData,
formatCompliance);
ImageContents result = new ImageContents(ghi, globalColorTable,
blocks);
return result;
} finally
{
try
{
if (is != null) {
is.close();
}
} catch (Exception e)
{
Debug.debug(e);
}
}
}
示例11: 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);
}
}
}
示例12: getBufferedImage
import org.apache.sanselan.common.byteSources.ByteSource; //导入方法依赖的package包/类
public BufferedImage getBufferedImage(ByteSource byteSource, Map params)
throws ImageReadException, IOException
{
InputStream is = null;
try
{
is = byteSource.getInputStream();
FileInfo info = readHeader(is);
int width = info.width;
int height = info.height;
boolean hasAlpha = false;
BufferedImage result = getBufferedImageFactory(params)
.getColorBufferedImage(width, height, hasAlpha);
info.readImage(result, is);
return result;
} finally
{
try
{
if (is != null) {
is.close();
}
} catch (Exception e)
{
Debug.debug(e);
}
}
}
示例13: readImageResourceBlocks
import org.apache.sanselan.common.byteSources.ByteSource; //导入方法依赖的package包/类
private ArrayList readImageResourceBlocks(ByteSource byteSource,
int imageResourceIDs[], int maxBlocksToRead)
throws ImageReadException, IOException
{
InputStream is = null;
try
{
is = byteSource.getInputStream();
ImageContents imageContents = readImageContents(is);
is.close();
is = this.getInputStream(byteSource, PSD_SECTION_IMAGE_RESOURCES);
byte ImageResources[] = readByteArray("ImageResources",
imageContents.ImageResourcesLength, is,
"Not a Valid PSD File");
return readImageResourceBlocks(ImageResources, imageResourceIDs,
maxBlocksToRead);
} finally
{
try
{
if (is != null) {
is.close();
}
} catch (Exception e)
{
Debug.debug(e);
}
}
}
示例14: readChunks
import org.apache.sanselan.common.byteSources.ByteSource; //导入方法依赖的package包/类
private ArrayList readChunks(ByteSource byteSource, int chunkTypes[],
boolean returnAfterFirst) throws ImageReadException, IOException
{
InputStream is = null;
try
{
is = byteSource.getInputStream();
ArrayList chunks = null;
readSignature(is);
chunks = readChunks(is, chunkTypes, returnAfterFirst);
return chunks;
} finally
{
try
{
if (is != null) {
is.close();
}
} catch (Exception e)
{
Debug.debug(e);
}
}
}
示例15: traverseJFIF
import org.apache.sanselan.common.byteSources.ByteSource; //导入方法依赖的package包/类
public void traverseJFIF(ByteSource byteSource, Visitor visitor)
throws ImageReadException,
// ImageWriteException,
IOException
{
InputStream is = null;
boolean doClose = true;
try
{
is = byteSource.getInputStream();
readAndVerifyBytes(is, SOI,
"Not a Valid JPEG File: doesn't begin with 0xffd8");
int byteOrder = getByteOrder();
for (int markerCount = 0; true; markerCount++)
{
byte markerBytes[] = readByteArray("markerBytes", 2, is,
"markerBytes");
int marker = convertByteArrayToShort("marker", markerBytes,
byteOrder);
// Debug.debug("marker", marker + " (0x" + Integer.toHexString(marker) + ")");
// Debug.debug("markerBytes", markerBytes);
if (marker == 0xffd9 || marker == SOS_Marker)
{
if (!visitor.beginSOS())
return;
//commented out the code below. imageData could become waaay
//too large for mobile device.
//byte imageData[] = getStreamBytes(is);
//
doClose = !visitor.visitSOS(marker, markerBytes, is);
//
break;
}
byte segmentLengthBytes[] = readByteArray("segmentLengthBytes",
2, is, "segmentLengthBytes");
int segmentLength = convertByteArrayToShort("segmentLength",
segmentLengthBytes, byteOrder);
// Debug.debug("segmentLength", segmentLength + " (0x" + Integer.toHexString(segmentLength) + ")");
// Debug.debug("segmentLengthBytes", segmentLengthBytes);
byte segmentData[] = readByteArray("Segment Data",
segmentLength - 2, is,
"Invalid Segment: insufficient data");
// Debug.debug("segmentLength", segmentLength);
if (!visitor.visitSegment(marker, markerBytes, segmentLength,
segmentLengthBytes, segmentData))
return;
}
} finally
{
try
{
if (is != null && doClose)
is.close();
} catch (Exception e)
{
Debug.debug(e);
}
}
}