/** * Throws an exception if the pos value exceeds the max value by * which the large object API can index. * * @param pos Position to write at. */ protected void assertPosition(long pos) throws SQLException { assertPosition(pos, 0); }
public synchronized long length() throws SQLException { checkFreed(); return lo.size(); }
/** * This is simply passing the byte value of the pattern Blob */ public synchronized long position(Blob pattern, long start) throws SQLException { return position(pattern.getBytes(1, (int)pattern.length()), start); }
public synchronized byte[] getBytes(long pos, int length) throws SQLException { assertPosition(pos); lo.seek((int)(pos-1), LargeObject.SEEK_SET); return lo.read(length); }
public synchronized InputStream getBinaryStream() throws SQLException { checkFreed(); LargeObject subLO = lo.copy(); subLOs.add(subLO); subLO.seek(0, LargeObject.SEEK_SET); return subLO.getInputStream(); }
/** * This is simply passing the byte value of the pattern Blob */ public synchronized long position(Blob pattern, long start) throws SQLException { return position(pattern.getBytes(1, (int)pattern.length()), start); }
public synchronized OutputStream setBinaryStream(long pos) throws SQLException { assertPosition(pos); LargeObject subLO = lo.copy(); subLOs.add(subLO); subLO.seek((int)(pos-1)); return subLO.getOutputStream(); }
/** * Throws an exception if the pos value exceeds the max value by * which the large object API can index. * * @param pos Position to write at. * @param len number of bytes to write. */ protected void assertPosition(long pos, long len) throws SQLException { checkFreed(); if (pos < 1) { throw new PSQLException(GT.tr("LOB positioning offsets start at 1."), PSQLState.INVALID_PARAMETER_VALUE); } if (pos + len - 1 > Integer.MAX_VALUE) { throw new PSQLException(GT.tr("PostgreSQL LOBs can only index to: {0}", new Integer(Integer.MAX_VALUE)), PSQLState.INVALID_PARAMETER_VALUE); } }
/** * This is simply passing the byte value of the pattern Blob */ public synchronized long position(Blob pattern, long start) throws SQLException { return position(pattern.getBytes(1, (int)pattern.length()), start); }
assertPosition(start, pattern.length);
/** * For Blobs this should be in bytes while for Clobs it should be * in characters. Since we really haven't figured out how to handle * character sets for Clobs the current implementation uses bytes for * both Blobs and Clobs. */ public synchronized void truncate(long len) throws SQLException { checkFreed(); if (!conn.haveMinimumServerVersion("8.3")) throw new PSQLException(GT.tr("Truncation of large objects is only implemented in 8.3 and later servers."), PSQLState.NOT_IMPLEMENTED); if (len < 0) { throw new PSQLException(GT.tr("Cannot truncate LOB to a negative length."), PSQLState.INVALID_PARAMETER_VALUE); } if (len > Integer.MAX_VALUE) { throw new PSQLException(GT.tr("PostgreSQL LOBs can only index to: {0}", new Integer(Integer.MAX_VALUE)), PSQLState.INVALID_PARAMETER_VALUE); } lo.truncate((int)len); }
/** * Throws an exception if the pos value exceeds the max value by * which the large object API can index. * * @param pos Position to write at. */ protected void assertPosition(long pos) throws SQLException { assertPosition(pos, 0); }
public synchronized long length() throws SQLException { checkFreed(); return lo.size(); }
/** * Throws an exception if the pos value exceeds the max value by * which the large object API can index. * * @param pos Position to write at. */ protected void assertPosition(long pos) throws SQLException { assertPosition(pos, 0); }
public synchronized long length() throws SQLException { checkFreed(); return lo.size(); }
public synchronized byte[] getBytes(long pos, int length) throws SQLException { assertPosition(pos); lo.seek((int)(pos-1), LargeObject.SEEK_SET); return lo.read(length); }
public synchronized InputStream getBinaryStream() throws SQLException { checkFreed(); LargeObject subLO = lo.copy(); subLOs.add(subLO); subLO.seek(0, LargeObject.SEEK_SET); return subLO.getInputStream(); }
public synchronized byte[] getBytes(long pos, int length) throws SQLException { assertPosition(pos); lo.seek((int)(pos-1), LargeObject.SEEK_SET); return lo.read(length); }
public synchronized InputStream getBinaryStream() throws SQLException { checkFreed(); LargeObject subLO = lo.copy(); subLOs.add(subLO); subLO.seek(0, LargeObject.SEEK_SET); return subLO.getInputStream(); }
public synchronized OutputStream setBinaryStream(long pos) throws SQLException { assertPosition(pos); LargeObject subLO = lo.copy(); subLOs.add(subLO); subLO.seek((int)(pos-1)); return subLO.getOutputStream(); }