Java Code Examples for mil.nga.geopackage.io.GeoPackageIOUtils#fileBytes()

The following examples show how to use mil.nga.geopackage.io.GeoPackageIOUtils#fileBytes() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: FeatureStylesUtils.java    From geopackage-java with MIT License 5 votes vote down vote up
private static IconRow randomIcon() throws IOException {
	IconRow iconRow = new IconRow();

	File iconImageFile = TestUtils
			.getTestFile(TestConstants.ICON_POINT_IMAGE);
	byte[] iconBytes = GeoPackageIOUtils.fileBytes(iconImageFile);
	BufferedImage iconImage = ImageUtils.getImage(iconBytes);

	iconRow.setData(iconBytes);
	iconRow.setContentType(
			"image/" + TestConstants.ICON_POINT_IMAGE_EXTENSION);
	if (Math.random() < .5) {
		iconRow.setName("Icon Name");
	}
	if (Math.random() < .5) {
		iconRow.setDescription("Icon Description");
	}
	if (Math.random() < .5) {
		iconRow.setWidth(Math.random() * iconImage.getWidth());
	}
	if (Math.random() < .5) {
		iconRow.setHeight(Math.random() * iconImage.getHeight());
	}
	if (Math.random() < .5) {
		iconRow.setAnchorU(Math.random());
	}
	if (Math.random() < .5) {
		iconRow.setAnchorV(Math.random());
	}

	return iconRow;
}
 
Example 2
Source File: TestUtils.java    From geopackage-java with MIT License 5 votes vote down vote up
/**
 * Get the tile file bytes
 * 
 * @return file bytes
 */
public static byte[] getTileBytes() {
	try {
		return GeoPackageIOUtils.fileBytes(getTileFile());
	} catch (IOException e) {
		throw new GeoPackageException("Failed to get tile bytes", e);
	}
}
 
Example 3
Source File: TestUtils.java    From geopackage-java with MIT License 5 votes vote down vote up
/**
 * Get the bytes of the file
 * 
 * @param fileName
 *            file name
 * @return file bytes
 */
public static byte[] getTestFileBytes(String fileName) {
	try {
		return GeoPackageIOUtils.fileBytes(getTestFile(fileName));
	} catch (IOException e) {
		throw new GeoPackageException("Failed to get test file bytes", e);
	}
}