Copyright Message

I wish to add copyright information to my photos. I want to do this:
a) as part of the file metadata (I believe there is away to do this in full Photoshop)
b) As a text layer in the photo (embossed?, transparent?). I suspect I need a jpeg that I can add to the picture - but need help on how to do this effectively
How can I do these two things?

Hugh,
Here are some options for adding copyright to the metadata of your files:
- You can add the copyright automatically as you import photos using the Adobe Photo Downloader. In the downloader, click Advanced Dialog at the bottom, then under Apply Metadata on the right, select Template To Use: Basic Metadata. Then you can enter a value for Copyright.
If you use this option, however, beware that a bug in PSE 6 will prevent the downloader from correctly identifying duplicate files that it has already downloaded from your camera or card.
- In the Full Editor, you can add a copyright to individual files using the File > File Info command.
- You could get a third-party tool such as "exiftool" that will add copyright notices to a batch of files at once. I'm sure there are other tools that do this as well.

Similar Messages

  • TRYING TO CHANGE COPYRIGHT MESSAGE ON WEB PAGES.

    Trying to change the "Copyright 2006" message at the bottom of the AppsLocalLogin.jsp page. Have set FND_SSO_COPYRIGHT_TEXT and bounced the webserver, but the Copyright 2006 message still appears. Also tried setting FND_COPYRIGHT which has an identical message, but still the copyright message does not change. Has this changed for R12?

    Clear the Browser cache and re-try.
    Ovelooked R12 keyword. I guess it's the same in R12. A bounce and cache clear should work.
    Check the local login mask value.
    Edited by: bobcatalog aka 637332 on Oct 2, 2008 11:49 AM

  • Search by Copyright Field

    I am wondering if anyone knows a way to search images in my library by "Copyright" field (NOT "Copyright Status")
    I have all of my images "Copyrighted" under "Status" but want to search out all with a blank "Copyright" Field in order to enter the appropriate info.

    Try using the library filter by text search for any file that has EXIF data that doesn't contain your copyright message. For instance my filter reads:
    Text / Searchable EXIF / Doesn't Contain / 2009 David Diamante
    There are a lot of ways to break this filter but maybe it will work for you.
    Hope this helps!

  • How to run a java program without Java Compiler

    I have a small project and I want share it with my friends but my friend'pc have not
    Java compiler.
    for example, I writen a application like YM, then 2cp can sent,receive messege. My cumputer run as Server, and my frien PC run as client.
    How can my friend run it? or how to create an icon in dektop tu run a java program..??..
    (sorry about my English but U still understand what i mean (:-:)) )

    To run a program you don't need a Java compiler. Just the Java Runtime Engine. That can be downloaded from the Sun website and comes with an installer.
    You could then turn your application into an executable jar file and start it somehow like jar myYM.
    There is also software that packs a Java program into an executable file. I've never used that but one that comes to my mind is JexePack. It's for free if you can live with a copyright message popping up every time you start the program.
    http://www.duckware.com/jexepack/index.html

  • Has my Micro's Hard Drive fail

    Just today, my Zen Micro appears to have suffered hard dri've failure. When I turn the player on, it wil initially turn onto the creative start-up screen with the copyright message, and then proceed to just the creative logo, and then stay there, forever. I can enter recovery mode, and when I attempt a clean-up, format, or reload firmware, it goes to the first screen and then sits there, forever. Further, it does not make a typical hard dri've start up sound if you listen very closely, rather a strange undulating buzzing sound for about 5 seconds before going silent.
    As I mentioned, I presume this is hard dri've failure. Am I correct? Is there anything I can possibly do?
    Or am I at the point where I will need to find a new player? And if so, anyone want to buy a couple of batteries?
    Thanks.

    I am having the same problem, any information would be helpful

  • Reading emails sent from iPhones on Nokia N8 Belle

    My phone works well and receives "normal E mails" and attachements.
    However E mails sent from iPhones display the header and any attachements, photos or security/copyright message.
    My complaint is that the text of the message is missing. Once downloaded there is no option to refresh
    or download again. I do not remove messages from the server with the mobiles only with the PC.
    When message is fetched by a PC the text is there. It also arrives on my N900.
    I could not find mention of this in the discussions.. Thanks in anticipation.. Nokpiks

    @Murf1
    If you don't want to install what is offered, you can go to SW updates > tap on three horizontal line icon at bottom right of screen > Settings > Auto-check for updates = OFF
    You also need to temporarily turn off mobile data and restart to remove the notification.
    Happy to have helped forum with a Support Ratio = 42.5

  • Skip to content in JSF page

    I have developed a very simple JSF page and sometimes it doesn't get rendered properly instead it displays a link "Skip to Content" and gets refreshed infinitely and automatically. I don't find anything wrong in the code.
    Can you please let me know if this is a known issue and solution to this, if any.
    Thanks
    Raza

    I get this error intermittently. I have developed a very simple JSPX with two labels and two images. The page renders fine sometime but sometimes, it gets skewed, functionality doesn't work and the link "Skip to Content" displays on the top-left of page. My JSPX code is mentioned below
    Please help!
    Regards
    Raza
    <?xml version='1.0' encoding='UTF-8'?>
    <jsp:root xmlns:jsp="http://java.sun.com/JSP/Page" version="2.0"
    xmlns:h="http://java.sun.com/jsf/html"
    xmlns:f="http://java.sun.com/jsf/core"
    xmlns:af="http://xmlns.oracle.com/adf/faces/rich">
    <jsp:directive.page contentType="text/html;charset=UTF-8"/>
    <f:view>
    <af:document>
    <form action="j_security_check" method="POST">
    <af:panelFormLayout>
    <table valign="center" align="center" width="400px" height="255px"
    style="border-width:1px; border-color:Black; border-style:solid;">
    <tr>
    <td>
    <af:image source="http://localhost:8888/ContentServer/Logo.JPG"/>
    </td>
    </tr>
    <tr>
    <td style="color:Black; font-size:18pt; font-family:tahoma; font-weight:bold; text-align:left; vertical-align:middle;">
    <af:outputText value="Application Name"/>
    </td>
    </tr>
    <tr>
    <td>
    <input style="color:Black; font-size:8pt; font-family:tahoma; vertical-align:middle;"
    type="text" name="j_username" id="j_username"/>
    </td>
    </tr>
    <tr>
    <td>
    <input style="color:Black; font-size:8pt; font-family:tahoma; vertical-align:middle;"
    type="password" name="j_password" id="j_password"/>
    </td>
    </tr>
    <tr>
    <td>
    <input style="color:Black; font-size:8pt; font-family:tahoma; vertical-align:middle;"
    type="reset" name="Reset" value="Cancel"/>
    <input style="color:Black; font-size:8pt; font-family:tahoma; vertical-align:middle;"
    type="submit" name="Submit" value="Login"/>
    </td>
    </tr>
    <tr>
    <td>
    <af:image source="http://localhost:8888/ContentServer/Footer.JPG"/>
    </td>
    </tr>
    <tr>
    <td style="color:Black; font-size:8pt; font-family:tahoma; vertical-align:middle; text-align:justify;">
    <af:outputText value="Copyright Message"/>
    </td>
    </tr>
    </table>
    </af:panelFormLayout>
    </form>
    </af:document>
    </f:view>
    </jsp:root>

  • Protect class Files from Decryption?

    Hey. I have a couple of Java classes I wish to share with some people, but I would like to add a copyright/credit giving message into the program. This code is the kind of code people would want to steal and take credit for, which is why I'm only (if I can encrypt them) giving out the .class files and not the source code. The thing is, it took me about 5 seconds of searching on Google to find programs that can easily be used to decrypt .class files and get a re-compilable source from them.
    So I was wondering, is there a [somewhat] foolproof way to protect against people decrypting the .class files to get the source? Is there some program I can run them through that will make it so they can't be decompiled, but will still run on a machine with a standard Java runtime installed? I probably won't be giving out the classes if there isn't a way to do this.
    Thanks

    There are programs out their that semi pseudo scramble your code but if someone wanted to they can always reverse it and have a look at your source. What you have to admit is that your code is nothing special and nobody would really want to steal your code. If you are paranoid about it, about the most you can do is add some copyright message and threaten them with legal action.

  • Solaris 10 b69 on VIA EPIA motherboards?

    Has anyone had success in getting Solaris 10 beta69 to boot on VIA EPIA (C3 CPU-based) motherboards?
    I've got two mini-ITX systems here built around VIA EPIA M10000 motherboards (C3 @ 1Ghz). One has 1G RAM, one has 256M. Both have Hitachi/IBM 80G IDE hard drives and generic CD-ROM drives.
    On both systems, S10 starts to boot, but hangs (permanently; I've let it sit overnight) right after the kernel spits out the copyright message and version.
    Any suggestions?

    Hi,
    I get the same behaviour with a Via CM266 motherboard with C3 1Ghz Ezra CPU. 768M of memory, using third party rh driver since b7 doesn't support Rhine natively.
    Using the -v option I get to either loading the mmu32 module or just after the copyright lines and then the box hang's solid.
    The first week I was working with b7 I was able to boot about 1/3 of the time and the box ran GREAT once I added a cheapo ATI card, the S3 graphics are ungrok'd by X server, and a third party driver for the Rhine II ethernet controller.
    Its VERY frustrating since I just started to putts with dtrace and I can't get it to boot again!!!
    NetBSD and Fedora core 3 run fine on the system; partition 0 and 1 respectively. Its only Solaris I can't get to run. B^(.
    Don't know if this helps any,
    -Rob

  • V490 sol8 no disks found

    Hi,
    I have 2 V490, both with sol8 installed from DVDROM.
    both have 2 SCSI disks installed
    I run format and get the list of disks
    machine1:
    Searching for disks...done
    AVAILABLE DISK SELECTIONS:
           0. c1t0d0 <SUN146G cyl 14087 alt 2 hd 24 sec 848>
              /pci@9,600000/SUNW,qlc@2/fp@0,0/ssd@w21000014c3ba53f8,0
           1. c1t1d0 <SUN146G cyl 14087 alt 2 hd 24 sec 848>
              /pci@9,600000/SUNW,qlc@2/fp@0,0/ssd@w21000014c3bad19f,0
    machine2:
    AVAILABLE DISK SELECTIONS:
           0. c1t0d0 <SUN146G cyl 14087 alt 2 hd 24 sec 848>
              /pci@9,600000/SUNW,qlc@2/fp@0,0/ssd@w21000014c3bada8a,0
           1. c1t1d0 <SUN146G cyl 14087 alt 2 hd 24 sec 848>
              /pci@9,600000/SUNW,qlc@2/fp@0,0/ssd@w21000014c3bae575,0Doing restore testing
    ufsdump to tape
    ufsrestore from tape to other machine.
    boot sequence stops at /etc/rc2.d/S01MOUNTFSYS
    on the mountall command
    unable to mount , get prompted for root password for system maintenance
    Hostname: fake-name1
    metainit: fake-name1: there are no existing databases
    The / file system (/dev/rdsk/c1t1d0s0) is being checked.
    Can't stat /dev/rdsk/c1t1d0s0
    /dev/rdsk/c1t1d0s0: CAN'T CHECK FILE SYSTEM.
    /dev/rdsk/c1t1d0s0: UNEXPECTED INCONSISTENCY; RUN fsck MANUALLY.
    WARNING - Unable to repair the / filesystem. Run fsck
    manually (fsck -F ufs /dev/rdsk/c1t1d0s0). Exit the shell when
    done to continue the boot process.at this stage when i run a format I get no disks found.
    I have removed the metadevice entries from /etc/system
    I have change the devices in /etc/vfstab back to native disks c1t1d0s0 etc
    same prob
    I have deleted /dev/ and /device and recreated by restoring from backup for the correct machine.
    same problem
    What have I missed?
    How can I do a bare metal restore of a system if it is not back to the original hardware?
    I have also deleted /dev and /devices then added a /reconfigure in the boot disk AND boot disk1 -r
    but it just hangs the machine just after the copyright message
    so I restore the correct /dev and /devices and boot disk1 -r again
    get back to the mountall problem, give root password for system maintenance.
    give the root password
    format searches for a long time ( 30 seconds )
    no disks found!
    I hope it is something simple I have missed
    Thanks in advanced
    Peter

    With the v480/490 you need to remember that the targets are on c1 NOT c0.
    This has caused an issue for many people and their jumpstart installations and meta configs.
    There was also a patch that corrected the instance number from c0 to c1.
    Prior to the patch, the DVD ROM was NOT detected setting the targets to c0. Applying the patch and doing a reconfig reboot would cause the mount of the root volume to fail, because the /etc/vfstab or md.tab was pointing to c0 and the root disk is now at c1.
    This is where the /etc/path_to_inst would come into play.

  • Solaris 10 11/06 Rev. A hangs during installation

    Just received my Solaris 10 DVD package in the mail;
    during the boot process to go into the installation process, it hangs no matter what you select in GRUB
    this is the screen (when selecting to boot 'Solaris') in which it hangs...
    SunOS Release 5.10 Version Generic_118855-33 32-bit
    Copyright 1983-2006 Sun Microsystems, Inc. All rights reserved.
    Use is subject to license terms.
    my hardware;
    AMD Athlon 1800+
    512 MB of RAM
    80 GB HDD
    ATI Radeon 9200 AGP

    My Computer:
    Intel Celeron 2.7GHz
    80 GB Hard Drive
    512 MB Ram
    ATI Radeon 9200 PCI
    I'm suspecting that it's the Radeon Graphics card (hope not, using the onboard will cut into system ram, I suspect that is the case for you also?) - but it is listed as working in the HCL last time I checkd.
    It displays the copyright message, then the cursor jumps around the screen a bit and it justs there.
    What type of computer do you have, and what model (HP, Dell, eMachines, Gateway, etc.)?
    I may pull the graphics card out later and turn on the onboard graphics and see what happens then. First I'll try just changing the default display in BIOS and trying to boot the install, though. I'll post back and see if that changes anything.
    *Note:  Solaris 10 installation DOES boot on my main windows development workstation, which has the same card you have (AGP, instead of PCI like this one, though - but same card) - so I'm skeptical of the cause.  Most probably a BIOS/misc. hardware issue.  I tried loading the kernel in verbose mode (-v) and there were no errors.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                           

  • System.log trivia

    These events take place during boot. I was hoping to get some feedback (I understand these are seperate events, so there will be seperate answers to each):
    Apr 23 21:55:44 localhost com.apple.launchctl.System[2]: launchctl: Please convert the following to launchd: /etc/mach_init.d/dashboardadvisoryd.plist
    Apr 23 21:55:44 localhost com.apple.launchd[1] (com.apple.blued): Unknown key for boolean: EnableTransactions
    Apr 23 21:55:44 localhost com.apple.launchd[1] (org.cups.cupsd): Unknown key: SHAuthorizationRight
    Apr 23 21:55:44 localhost com.apple.launchd[1] (org.ntp.ntpd): Unknown key: SHAuthorizationRight
    Apr 23 21:55:46 localhost kernel[0]: The Regents of the University of California. All rights reserved.
    Apr 23 21:56:53 Macintosh quicklookd[109]: [QL ERROR] 'Creating thumbnail' timed out for '<QLThumbnailRequest /Users/Ryan/Desktop/Transporter 3.avi>'
    Thank you much.

    pianoman1976 wrote:
    What's the deal with "Regents of California"?
    It's a copyright message emitted by something in the kernel.
    Nothing you need to worry about.
    Explanation for the bored:
    The Mac OS X kernel is based in part on BSD UNIX, BSD meaning "Berkeley Standard Distribution," so parts of the Mac OS X kernel and device drivers have their copyright held by the Regents of the University of California.

  • How to change my podcast name?

    I just got approved for my podcast to hit the Itunes world, But I changed my name about a year ago and it won't update to my NEW name. Any ideas on how to change my newly updated name?
    Hope that made sense, Thanks in advance.

    MGG32,
    If you're using Quick Blogcast, you can edit the ID3 Tags be doing the following (http://tr.im/sXLF) -
    1. Log in to your Account Manager.
    2. In the My Products section, click Quick Blogcast.
    3. Click Manage Account next to the blog account you want to modify.
    4. From the Manage Entries menu, click Entries.
    5. Click the name of the podcast episode you want to edit.
    6. Click Edit Podcast.
    +Note: If you want to set the ID3 Tag information as the default information for all of your podcast episodes, select Use as Default for ID3 tags.+
    7. Edit ID3 Tag information in the following fields:
    SubTitle
    Enter a subtitle.
    Composer
    Enter the composer's name.
    Album Info
    Enter information you want to include about the file album.
    Podcaster
    Specify the name of the person who created the podcast.
    Podcast Summary/Description
    Enter a summary of the podcast or comments you want to include about it.
    Copyright Message
    Enter the copyright information for the podcast.
    Keywords
    Enter keywords that describe your podcast. Keywords help your podcast to be indexed by search engines and iTunes®.
    Explicit
    In the select box, select whether you want to identify your podcast as containing explicit content.
    8. Click OK.

  • OAM 11.1.1.3 jsp customization

    All,
    I have been customizing oam jsp page for minor things such as changing the display messages (login errors, copyright messages etc) to the end users based on error codes. the way i was deploying the updates is by deleting related .class files. Is this the best way to proceed. I am not sure if i am breaking oracle's caching logic with respect to files generated in /tmp folder on the linux environment. I say this because i face some OAM startup issue with spurious classnotfoundexceptions sometimes, not always reproducible though.
    Has anyone explored the option of adding the source to the oam war file and redeploying it. What are the issues if any that you found with this route.
    any other options are also welcome, please share your thoughts if you can.
    Prasad.

    The patch you need, OIM 11.1.1.5.3, is this : "p13704894", but before install it you should also install the "p13106312" for the SOA server.

  • PackedInteger encoding does not preserve order - but it could

    Currently, when viewed under the default unsigned lexical ordering, "packed" integers (and longs) do not sort numerically. This is because for values requiring two or more bytes, the "value" bytes are stored little endian.
    For example:
    <tt> 65910 -> 7a ff 00 01</tt>
    <tt> 65911 -> 7a 00 01 01</tt>
    However, it's possible to encode packed integers such that they still sort correctly. You can do this by modifying the existing PackedInteger algorithm as follows:
    <li>Invert the high-order bit on the first byte
    <li>Reverse the order of the second and subsequent bytes (if any)
    <li>If the original number was negative, invert (one's complement) the bits in the second and subsequent bytes (if any)
    Here's some examples showing the two encodings:
                  NUMBER             ENCODING         NEW ENCODING
    -9223372036854775808   8189ffffffffffff7f   018000000000000076
             -2147483648           8589ffff7f           0580000076
                  -65911             86000101             06fefeff
                  -65910             86ff0001             06feff00
                  -65655             86000001             06feffff
                  -65654               87ffff               070000
                  -65400               8701ff               0700fe
                  -65399               8700ff               0700ff
                    -375               870001               07feff
                    -374                 88ff                 0800
                    -120                 8801                 08fe
                    -119                   89                   09
                      -1                   ff                   7f
                       0                   00                   80
                       1                   01                   81
                     119                   77                   f7
                     120                 7801                 f801
                     374                 78ff                 f8ff
                     375               790001               f90100
                     631               790002               f90200
                   65399               7900ff               f9ff00
                   65400               7901ff               f9ff01
                   65654               79ffff               f9ffff
                   65655             7a000001             fa010000
                   65910             7aff0001             fa0100ff
                   65911             7a000101             fa010100
              2147483647           7b88ffff7f           fb7fffff88
    9223372036854775807   7f88ffffffffffff7f   ff7fffffffffffff88So the question is.. any particular reason this wasn't done? Would this alternate encoding be a useful addition? (I'm sure it's not possible to replace the current algorithm at this point).
    Thanks.

    greybird wrote:
    Thanks Archie. I appreciate this and I know you have good intentions. Unfortunately, we won't be able to incorporate any code from your svn repository. We can only incorporate submissions if the source code is posted here in our OTN forum.Not a problem... Here is the new class:
    package org.dellroad.sidekar.util;
    import com.sleepycat.bind.tuple.TupleInput;
    import com.sleepycat.bind.tuple.TupleOutput;
    import java.util.Arrays;
    * An improved version of Berkeley DB's {@link com.sleepycat.util.PackedInteger} class that packs values in such
    * a way that their order is preserved when compared using the default binary unsigned lexical ordering.
    * @see <a href="http://forums.oracle.com/forums/thread.jspa?messageID=4126254">Berkeley DB Java Edition forum posting</a>
    public final class PackedLong {
         * Maximum possible length of an encoded value.
        public static final int MAX_ENCODED_LENGTH = 9;
         * Minimum value for the first byte of a single byte encoded value. Lower values indicate a multiple byte encoded negative value.
        public static final int MIN_SINGLE_BYTE_ENCODED = 0x08;        // values 0x00 ... 0x07 prefix negative values
         * Maximum value for the first byte of a single byte encoded value. Higher values indicate a multiple byte encoded positive value.
        public static final int MAX_SINGLE_BYTE_ENCODED = 0xf7;        // values 0xf8 ... 0xff prefix positive values
         * Adjustment applied to single byte encoded values before encoding.
        public static final int ZERO_ADJUST = 127;                     // single byte value that represents zero
         * Minimum value that can be encoded as a single byte.
        public static final int MIN_SINGLE_BYTE_VALUE = MIN_SINGLE_BYTE_ENCODED - ZERO_ADJUST;          // -119
         * Maximum value that can be encoded as a singel byte.
        public static final int MAX_SINGLE_BYTE_VALUE = MAX_SINGLE_BYTE_ENCODED - ZERO_ADJUST;          // 120
         * Adjustment applied to multiple byte encoded negative values before encoding.
        public static final int NEGATIVE_ADJUST = -MIN_SINGLE_BYTE_VALUE;                               // 119
         * Adjustment applied to multiple byte encoded positive values before encoding.
        public static final int POSITIVE_ADJUST = -(MAX_SINGLE_BYTE_VALUE + 1);                         // -121
        // Cutoff values at which the encoded length changes (this field is package private for testing purposes)
        static final long[] CUTOFF_VALUES = new long[] {
            0xff00000000000000L - NEGATIVE_ADJUST,      // [ 0] requires 8 bytes
            0xffff000000000000L - NEGATIVE_ADJUST,      // [ 1] requires 7 bytes
            0xffffff0000000000L - NEGATIVE_ADJUST,      // [ 2] requires 6 bytes
            0xffffffff00000000L - NEGATIVE_ADJUST,      // [ 3] requires 5 bytes
            0xffffffffff000000L - NEGATIVE_ADJUST,      // [ 4] requires 4 bytes
            0xffffffffffff0000L - NEGATIVE_ADJUST,      // [ 5] requires 3 bytes
            0xffffffffffffff00L - NEGATIVE_ADJUST,      // [ 6] requires 2 bytes
            MIN_SINGLE_BYTE_VALUE,                      // [ 7] requires 1 byte
            MAX_SINGLE_BYTE_VALUE + 1,                  // [ 8] requires 2 bytes
            0x0000000000000100L - POSITIVE_ADJUST,      // [ 9] requires 3 bytes
            0x0000000000010000L - POSITIVE_ADJUST,      // [10] requires 4 bytes
            0x0000000001000000L - POSITIVE_ADJUST,      // [11] requires 5 bytes
            0x0000000100000000L - POSITIVE_ADJUST,      // [12] requires 6 bytes
            0x0000010000000000L - POSITIVE_ADJUST,      // [13] requires 7 bytes
            0x0001000000000000L - POSITIVE_ADJUST,      // [14] requires 8 bytes
            0x0100000000000000L - POSITIVE_ADJUST,      // [15] requires 9 bytes
        private PackedLong() {
         * Write the encoded value to the output.
         * @param output destination for the encoded value
         * @param value value to encode
        public static void write(TupleOutput output, long value) {
            output.makeSpace(MAX_ENCODED_LENGTH);
            int len = encode(value, output.getBufferBytes(), output.getBufferLength());
            output.addSize(len);
         * Read and decode a value from the input.
         * @param input input holding an encoded value
         * @return the decoded value
        public static long read(TupleInput input) {
            long value = decode(input.getBufferBytes(), input.getBufferOffset());
            input.skipFast(getReadLength(input));
            return value;
         * Determine the length (in bytes) of an encoded value without advancing the input.
         * @param input input holding an encoded value
         * @return the length of the encoded value
        public static int getReadLength(TupleInput input) {
            return getReadLength(input.getBufferBytes(), input.getBufferOffset());
         * Determine the length (in bytes) of an encoded value.
         * @param buf buffer containing encoded value
         * @param off starting offset of encoded value
         * @return the length of the encoded value
         * @throws ArrayIndexOutOfBoundsException if {@code off} is not a valid offset in {@code buf}
        public static int getReadLength(byte[] buf, int off) {
            int prefix = buf[off] & 0xff;
            if (prefix < MIN_SINGLE_BYTE_ENCODED)
                return 1 + MIN_SINGLE_BYTE_ENCODED - prefix;
            if (prefix > MAX_SINGLE_BYTE_ENCODED)
                return 1 + prefix - MAX_SINGLE_BYTE_ENCODED;
            return 1;
         * Determine the length (in bytes) of the encoded value.
         * @return the length of the encoded value, a value between one and {@link #MAX_ENCODED_LENGTH}
        public static int getWriteLength(long value) {
            int index = Arrays.binarySearch(CUTOFF_VALUES, value);
            if (index < 0)
                index = ~index - 1;
            return index < 8 ? 8 - index : index - 6;
         * Encode the given value into a new buffer.
         * @param value value to encode
         * @return byte array containing the encoded value
        public static byte[] encode(long value) {
            byte[] buf = new byte[MAX_ENCODED_LENGTH];
            int len = encode(value, buf, 0);
            if (len != MAX_ENCODED_LENGTH) {
                byte[] newbuf = new byte[len];
                System.arraycopy(buf, 0, newbuf, 0, len);
                buf = newbuf;
            return buf;
         * Encode the given value and write the encoded bytes into the given buffer.
         * @param value value to encode
         * @param buf output buffer
         * @param off starting offset into output buffer
         * @return the number of encoded bytes written
         * @throws ArrayIndexOutOfBoundsException if {@code off} is negative or the encoded value exceeds the given buffer
        public static int encode(long value, byte[] buf, int off) {
            int len = 1;
            if (value < MIN_SINGLE_BYTE_VALUE) {
                value += NEGATIVE_ADJUST;
                long mask = 0x00ffffffffffffffL;
                for (int shift = 56; shift != 0; shift -= 8) {
                    if ((value | mask) != ~0L)
                        buf[off + len++] = (byte)(value >> shift);
                    mask >>= 8;
                buf[off] = (byte)(MIN_SINGLE_BYTE_ENCODED - len);
            } else if (value > MAX_SINGLE_BYTE_VALUE) {
                value += POSITIVE_ADJUST;
                long mask = 0xff00000000000000L;
                for (int shift = 56; shift != 0; shift -= 8) {
                    if ((value & mask) != 0L)
                        buf[off + len++] = (byte)(value >> shift);
                    mask >>= 8;
                buf[off] = (byte)(MAX_SINGLE_BYTE_ENCODED + len);
            } else {
                buf[off] = (byte)(value + ZERO_ADJUST);
                return 1;
            buf[off + len++] = (byte)value;
            return len;
         * Decode a value from the given buffer.
         * @param buf buffer containing an encoded value
         * @param off starting offset of the encoded value in {@code buf}
         * @return the decoded value
         * @throws ArrayIndexOutOfBoundsException if {@code off} is negative or the encoded value is truncated
         * @see #getReadLength
        public static long decode(byte[] buf, int off) {
            int first = buf[off++] & 0xff;
            if (first < MIN_SINGLE_BYTE_ENCODED) {
                long value = ~0L;
                while (first++ < MIN_SINGLE_BYTE_ENCODED)
                    value = (value << 8) | (buf[off++] & 0xff);
                return value - NEGATIVE_ADJUST;
            if (first > MAX_SINGLE_BYTE_ENCODED) {
                long value = 0L;
                while (first-- > MAX_SINGLE_BYTE_ENCODED)
                    value = (value << 8) | (buf[off++] & 0xff);
                return value - POSITIVE_ADJUST;
            return (byte)(first - ZERO_ADJUST);
    }and here is the unit test:
    package org.dellroad.sidekar.util;
    import com.sleepycat.bind.tuple.TupleInput;
    import com.sleepycat.bind.tuple.TupleOutput;
    import com.sleepycat.je.DatabaseEntry;
    import org.dellroad.sidekar.TestSupport;
    import org.testng.annotations.DataProvider;
    import org.testng.annotations.Test;
    import static org.testng.Assert.assertEquals;
    public class PackedLongTest extends TestSupport {
        @Test(dataProvider = "encodings")
        public void testEncoding(long value, String string) {
            // Test direct encoding
            byte[] expected = ByteArrayEncoder.decode(string);
            byte[] actual = PackedLong.encode(value);
            assertEquals(actual, expected);
            // Test write()
            TupleOutput out = new TupleOutput();
            PackedLong.write(out, value);
            assertEquals(out.toByteArray(), expected);
            // Test getWriteLength()
            assertEquals(actual.length, PackedLong.getWriteLength(value));
            // Test decoding
            long value2 = PackedLong.decode(actual, 0);
            assertEquals(value2, value);
            // Test read()
            TupleInput input = JEUtil.toTupleInput(new DatabaseEntry(actual));
            assertEquals(actual.length, PackedLong.getReadLength(input));
            value2 = PackedLong.read(input);
            assertEquals(value2, value);
            // Test getReadLength()
            assertEquals(actual.length, PackedLong.getReadLength(actual, 0));
        @Test(dataProvider = "lengths")
        public void testEncodedLength(long value, int expected) {
            int actual = PackedLong.getWriteLength(value);
            assertEquals(actual, expected);
            byte[] buf = PackedLong.encode(value);
            assertEquals(buf.length, expected);
        @DataProvider(name = "encodings")
        public Object[][] genEncodings() {
            return new Object[][] {
                // Corner cases
                { 0x8000000000000000L, "008000000000000077" },
                { 0xfeffffffffffff88L, "00feffffffffffffff" },
                { 0xfeffffffffffff89L, "0100000000000000" },
                { 0xfeffffffffffffffL, "0100000000000076" },
                { 0xfffeffffffffff88L, "01feffffffffffff" },
                { 0xfffeffffffffff89L, "02000000000000" },
                { 0xfffeffffffffffffL, "02000000000076" },
                { 0xfffffeffffffff88L, "02feffffffffff" },
                { 0xfffffeffffffff89L, "030000000000" },
                { 0xfffffeffffffffffL, "030000000076" },
                { 0xfffffffeffffff88L, "03feffffffff" },
                { 0xfffffffeffffff89L, "0400000000" },
                { 0xfffffffeffffffffL, "0400000076" },
                { 0xfffffffffeffff88L, "04feffffff" },
                { 0xfffffffffeffff89L, "05000000" },
                { 0xfffffffffeffffffL, "05000076" },
                { 0xfffffffffffeff88L, "05feffff" },
                { 0xfffffffffffeff89L, "060000" },
                { 0xfffffffffffeffffL, "060076" },
                { 0xfffffffffffffe88L, "06feff" },
                { 0xfffffffffffffe89L, "0700" },
                { 0xfffffffffffffeffL, "0776" },
                { 0xffffffffffffff88L, "07ff" },
                { 0xffffffffffffff89L, "08" },
                { 0xffffffffffffffa9L, "28" },
                { 0xffffffffffffffc9L, "48" },
                { 0xffffffffffffffe9L, "68" },
                { 0xffffffffffffffffL, "7e" },
                { 0x0000000000000000L, "7f" },
                { 0x0000000000000001L, "80" },
                { 0x0000000000000071L, "f0" },
                { 0x0000000000000077L, "f6" },
                { 0x0000000000000078L, "f7" },
                { 0x0000000000000079L, "f800" },
                { 0x0000000000000178L, "f8ff" },
                { 0x0000000000000179L, "f90100" },
                { 0x0000000000010078L, "f9ffff" },
                { 0x0000000000010079L, "fa010000" },
                { 0x0000000001000078L, "faffffff" },
                { 0x0000000001000079L, "fb01000000" },
                { 0x0000000100000078L, "fbffffffff" },
                { 0x0000000100000079L, "fc0100000000" },
                { 0x0000010000000078L, "fcffffffffff" },
                { 0x0000010000000079L, "fd010000000000" },
                { 0x0001000000000078L, "fdffffffffffff" },
                { 0x0001000000000079L, "fe01000000000000" },
                { 0x0100000000000078L, "feffffffffffffff" },
                { 0x0100000000000079L, "ff0100000000000000" },
                { 0x7fffffffffffff79L, "ff7fffffffffffff00" },
                { 0x7fffffffffffffffL, "ff7fffffffffffff86" },
                // Other cases
                { 0xffffffff80000000L, "0480000077" },
                { 0xfffffffffffefe89L, "05feff00" },
                { 0xfffffffffffefe8aL, "05feff01" },
                { 0xfffffffffffeff86L, "05fefffd" },
                { 0xfffffffffffeff87L, "05fefffe" },
                { 0xfffffffffffeff88L, "05feffff" },
                { 0xfffffffffffeff89L, "060000" },
                { 0xfffffffffffeff8aL, "060001" },
                { 0xffffffffffff0086L, "0600fd" },
                { 0xffffffffffff0087L, "0600fe" },
                { 0xffffffffffff0088L, "0600ff" },
                { 0xffffffffffff0089L, "060100" },
                { 0xfffffffffffffe86L, "06fefd" },
                { 0xfffffffffffffe87L, "06fefe" },
                { 0xfffffffffffffe89L, "0700" },
                { 0xfffffffffffffe8aL, "0701" },
                { 0xffffffffffffff87L, "07fe" },
                { 0xffffffffffffff88L, "07ff" },
                { 0xffffffffffffff89L, "08" },
                { 0xffffffffffffffffL, "7e" },
                { 0x0000000000000000L, "7f" },
                { 0x0000000000000001L, "80" },
                { 0x0000000000000077L, "f6" },
                { 0x0000000000000078L, "f7" },
                { 0x0000000000000176L, "f8fd" },
                { 0x0000000000000177L, "f8fe" },
                { 0x0000000000000178L, "f8ff" },
                { 0x0000000000000277L, "f901fe" },
                { 0x000000000000ff77L, "f9fefe" },
                { 0x000000000000ff78L, "f9feff" },
                { 0x000000000000ff79L, "f9ff00" },
                { 0x000000000000ff7aL, "f9ff01" },
                { 0x0000000000010076L, "f9fffd" },
                { 0x0000000000010077L, "f9fffe" },
                { 0x0000000000010078L, "f9ffff" },
                { 0x0000000000010079L, "fa010000" },
                { 0x000000000001007aL, "fa010001" },
                { 0x0000000000010176L, "fa0100fd" },
                { 0x0000000000010177L, "fa0100fe" },
                { 0x000000007fffffffL, "fb7fffff86" },
                { 0x7fffffffffffffffL, "ff7fffffffffffff86" },
        @DataProvider(name = "lengths")
        public Object[][] genLengths() {
            return new Object[][] {
                // Check cutoff values
                {   PackedLong.CUTOFF_VALUES[ 0] - 1,      9   },
                {   PackedLong.CUTOFF_VALUES[ 0],          8   },
                {   PackedLong.CUTOFF_VALUES[ 1] - 1,      8   },
                {   PackedLong.CUTOFF_VALUES[ 1],          7   },
                {   PackedLong.CUTOFF_VALUES[ 2] - 1,      7   },
                {   PackedLong.CUTOFF_VALUES[ 2],          6   },
                {   PackedLong.CUTOFF_VALUES[ 3] - 1,      6   },
                {   PackedLong.CUTOFF_VALUES[ 3],          5   },
                {   PackedLong.CUTOFF_VALUES[ 4] - 1,      5   },
                {   PackedLong.CUTOFF_VALUES[ 4],          4   },
                {   PackedLong.CUTOFF_VALUES[ 5] - 1,      4   },
                {   PackedLong.CUTOFF_VALUES[ 5],          3   },
                {   PackedLong.CUTOFF_VALUES[ 6] - 1,      3   },
                {   PackedLong.CUTOFF_VALUES[ 6],          2   },
                {   PackedLong.CUTOFF_VALUES[ 7] - 1,      2   },
                {   PackedLong.CUTOFF_VALUES[ 7],          1   },
                {   PackedLong.CUTOFF_VALUES[ 8] - 1,      1   },
                {   PackedLong.CUTOFF_VALUES[ 8],          2   },
                {   PackedLong.CUTOFF_VALUES[ 9] - 1,      2   },
                {   PackedLong.CUTOFF_VALUES[ 9],          3   },
                {   PackedLong.CUTOFF_VALUES[10] - 1,      3   },
                {   PackedLong.CUTOFF_VALUES[10],          4   },
                {   PackedLong.CUTOFF_VALUES[11] - 1,      4   },
                {   PackedLong.CUTOFF_VALUES[11],          5   },
                {   PackedLong.CUTOFF_VALUES[12] - 1,      5   },
                {   PackedLong.CUTOFF_VALUES[12],          6   },
                {   PackedLong.CUTOFF_VALUES[13] - 1,      6   },
                {   PackedLong.CUTOFF_VALUES[13],          7   },
                {   PackedLong.CUTOFF_VALUES[14] - 1,      7   },
                {   PackedLong.CUTOFF_VALUES[14],          8   },
                {   PackedLong.CUTOFF_VALUES[15] - 1,      8   },
                {   PackedLong.CUTOFF_VALUES[15],          9   },
                // Check some other values
                { Long.MIN_VALUE,                               9   },
                { Long.MAX_VALUE,                               9   },
                { (long)Integer.MIN_VALUE,                      5   },
                { (long)Integer.MAX_VALUE,                      5   },
                { (long)Short.MIN_VALUE,                        3   },
                { (long)Short.MAX_VALUE,                        3   },
                { (long)Byte.MIN_VALUE,                         2   },
                { (long)Byte.MAX_VALUE,                         2   },
                { 0,                                            1   },
    }Edited by: archie172 on Mar 3, 2010 12:40 PM
    Removed copyright message.

Maybe you are looking for

  • Inventory Implementation

    Hi , I am implementing the Inventory. Its 7x flow.I am good with all most every steps. I am having issues with activating the transformations.  I am getting error while i am activating the BF and UM transformations. The error is... Start Routine: Syn

  • FF4 Panorama is cool, but it doesn't save when FF is closed?

    I tried the new FF4 Panorama feature, it's cool. But doesn't it save my work? When I close FF and reopen it, all named tab groups are gone...:-( And... the troubleshooting information doesn't fit in to the box below. Max chars: 30,000. Not enough for

  • Bookmarks missing from sidebar

    After a recent upgrade to v. 9.0.1, the bookmarks that normally appear in my sidebar disappeared. They haven't disappeared totally as I can access them from the Bookmarks tab and they continue to reside on the Xmarks server. I just can't see them whe

  • Syncing mac to Apple TV

    Just bought some music and a movie form itunes and can not get it to sync with my apple tv

  • Is it possible to make a video preview and export it from edge animate?

    is it possible to make a video preview and export it from edge animate?