All Downloads are FREE. Search and download functionalities are using the official Maven repository.

loci.poi.hpsf.MutableProperty Maven / Gradle / Ivy

Go to download

Java API to handle Microsoft OLE 2 Compound Document format (Word, Excel). Based on poi-2.5.1-final-20040804.jar, with bugfixes for OLE v2 and memory efficiency improvements. Used by Bio-Formats for OLE support (cxd, ipw, oib, zvi). Used by VisBio overlays logic for XLS export feature.

There is a newer version: 5.3.9
Show newest version
/*
 * #%L
 * Fork of Apache Jakarta POI.
 * %%
 * Copyright (C) 2008 - 2016 Open Microscopy Environment:
 *   - Board of Regents of the University of Wisconsin-Madison
 *   - Glencoe Software, Inc.
 *   - University of Dundee
 * %%
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * 
 *      http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 * #L%
 */

/* ====================================================================
   Licensed to the Apache Software Foundation (ASF) under one or more
   contributor license agreements.  See the NOTICE file distributed with
   this work for additional information regarding copyright ownership.
   The ASF licenses this file to You under the Apache License, Version 2.0
   (the "License"); you may not use this file except in compliance with
   the License.  You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

   Unless required by applicable law or agreed to in writing, software
   distributed under the License is distributed on an "AS IS" BASIS,
   WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
   See the License for the specific language governing permissions and
   limitations under the License.
==================================================================== */
        
package loci.poi.hpsf;

import java.io.IOException;
import java.io.OutputStream;

/**
 * 

Adds writing capability to the {@link Property} class.

* *

Please be aware that this class' functionality will be merged into the * {@link Property} class at a later time, so the API will change.

* * @author Rainer Klute <[email protected]> * @since 2003-08-03 * @version $Id: MutableProperty.java 489730 2006-12-22 19:18:16Z bayard $ */ public class MutableProperty extends Property { /** *

Creates an empty property. It must be filled using the set method to * be usable.

*/ public MutableProperty() { } /** *

Creates a MutableProperty as a copy of an existing * Property.

* * @param p The property to copy. */ public MutableProperty(final Property p) { setID(p.getID()); setType(p.getType()); setValue(p.getValue()); } /** *

Sets the property's ID.

* * @param id the ID */ public void setID(final long id) { this.id = id; } /** *

Sets the property's type.

* * @param type the property's type */ public void setType(final long type) { this.type = type; } /** *

Sets the property's value.

* * @param value the property's value */ public void setValue(final Object value) { this.value = value; } /** *

Writes the property to an output stream.

* * @param out The output stream to write to. * @param codepage The codepage to use for writing non-wide strings * @return the number of bytes written to the stream * * @exception IOException if an I/O error occurs * @exception WritingNotSupportedException if a variant type is to be * written that is not yet supported */ public int write(final OutputStream out, final int codepage) throws IOException, WritingNotSupportedException { int length = 0; long variantType = getType(); /* Ensure that wide strings are written if the codepage is Unicode. */ if (codepage == Constants.CP_UNICODE && variantType == Variant.VT_LPSTR) variantType = Variant.VT_LPWSTR; length += TypeWriter.writeUIntToStream(out, variantType); length += VariantSupport.write(out, variantType, getValue(), codepage); return length; } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy