jdk/src/share/classes/javax/sql/rowset/serial/SerialBlob.java
changeset 7544 85a0e84bb9a0
parent 5506 202f599c92aa
child 10323 48d695d1e966
equal deleted inserted replaced
7543:3a3e3f73b043 7544:85a0e84bb9a0
     1 /*
     1 /*
     2  * Copyright (c) 2003, 2006, Oracle and/or its affiliates. All rights reserved.
     2  * Copyright (c) 2003, 2010, Oracle and/or its affiliates. All rights reserved.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     3  * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
     4  *
     4  *
     5  * This code is free software; you can redistribute it and/or modify it
     5  * This code is free software; you can redistribute it and/or modify it
     6  * under the terms of the GNU General Public License version 2 only, as
     6  * under the terms of the GNU General Public License version 2 only, as
     7  * published by the Free Software Foundation.  Oracle designates this
     7  * published by the Free Software Foundation.  Oracle designates this
   164     public byte[] getBytes(long pos, int length) throws SerialException {
   164     public byte[] getBytes(long pos, int length) throws SerialException {
   165         if (length > len) {
   165         if (length > len) {
   166             length = (int)len;
   166             length = (int)len;
   167         }
   167         }
   168 
   168 
   169         if (pos < 1 || length - pos < 0 ) {
   169         if (pos < 1 || len - pos < 0 ) {
   170             throw new SerialException("Invalid arguments: position cannot be less that 1");
   170             throw new SerialException("Invalid arguments: position cannot be "
       
   171                     + "less than 1 or greater than the length of the SerialBlob");
   171         }
   172         }
   172 
   173 
   173         pos--; // correct pos to array index
   174         pos--; // correct pos to array index
   174 
   175 
   175         byte[] b = new byte[length];
   176         byte[] b = new byte[length];