1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236
|
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<!--NewPage-->
<HTML>
<HEAD>
<!-- Generated by javadoc (build 1.4.2_19) on Wed Dec 30 16:45:49 CET 2009 -->
<TITLE>
BlobBuffer (jTDS API)
</TITLE>
<META NAME="keywords" CONTENT="net.sourceforge.jtds.util.BlobBuffer class">
<LINK REL ="stylesheet" TYPE="text/css" HREF="../../../../stylesheet.css" TITLE="Style">
<SCRIPT type="text/javascript">
function windowTitle()
{
parent.document.title="BlobBuffer (jTDS API)";
}
</SCRIPT>
</HEAD>
<BODY BGCOLOR="white" onload="windowTitle();">
<!-- ========= START OF TOP NAVBAR ======= -->
<A NAME="navbar_top"><!-- --></A>
<A HREF="#skip-navbar_top" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_top_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/BlobBuffer.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV CLASS
<A HREF="../../../../net/sourceforge/jtds/util/BlobBuffer.AsciiInputStream.html" title="class in net.sourceforge.jtds.util"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../index.html" target="_top"><B>FRAMES</B></A>
<A HREF="BlobBuffer.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: <A HREF="#nested_class_summary">NESTED</A> | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_top"></A>
<!-- ========= END OF TOP NAVBAR ========= -->
<HR>
<!-- ======== START OF CLASS DATA ======== -->
<H2>
<FONT SIZE="-1">
net.sourceforge.jtds.util</FONT>
<BR>
Class BlobBuffer</H2>
<PRE>
java.lang.Object
<IMG SRC="../../../../resources/inherit.gif" ALT="extended by"><B>net.sourceforge.jtds.util.BlobBuffer</B>
</PRE>
<HR>
<DL>
<DT>public class <B>BlobBuffer</B><DT>extends java.lang.Object</DL>
<P>
Manages a buffer (backed by optional disk storage) for use as a data store
by the CLOB and BLOB objects.
<p/>
The data can be purely memory based until the size exceeds the value
dictated by the <code>lobBuffer</code> URL property after which it will be
written to disk. The disk array is accessed randomly one page (1024 bytes)
at a time.
<p/>
This class is not synchronized and concurrent open input and output
streams can conflict.
<p/>
Tuning hints:
<ol>
<li>The <code>PAGE_SIZE</code> governs how much data is buffered when
reading or writing data a byte at a time. 1024 bytes seems to work well
but if very large objects are being written a byte at a time 4096 may be
better. <b>NB.</b> ensure that the <code>PAGE_MASK</code> and
<code>BYTE_MASK</code> fields are also adjusted to match.
<li>Reading or writing byte arrays that are greater than or equal to the
page size will go directly to or from the random access file cutting out
an ArrayCopy operation.
<li>If BLOBs are being buffered exclusively in memory you may wish to
adjust the <code>MAX_BUF_INC</code> value. Every time the buffer is
expanded the existing contents are copied and this may get expensive
with very large BLOBs.
<li>The BLOB file will be kept open for as long as there are open input or
output streams. Therefore BLOB streams should be explicitly closed as
soon as they are finished with.
</ol>
<P>
<P>
<DL>
<DT><B>Version:</B></DT>
<DD>$Id: BlobBuffer.java,v 1.4.2.1 2009/08/03 12:31:00 ickzon Exp $</DD>
<DT><B>Author:</B></DT>
<DD>Mike Hutchinson</DD>
</DL>
<HR>
<P>
<!-- ======== NESTED CLASS SUMMARY ======== -->
<A NAME="nested_class_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Nested Class Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>private class</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sourceforge/jtds/util/BlobBuffer.AsciiInputStream.html" title="class in net.sourceforge.jtds.util">BlobBuffer.AsciiInputStream</A></B></CODE>
<BR>
An ASCII <code>InputStream</code> over the CLOB buffer.
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>private class</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sourceforge/jtds/util/BlobBuffer.AsciiOutputStream.html" title="class in net.sourceforge.jtds.util">BlobBuffer.AsciiOutputStream</A></B></CODE>
<BR>
Implements an ASCII <code>OutputStream</code> for CLOB data.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>private class</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sourceforge/jtds/util/BlobBuffer.BlobInputStream.html" title="class in net.sourceforge.jtds.util">BlobBuffer.BlobInputStream</A></B></CODE>
<BR>
An <code>InputStream</code> over the BLOB buffer.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>private class</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sourceforge/jtds/util/BlobBuffer.BlobOutputStream.html" title="class in net.sourceforge.jtds.util">BlobBuffer.BlobOutputStream</A></B></CODE>
<BR>
Implements an <code>OutputStream</code> for BLOB data.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>private class</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sourceforge/jtds/util/BlobBuffer.UnicodeInputStream.html" title="class in net.sourceforge.jtds.util">BlobBuffer.UnicodeInputStream</A></B></CODE>
<BR>
A Big Endian Unicode <code>InputStream</code> over the CLOB buffer.</TD>
</TR>
</TABLE>
<!-- =========== FIELD SUMMARY =========== -->
<A NAME="field_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Field Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>private java.io.File</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sourceforge/jtds/util/BlobBuffer.html#blobFile">blobFile</A></B></CODE>
<BR>
The name of the temporary BLOB disk file.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>private byte[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sourceforge/jtds/util/BlobBuffer.html#buffer">buffer</A></B></CODE>
<BR>
The BLOB buffer or the current page buffer.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>private java.io.File</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sourceforge/jtds/util/BlobBuffer.html#bufferDir">bufferDir</A></B></CODE>
<BR>
The directory to buffer data to.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>private boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sourceforge/jtds/util/BlobBuffer.html#bufferDirty">bufferDirty</A></B></CODE>
<BR>
Indicates page in memory must be saved.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>private static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sourceforge/jtds/util/BlobBuffer.html#BYTE_MASK">BYTE_MASK</A></B></CODE>
<BR>
Mask for page offset component of R/W pointer.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>private int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sourceforge/jtds/util/BlobBuffer.html#currentPage">currentPage</A></B></CODE>
<BR>
The number of the current page in memory.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>private static byte[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sourceforge/jtds/util/BlobBuffer.html#EMPTY_BUFFER">EMPTY_BUFFER</A></B></CODE>
<BR>
Default zero length buffer.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>private static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sourceforge/jtds/util/BlobBuffer.html#INVALID_PAGE">INVALID_PAGE</A></B></CODE>
<BR>
Invalid page marker.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>private boolean</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sourceforge/jtds/util/BlobBuffer.html#isMemOnly">isMemOnly</A></B></CODE>
<BR>
True if attempts to create a BLOB file have failed.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>private int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sourceforge/jtds/util/BlobBuffer.html#length">length</A></B></CODE>
<BR>
The total length of the valid data in buffer.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>private static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sourceforge/jtds/util/BlobBuffer.html#MAX_BUF_INC">MAX_BUF_INC</A></B></CODE>
<BR>
Maximum buffer increment.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>private int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sourceforge/jtds/util/BlobBuffer.html#maxMemSize">maxMemSize</A></B></CODE>
<BR>
The maximum size of an in memory buffer.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>private int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sourceforge/jtds/util/BlobBuffer.html#openCount">openCount</A></B></CODE>
<BR>
Count of callers that have opened the BLOB file.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>private static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sourceforge/jtds/util/BlobBuffer.html#PAGE_MASK">PAGE_MASK</A></B></CODE>
<BR>
Mask for page component of read/write pointer.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>private static int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sourceforge/jtds/util/BlobBuffer.html#PAGE_SIZE">PAGE_SIZE</A></B></CODE>
<BR>
Default page size (must be power of 2).</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>private java.io.RandomAccessFile</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sourceforge/jtds/util/BlobBuffer.html#raFile">raFile</A></B></CODE>
<BR>
The RA file object reference or null if closed.</TD>
</TR>
</TABLE>
<!-- ======== CONSTRUCTOR SUMMARY ======== -->
<A NAME="constructor_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Constructor Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE><B><A HREF="../../../../net/sourceforge/jtds/util/BlobBuffer.html#BlobBuffer(java.io.File, long)">BlobBuffer</A></B>(java.io.File bufferDir,
long maxMemSize)</CODE>
<BR>
Creates a blob buffer.</TD>
</TR>
</TABLE>
<!-- ========== METHOD SUMMARY =========== -->
<A NAME="method_summary"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=2><FONT SIZE="+2">
<B>Method Summary</B></FONT></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sourceforge/jtds/util/BlobBuffer.html#close()">close</A></B>()</CODE>
<BR>
Logically closes the file or physically close it if the open count is
now zero.
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sourceforge/jtds/util/BlobBuffer.html#createBlobFile()">createBlobFile</A></B>()</CODE>
<BR>
Creates a random access disk file to use as backing storage for the LOB
data.
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>protected void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sourceforge/jtds/util/BlobBuffer.html#finalize()">finalize</A></B>()</CODE>
<BR>
Finalizes this object by deleting any work files.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> java.io.InputStream</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sourceforge/jtds/util/BlobBuffer.html#getBinaryStream(boolean)">getBinaryStream</A></B>(boolean ascii)</CODE>
<BR>
Retrieve the BLOB data as an <code>InputStream</code>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> byte[]</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sourceforge/jtds/util/BlobBuffer.html#getBytes(long, int)">getBytes</A></B>(long pos,
int len)</CODE>
<BR>
Returns the BLOB data as a byte array.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> long</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sourceforge/jtds/util/BlobBuffer.html#getLength()">getLength</A></B>()</CODE>
<BR>
Retrieves the length of this BLOB buffer in bytes.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> java.io.InputStream</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sourceforge/jtds/util/BlobBuffer.html#getUnicodeStream()">getUnicodeStream</A></B>()</CODE>
<BR>
Retrieve the BLOB data as an Big Endian Unicode
<code>InputStream</code>.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sourceforge/jtds/util/BlobBuffer.html#growBuffer(int)">growBuffer</A></B>(int minSize)</CODE>
<BR>
Increases the size of the in memory buffer for situations where disk
storage of BLOB is not possible.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sourceforge/jtds/util/BlobBuffer.html#open()">open</A></B>()</CODE>
<BR>
Opens the BLOB disk file.
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sourceforge/jtds/util/BlobBuffer.html#position(byte[], long)">position</A></B>(byte[] pattern,
long start)</CODE>
<BR>
Provides support for pattern searching methods.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sourceforge/jtds/util/BlobBuffer.html#read(int)">read</A></B>(int readPtr)</CODE>
<BR>
Reads byte from the BLOB buffer at the specified location.
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sourceforge/jtds/util/BlobBuffer.html#read(int, byte[], int, int)">read</A></B>(int readPtr,
byte[] bytes,
int offset,
int len)</CODE>
<BR>
Reads bytes from the BLOB buffer at the specified location.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sourceforge/jtds/util/BlobBuffer.html#readPage(int)">readPage</A></B>(int page)</CODE>
<BR>
Reads in the specified page from the disk buffer.
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> java.io.OutputStream</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sourceforge/jtds/util/BlobBuffer.html#setBinaryStream(long, boolean)">setBinaryStream</A></B>(long pos,
boolean ascii)</CODE>
<BR>
Creates an <code>OutputStream</code> that can be used to update the
BLOB.
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sourceforge/jtds/util/BlobBuffer.html#setBuffer(byte[], boolean)">setBuffer</A></B>(byte[] bytes,
boolean copy)</CODE>
<BR>
Sets the initial buffer to an existing byte array.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> int</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sourceforge/jtds/util/BlobBuffer.html#setBytes(long, byte[], int, int, boolean)">setBytes</A></B>(long pos,
byte[] bytes,
int offset,
int len,
boolean copy)</CODE>
<BR>
Sets the content of the BLOB to the supplied byte array value.
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sourceforge/jtds/util/BlobBuffer.html#setLength(long)">setLength</A></B>(long length)</CODE>
<BR>
Retrieves the length of the BLOB buffer (in memory version only).</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sourceforge/jtds/util/BlobBuffer.html#truncate(long)">truncate</A></B>(long len)</CODE>
<BR>
Truncates the BLOB buffer to the specified size.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE>(package private) void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sourceforge/jtds/util/BlobBuffer.html#write(int, byte[], int, int)">write</A></B>(int writePtr,
byte[] bytes,
int offset,
int len)</CODE>
<BR>
Inserts bytes into the buffer at the specified location.</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sourceforge/jtds/util/BlobBuffer.html#write(int, int)">write</A></B>(int writePtr,
int b)</CODE>
<BR>
Inserts a byte into the buffer at the specified location.
</TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD ALIGN="right" VALIGN="top" WIDTH="1%"><FONT SIZE="-1">
<CODE> void</CODE></FONT></TD>
<TD><CODE><B><A HREF="../../../../net/sourceforge/jtds/util/BlobBuffer.html#writePage(int)">writePage</A></B>(int page)</CODE>
<BR>
Writes the specified page to the disk buffer.</TD>
</TR>
</TABLE>
<A NAME="methods_inherited_from_class_java.lang.Object"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#EEEEFF" CLASS="TableSubHeadingColor">
<TD><B>Methods inherited from class java.lang.Object</B></TD>
</TR>
<TR BGCOLOR="white" CLASS="TableRowColor">
<TD><CODE>clone, equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait</CODE></TD>
</TR>
</TABLE>
<P>
<!-- ============ FIELD DETAIL =========== -->
<A NAME="field_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Field Detail</B></FONT></TD>
</TR>
</TABLE>
<A NAME="EMPTY_BUFFER"><!-- --></A><H3>
EMPTY_BUFFER</H3>
<PRE>
private static final byte[] <B>EMPTY_BUFFER</B></PRE>
<DL>
<DD>Default zero length buffer.
<P>
<DL>
</DL>
</DL>
<HR>
<A NAME="PAGE_SIZE"><!-- --></A><H3>
PAGE_SIZE</H3>
<PRE>
private static final int <B>PAGE_SIZE</B></PRE>
<DL>
<DD>Default page size (must be power of 2).
<P>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../../constant-values.html#net.sourceforge.jtds.util.BlobBuffer.PAGE_SIZE">Constant Field Values</A></DL>
</DL>
<HR>
<A NAME="PAGE_MASK"><!-- --></A><H3>
PAGE_MASK</H3>
<PRE>
private static final int <B>PAGE_MASK</B></PRE>
<DL>
<DD>Mask for page component of read/write pointer.
<P>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../../constant-values.html#net.sourceforge.jtds.util.BlobBuffer.PAGE_MASK">Constant Field Values</A></DL>
</DL>
<HR>
<A NAME="BYTE_MASK"><!-- --></A><H3>
BYTE_MASK</H3>
<PRE>
private static final int <B>BYTE_MASK</B></PRE>
<DL>
<DD>Mask for page offset component of R/W pointer.
<P>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../../constant-values.html#net.sourceforge.jtds.util.BlobBuffer.BYTE_MASK">Constant Field Values</A></DL>
</DL>
<HR>
<A NAME="MAX_BUF_INC"><!-- --></A><H3>
MAX_BUF_INC</H3>
<PRE>
private static final int <B>MAX_BUF_INC</B></PRE>
<DL>
<DD>Maximum buffer increment.
<P>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../../constant-values.html#net.sourceforge.jtds.util.BlobBuffer.MAX_BUF_INC">Constant Field Values</A></DL>
</DL>
<HR>
<A NAME="INVALID_PAGE"><!-- --></A><H3>
INVALID_PAGE</H3>
<PRE>
private static final int <B>INVALID_PAGE</B></PRE>
<DL>
<DD>Invalid page marker.
<P>
<DL>
<DT><B>See Also:</B><DD><A HREF="../../../../constant-values.html#net.sourceforge.jtds.util.BlobBuffer.INVALID_PAGE">Constant Field Values</A></DL>
</DL>
<HR>
<A NAME="buffer"><!-- --></A><H3>
buffer</H3>
<PRE>
private byte[] <B>buffer</B></PRE>
<DL>
<DD>The BLOB buffer or the current page buffer.
<P>
<DL>
</DL>
</DL>
<HR>
<A NAME="length"><!-- --></A><H3>
length</H3>
<PRE>
private int <B>length</B></PRE>
<DL>
<DD>The total length of the valid data in buffer.
<P>
<DL>
</DL>
</DL>
<HR>
<A NAME="currentPage"><!-- --></A><H3>
currentPage</H3>
<PRE>
private int <B>currentPage</B></PRE>
<DL>
<DD>The number of the current page in memory.
<P>
<DL>
</DL>
</DL>
<HR>
<A NAME="blobFile"><!-- --></A><H3>
blobFile</H3>
<PRE>
private java.io.File <B>blobFile</B></PRE>
<DL>
<DD>The name of the temporary BLOB disk file.
<P>
<DL>
</DL>
</DL>
<HR>
<A NAME="raFile"><!-- --></A><H3>
raFile</H3>
<PRE>
private java.io.RandomAccessFile <B>raFile</B></PRE>
<DL>
<DD>The RA file object reference or null if closed.
<P>
<DL>
</DL>
</DL>
<HR>
<A NAME="bufferDirty"><!-- --></A><H3>
bufferDirty</H3>
<PRE>
private boolean <B>bufferDirty</B></PRE>
<DL>
<DD>Indicates page in memory must be saved.
<P>
<DL>
</DL>
</DL>
<HR>
<A NAME="openCount"><!-- --></A><H3>
openCount</H3>
<PRE>
private int <B>openCount</B></PRE>
<DL>
<DD>Count of callers that have opened the BLOB file.
<P>
<DL>
</DL>
</DL>
<HR>
<A NAME="isMemOnly"><!-- --></A><H3>
isMemOnly</H3>
<PRE>
private boolean <B>isMemOnly</B></PRE>
<DL>
<DD>True if attempts to create a BLOB file have failed.
<P>
<DL>
</DL>
</DL>
<HR>
<A NAME="bufferDir"><!-- --></A><H3>
bufferDir</H3>
<PRE>
private final java.io.File <B>bufferDir</B></PRE>
<DL>
<DD>The directory to buffer data to.
<P>
<DL>
</DL>
</DL>
<HR>
<A NAME="maxMemSize"><!-- --></A><H3>
maxMemSize</H3>
<PRE>
private final int <B>maxMemSize</B></PRE>
<DL>
<DD>The maximum size of an in memory buffer.
<P>
<DL>
</DL>
</DL>
<!-- ========= CONSTRUCTOR DETAIL ======== -->
<A NAME="constructor_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Constructor Detail</B></FONT></TD>
</TR>
</TABLE>
<A NAME="BlobBuffer(java.io.File, long)"><!-- --></A><H3>
BlobBuffer</H3>
<PRE>
public <B>BlobBuffer</B>(java.io.File bufferDir,
long maxMemSize)</PRE>
<DL>
<DD>Creates a blob buffer.
<P>
<DT><B>Parameters:</B><DD><CODE>bufferDir</CODE> - <DD><CODE>maxMemSize</CODE> - the maximum size of the in memory buffer</DL>
<!-- ============ METHOD DETAIL ========== -->
<A NAME="method_detail"><!-- --></A>
<TABLE BORDER="1" WIDTH="100%" CELLPADDING="3" CELLSPACING="0" SUMMARY="">
<TR BGCOLOR="#CCCCFF" CLASS="TableHeadingColor">
<TD COLSPAN=1><FONT SIZE="+2">
<B>Method Detail</B></FONT></TD>
</TR>
</TABLE>
<A NAME="finalize()"><!-- --></A><H3>
finalize</H3>
<PRE>
protected void <B>finalize</B>()
throws java.lang.Throwable</PRE>
<DL>
<DD>Finalizes this object by deleting any work files.
<P>
<DD><DL>
<DT><B>Throws:</B>
<DD><CODE>java.lang.Throwable</CODE></DL>
</DD>
</DL>
<HR>
<A NAME="createBlobFile()"><!-- --></A><H3>
createBlobFile</H3>
<PRE>
public void <B>createBlobFile</B>()</PRE>
<DL>
<DD>Creates a random access disk file to use as backing storage for the LOB
data.
<p/>
This method may fail due to security exceptions or local disk problems,
in which case the blob storage will remain entirely in memory.
<P>
<DD><DL>
</DL>
</DD>
</DL>
<HR>
<A NAME="open()"><!-- --></A><H3>
open</H3>
<PRE>
public void <B>open</B>()
throws java.io.IOException</PRE>
<DL>
<DD>Opens the BLOB disk file.
<p/>
A count of open and close requests is kept so that the file may be
closed when no longer required thus keeping the number of open files to
a minimum.
<P>
<DD><DL>
<DT><B>Throws:</B>
<DD><CODE>java.io.IOException</CODE> - if an I/O error occurs</DL>
</DD>
</DL>
<HR>
<A NAME="read(int)"><!-- --></A><H3>
read</H3>
<PRE>
public int <B>read</B>(int readPtr)
throws java.io.IOException</PRE>
<DL>
<DD>Reads byte from the BLOB buffer at the specified location.
<p/>
The read pointer is partitioned into a page number and an offset within
the page. This routine will read new pages as required. The page size
must be a power of 2 and is currently set to 1024 bytes.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>readPtr</CODE> - the offset in the buffer of the required byte
<DT><B>Returns:</B><DD>the byte value as an <code>int</code> or -1 if at EOF
<DT><B>Throws:</B>
<DD><CODE>java.io.IOException</CODE> - if an I/O error occurs</DL>
</DD>
</DL>
<HR>
<A NAME="read(int, byte[], int, int)"><!-- --></A><H3>
read</H3>
<PRE>
public int <B>read</B>(int readPtr,
byte[] bytes,
int offset,
int len)
throws java.io.IOException</PRE>
<DL>
<DD>Reads bytes from the BLOB buffer at the specified location.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>readPtr</CODE> - the offset in the buffer of the required byte<DD><CODE>bytes</CODE> - the byte array to fill<DD><CODE>offset</CODE> - the start position in the byte array<DD><CODE>len</CODE> - the number of bytes to read
<DT><B>Returns:</B><DD>the number of bytes read or -1 if at end of file
<DT><B>Throws:</B>
<DD><CODE>java.io.IOException</CODE> - if an I/O error occurs</DL>
</DD>
</DL>
<HR>
<A NAME="write(int, int)"><!-- --></A><H3>
write</H3>
<PRE>
public void <B>write</B>(int writePtr,
int b)
throws java.io.IOException</PRE>
<DL>
<DD>Inserts a byte into the buffer at the specified location.
<p/>
The write pointer is partitioned into a page number and an offset within
the page. This routine will write new pages as required. The page size
must be a power of 2 and is currently set to 1024 bytes.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>writePtr</CODE> - the offset in the buffer of the required byte<DD><CODE>b</CODE> - the byte value to write
<DT><B>Throws:</B>
<DD><CODE>java.io.IOException</CODE> - if an I/O error occurs</DL>
</DD>
</DL>
<HR>
<A NAME="write(int, byte[], int, int)"><!-- --></A><H3>
write</H3>
<PRE>
void <B>write</B>(int writePtr,
byte[] bytes,
int offset,
int len)
throws java.io.IOException</PRE>
<DL>
<DD>Inserts bytes into the buffer at the specified location.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>writePtr</CODE> - the offset in the buffer of the required byte<DD><CODE>bytes</CODE> - the byte array value to write<DD><CODE>offset</CODE> - the start position in the byte array<DD><CODE>len</CODE> - the number of bytes to write
<DT><B>Throws:</B>
<DD><CODE>java.io.IOException</CODE> - if an I/O error occurs</DL>
</DD>
</DL>
<HR>
<A NAME="readPage(int)"><!-- --></A><H3>
readPage</H3>
<PRE>
public void <B>readPage</B>(int page)
throws java.io.IOException</PRE>
<DL>
<DD>Reads in the specified page from the disk buffer.
<p/>
Any existing dirty page is first saved to disk.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>page</CODE> - the page number
<DT><B>Throws:</B>
<DD><CODE>java.io.IOException</CODE> - if an I/O error occurs</DL>
</DD>
</DL>
<HR>
<A NAME="writePage(int)"><!-- --></A><H3>
writePage</H3>
<PRE>
public void <B>writePage</B>(int page)
throws java.io.IOException</PRE>
<DL>
<DD>Writes the specified page to the disk buffer.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>page</CODE> - the page number
<DT><B>Throws:</B>
<DD><CODE>java.io.IOException</CODE> - if an I/O error occurs</DL>
</DD>
</DL>
<HR>
<A NAME="close()"><!-- --></A><H3>
close</H3>
<PRE>
public void <B>close</B>()
throws java.io.IOException</PRE>
<DL>
<DD>Logically closes the file or physically close it if the open count is
now zero.
<p/>
Any updated buffer in memory is flushed to disk before the file is
closed.
<P>
<DD><DL>
<DT><B>Throws:</B>
<DD><CODE>java.io.IOException</CODE> - if an I/O error occurs</DL>
</DD>
</DL>
<HR>
<A NAME="growBuffer(int)"><!-- --></A><H3>
growBuffer</H3>
<PRE>
public void <B>growBuffer</B>(int minSize)</PRE>
<DL>
<DD>Increases the size of the in memory buffer for situations where disk
storage of BLOB is not possible.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>minSize</CODE> - the minimum size of buffer required</DL>
</DD>
</DL>
<HR>
<A NAME="setBuffer(byte[], boolean)"><!-- --></A><H3>
setBuffer</H3>
<PRE>
public void <B>setBuffer</B>(byte[] bytes,
boolean copy)</PRE>
<DL>
<DD>Sets the initial buffer to an existing byte array.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>bytes</CODE> - the byte array containing the BLOB data<DD><CODE>copy</CODE> - true if a local copy of the data is required</DL>
</DD>
</DL>
<HR>
<A NAME="getBytes(long, int)"><!-- --></A><H3>
getBytes</H3>
<PRE>
public byte[] <B>getBytes</B>(long pos,
int len)
throws java.sql.SQLException</PRE>
<DL>
<DD>Returns the BLOB data as a byte array.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>pos</CODE> - the start position in the BLOB buffer (from 1)<DD><CODE>len</CODE> - the number of bytes to copy
<DT><B>Returns:</B><DD>the requested data as a <code>byte[]</code>
<DT><B>Throws:</B>
<DD><CODE>java.sql.SQLException</CODE></DL>
</DD>
</DL>
<HR>
<A NAME="getBinaryStream(boolean)"><!-- --></A><H3>
getBinaryStream</H3>
<PRE>
public java.io.InputStream <B>getBinaryStream</B>(boolean ascii)
throws java.sql.SQLException</PRE>
<DL>
<DD>Retrieve the BLOB data as an <code>InputStream</code>.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>ascii</CODE> - true if an ASCII input stream should be returned
<DT><B>Returns:</B><DD>the <code>InputStream</code> built over the BLOB data
<DT><B>Throws:</B>
<DD><CODE>java.sql.SQLException</CODE> - if an error occurs</DL>
</DD>
</DL>
<HR>
<A NAME="getUnicodeStream()"><!-- --></A><H3>
getUnicodeStream</H3>
<PRE>
public java.io.InputStream <B>getUnicodeStream</B>()
throws java.sql.SQLException</PRE>
<DL>
<DD>Retrieve the BLOB data as an Big Endian Unicode
<code>InputStream</code>.
<P>
<DD><DL>
<DT><B>Returns:</B><DD>the <code>InputStream</code> built over the BLOB data
<DT><B>Throws:</B>
<DD><CODE>java.sql.SQLException</CODE> - if an error occurs</DL>
</DD>
</DL>
<HR>
<A NAME="setBinaryStream(long, boolean)"><!-- --></A><H3>
setBinaryStream</H3>
<PRE>
public java.io.OutputStream <B>setBinaryStream</B>(long pos,
boolean ascii)
throws java.sql.SQLException</PRE>
<DL>
<DD>Creates an <code>OutputStream</code> that can be used to update the
BLOB.
<p/>
Given that we cannot know the final size of a BLOB created by the caller
of this method, we assume the worst and create a disk BLOB by default.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>pos</CODE> - the start position in the buffer (from 1)<DD><CODE>ascii</CODE> - true if an ASCII output stream is required
<DT><B>Returns:</B><DD>the <code>OutputStream</code> to be used to update the BLOB
<DT><B>Throws:</B>
<DD><CODE>java.sql.SQLException</CODE> - if an error occurs</DL>
</DD>
</DL>
<HR>
<A NAME="setBytes(long, byte[], int, int, boolean)"><!-- --></A><H3>
setBytes</H3>
<PRE>
public int <B>setBytes</B>(long pos,
byte[] bytes,
int offset,
int len,
boolean copy)
throws java.sql.SQLException</PRE>
<DL>
<DD>Sets the content of the BLOB to the supplied byte array value.
<p/>
If the following conditions are met:
<ol>
<li>The start position is 1
<li>The existing BLOB length is smaller or the same as the length of
the new data
<li>The new data length does not exceed the in memory limit
</ol>
then the new data is buffered entirely in memory, otherwise a disk file
is created.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>pos</CODE> - the start position in the buffer (from 1)<DD><CODE>bytes</CODE> - the byte array containing the data to copy<DD><CODE>offset</CODE> - the start position in the byte array (from 0)<DD><CODE>len</CODE> - the number of bytes to copy<DD><CODE>copy</CODE> - true if a local copy of the byte array is required
<DT><B>Returns:</B><DD>the number of bytes copied
<DT><B>Throws:</B>
<DD><CODE>java.sql.SQLException</CODE> - if an error occurs</DL>
</DD>
</DL>
<HR>
<A NAME="getLength()"><!-- --></A><H3>
getLength</H3>
<PRE>
public long <B>getLength</B>()</PRE>
<DL>
<DD>Retrieves the length of this BLOB buffer in bytes.
<P>
<DD><DL>
<DT><B>Returns:</B><DD>the length of the BLOB data in bytes</DL>
</DD>
</DL>
<HR>
<A NAME="setLength(long)"><!-- --></A><H3>
setLength</H3>
<PRE>
public void <B>setLength</B>(long length)</PRE>
<DL>
<DD>Retrieves the length of the BLOB buffer (in memory version only).
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>length</CODE> - the length of the valid data in the buffer</DL>
</DD>
</DL>
<HR>
<A NAME="truncate(long)"><!-- --></A><H3>
truncate</H3>
<PRE>
public void <B>truncate</B>(long len)
throws java.sql.SQLException</PRE>
<DL>
<DD>Truncates the BLOB buffer to the specified size.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>len</CODE> - the required length
<DT><B>Throws:</B>
<DD><CODE>java.sql.SQLException</CODE> - if an error occurs</DL>
</DD>
</DL>
<HR>
<A NAME="position(byte[], long)"><!-- --></A><H3>
position</H3>
<PRE>
public int <B>position</B>(byte[] pattern,
long start)
throws java.sql.SQLException</PRE>
<DL>
<DD>Provides support for pattern searching methods.
<P>
<DD><DL>
<DT><B>Parameters:</B><DD><CODE>pattern</CODE> - the byte array containg the search pattern<DD><CODE>start</CODE> - the start position in the BLOB (from 1)
<DT><B>Returns:</B><DD>the <code>int</code> start index for the pattern (from 1) or -1
if the pattern is not found.
<DT><B>Throws:</B>
<DD><CODE>java.sql.SQLException</CODE> - if an error occurs</DL>
</DD>
</DL>
<!-- ========= END OF CLASS DATA ========= -->
<HR>
<!-- ======= START OF BOTTOM NAVBAR ====== -->
<A NAME="navbar_bottom"><!-- --></A>
<A HREF="#skip-navbar_bottom" title="Skip navigation links"></A>
<TABLE BORDER="0" WIDTH="100%" CELLPADDING="1" CELLSPACING="0" SUMMARY="">
<TR>
<TD COLSPAN=3 BGCOLOR="#EEEEFF" CLASS="NavBarCell1">
<A NAME="navbar_bottom_firstrow"><!-- --></A>
<TABLE BORDER="0" CELLPADDING="0" CELLSPACING="3" SUMMARY="">
<TR ALIGN="center" VALIGN="top">
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../overview-summary.html"><FONT CLASS="NavBarFont1"><B>Overview</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-summary.html"><FONT CLASS="NavBarFont1"><B>Package</B></FONT></A> </TD>
<TD BGCOLOR="#FFFFFF" CLASS="NavBarCell1Rev"> <FONT CLASS="NavBarFont1Rev"><B>Class</B></FONT> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="class-use/BlobBuffer.html"><FONT CLASS="NavBarFont1"><B>Use</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="package-tree.html"><FONT CLASS="NavBarFont1"><B>Tree</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../deprecated-list.html"><FONT CLASS="NavBarFont1"><B>Deprecated</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../index-all.html"><FONT CLASS="NavBarFont1"><B>Index</B></FONT></A> </TD>
<TD BGCOLOR="#EEEEFF" CLASS="NavBarCell1"> <A HREF="../../../../help-doc.html"><FONT CLASS="NavBarFont1"><B>Help</B></FONT></A> </TD>
</TR>
</TABLE>
</TD>
<TD ALIGN="right" VALIGN="top" ROWSPAN=3><EM>
</EM>
</TD>
</TR>
<TR>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
PREV CLASS
<A HREF="../../../../net/sourceforge/jtds/util/BlobBuffer.AsciiInputStream.html" title="class in net.sourceforge.jtds.util"><B>NEXT CLASS</B></A></FONT></TD>
<TD BGCOLOR="white" CLASS="NavBarCell2"><FONT SIZE="-2">
<A HREF="../../../../index.html" target="_top"><B>FRAMES</B></A>
<A HREF="BlobBuffer.html" target="_top"><B>NO FRAMES</B></A>
<SCRIPT type="text/javascript">
<!--
if(window==top) {
document.writeln('<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>');
}
//-->
</SCRIPT>
<NOSCRIPT>
<A HREF="../../../../allclasses-noframe.html"><B>All Classes</B></A>
</NOSCRIPT>
</FONT></TD>
</TR>
<TR>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
SUMMARY: <A HREF="#nested_class_summary">NESTED</A> | <A HREF="#field_summary">FIELD</A> | <A HREF="#constructor_summary">CONSTR</A> | <A HREF="#method_summary">METHOD</A></FONT></TD>
<TD VALIGN="top" CLASS="NavBarCell3"><FONT SIZE="-2">
DETAIL: <A HREF="#field_detail">FIELD</A> | <A HREF="#constructor_detail">CONSTR</A> | <A HREF="#method_detail">METHOD</A></FONT></TD>
</TR>
</TABLE>
<A NAME="skip-navbar_bottom"></A>
<!-- ======== END OF BOTTOM NAVBAR ======= -->
<HR>
Generated on December 30 2009
</BODY>
</HTML>
|