Java 8 ImageOutputStream - top ranked examples from Open Source projects

These code examples were ranked by Codota’s semantic indexing as the best open source examples for Java 8 ImageOutputStream class.

This code example shows how to use the following methods:writeBytes
    } 
 
    @Override 
    protected void writeFields17To21(final ImageOutputStream ios) throws IOException {
        // Field 17 
        ios.writeBytes("                "); // 16 blanks
        // Field 18 
        ios.writeBytes("     3");
        ios.writeBytes("   541");
        ios.writeBytes(" 32");
        ios.writeBytes("N");
        // Field 19 
        ios.writeBytes("                "); // 16 blanks
        // Field 20 
        ios.writeBytes("                "); // 16 blanks
 
        // Field 21 
        final char[] blanks = new char[4256];
        Arrays.fill(blanks, ' ');
        ios.writeBytes(new String(blanks));

6
CodeRank
This code example shows how to use the following methods:writeBytes
        return new Avnir2ImageFDR(reader, startPos);
    } 
 
    @Override 
    protected void writeBytes341To392(final ImageOutputStream ios) throws IOException {
        ios.writeBytes("   112SB"); // locatorDummyPixel
        ios.writeBytes("  13 8SB"); // locatorOpticalBlack
        ios.writeBytes("  2116SB"); // locatorOpticalWhite
        ios.writeBytes("  3716SB"); // locatorElectricalCalibration
        ios.writeBytes("  5312SB"); // locatorImageAuxiliaryData
        ios.writeBytes("  65 2SB"); // locatorQualityInformation
        CeosTestHelper.writeBlanks(ios, 4);
    } 
 
    @Override 
    protected void assertBytes341To392(final BaseImageFileDescriptorRecord record) {
        final Avnir2ImageFDR avnir2ImageFDR = (Avnir2ImageFDR) record;
 
        assertEquals("   112SB", avnir2ImageFDR.getLocatorDummyPixel());
        assertEquals("  13 8SB", avnir2ImageFDR.getLocatorOpticalBlack());
6
CodeRank
This code example shows how to use the following methods:write, writeInt
        assertEquals(021, record.getThirdRecordSubtype());
        assertEquals(RECORD_LENGTH, record.getRecordLength());
    } 
 
    public static void writeRecordData(final ImageOutputStream ios) throws IOException {
        ios.writeInt(1); // recordNumber = 1
        ios.write(077); // firstRecordSubtype = 77 octal
        ios.write(0300); // recordTypeCode = 300 octal
        ios.write(022); // secondRecordSubtype = 22 octal
        ios.write(021); // thirdRecordSubtype = 22 octal (21 octal only for test)
        ios.writeInt(RECORD_LENGTH); // recordLength = variable
    } 
 
    public void testCreateMetadataElement() { 
        MetadataElement elem;
        String suffix;
 
        suffix = "suffix";
        elem = BaseRecord.createMetadataElement("name", suffix);
        assertNotNull(elem);
6
CodeRank
This code example shows how to use the following methods:getStreamPosition, writeBytes
public class CommonFileDescriptorRecordTest extends TestCase {
 
    public void testInitCommonFileDescriptorRecord() throws IOException,
                                                            IllegalCeosFormatException { 
        final ByteArrayOutputStream os = new ByteArrayOutputStream(24);
        final ImageOutputStream ios = new MemoryCacheImageOutputStream(os);
        final String prefix = "fdkjglsdkfhierr.m b9b0970w34";
        ios.writeBytes(prefix);
        writeRecordData(ios);
        ios.writeBytes("nq3tf9ß8nvnvpdi er 0 324p3f"); // as suffix
 
        final CommonFileDescriptorRecord record = new CommonFileDescriptorRecord(new CeosFileReader(ios),
                                                                                 prefix.length());
 
        assertRecord(record);
        assertEquals(prefix.length(), record.getStartPos());
        assertEquals(prefix.length() + 180, ios.getStreamPosition());
    } 
 
    public static void assertRecord(final CommonFileDescriptorRecord record) {

6
CodeRank
This code example shows how to use the following methods:skipBytes, writeBytes
 
    private void writeRecordData(final ImageOutputStream ios) throws IOException {
        BaseRecordTest.writeRecordData(ios);
 
        // codeCharacter = "A" + 1 blank 
        ios.writeBytes("A "); // A2
        ios.skipBytes(2); // reader.skipBytes(2);  // blank
        // productID = "PRODUCT:ABBBCCDE" + 24 blanks 
        ios.writeBytes("PRODUCT:O1B2R_UB                        "); // A40
        // facility = "PROCESS:JAPAN-JAXA-EOC-ALOS-DPS  YYYYMMDDHHNNSS" + 13 blanks 
        ios.writeBytes("PROCESS:JAPAN-JAXA-EOC-ALOS-DPS  20060410075225             "); //A60
        // sceneID =  "ORBIT:AABBBCDDDDDEEEE" + 19 blanks 
        ios.writeBytes("ORBIT:ALPSMB003062950                   "); // A40
        // imageFormat = "BSQ" + 1 blank 
        ios.writeBytes("BSQ "); // A4
        // Blank = 200 blanks 
        CeosTestHelper.writeBlanks(ios, 200);
    } 
 
    private void assertRecord(final TextRecord record) throws IOException {
6
CodeRank
This code example shows how to use the following methods:close
			if (imageWriter != null) {
				imageWriter.dispose();
			} 
			if (imageOutputStream != null) {
				try { 
					imageOutputStream.close();
				} 
				catch (IOException ex) {
					// ignore 
				} 
			} 
		} 
	} 
 
	private ImageOutputStream createImageOutputStream(OutputStream os) throws IOException {
		if (this.cacheDir != null) {
			return new FileCacheImageOutputStream(os, this.cacheDir);
		} 
		else { 
			return new MemoryCacheImageOutputStream(os);
6
CodeRank
This code example shows how to use the following methods:writeBytes
    } 
 
    @Override 
    protected void writeBytes341To392(final ImageOutputStream ios) throws IOException {
        // Field 28 
        ios.writeBytes("   148SB"); // auxDataLocator
        // Field 29 
        ios.writeBytes("  4912SB"); // qualityInformationLocator
        // Field 30 
        ios.writeBytes("  61 4SB"); // extractionStartPointLocator
        CeosTestHelper.writeBlanks(ios, 28);
 
    } 
 
    @Override 
    protected void assertBytes341To392(final BaseImageFileDescriptorRecord record) {
        final ImageFileDescriptorRecord imageFileDescriptorRecord = (ImageFileDescriptorRecord) record;
 
        assertEquals("   148SB", imageFileDescriptorRecord.getLocatorAUXData());
        assertEquals("  4912SB", imageFileDescriptorRecord.getLocatorQualityInformation());
6
CodeRank
This code example shows how to use the following methods:close, flush
		if(LOGGER.isLoggable(Level.FINE))
			LOGGER.fine("Disposing writer:"+destination);
		 
		if (outStream != null) {
			try { 
				outStream.flush();			
 
			} catch (IOException e) {
 
			} 
			finally{ 
				try { 
					outStream.close();
				} catch (Throwable e) {
 
				} 
			} 
			 
			 
		} 
5
CodeRank
This code example shows how to use the following methods:flush, writeInts
This code example shows how to use the following methods:write, writeInt
    private void writeBox(IIOMetadataNode node) throws IOException {
        int type = Box.getTypeInt((String)Box.getAttribute(node, "Type"));
        int length = new Integer((String)Box.getAttribute(node, "Length")).intValue();
        Box box = Box.createBox(type, node);
        otherLength += length;
        stream.writeInt(length);
        stream.writeInt(type);
        byte[] data = box.getContent();
        stream.write(data, 0, data.length);
    } 
 
    private int computeLength(IIOMetadataNode root) {
        NodeList list = root.getChildNodes();
        int length = 0;
        for (int i = 0; i < list.getLength(); i++) {
            IIOMetadataNode node = (IIOMetadataNode)list.item(i);
            String name = node.getNodeName();
 
            if (format.isLeaf(name))
                length += new Integer((String)Box.getAttribute(node, "Length")).intValue();
5
CodeRank
See Code Examples for Java 8 ImageOutputStream Methods: