Source Code Cross Referenced for ByteHolder.java in  » Database-DBMS » db-derby-10.2 » org » apache » derby » impl » store » raw » data » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database DBMS » db derby 10.2 » org.apache.derby.impl.store.raw.data 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        /*
002:
003:           Derby - Class org.apache.derby.impl.store.raw.data.ByteHolder
004:
005:           Licensed to the Apache Software Foundation (ASF) under one or more
006:           contributor license agreements.  See the NOTICE file distributed with
007:           this work for additional information regarding copyright ownership.
008:           The ASF licenses this file to you under the Apache License, Version 2.0
009:           (the "License"); you may not use this file except in compliance with
010:           the License.  You may obtain a copy of the License at
011:
012:              http://www.apache.org/licenses/LICENSE-2.0
013:
014:           Unless required by applicable law or agreed to in writing, software
015:           distributed under the License is distributed on an "AS IS" BASIS,
016:           WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
017:           See the License for the specific language governing permissions and
018:           limitations under the License.
019:
020:         */
021:
022:        package org.apache.derby.impl.store.raw.data;
023:
024:        import org.apache.derby.iapi.services.sanity.SanityManager;
025:
026:        import java.io.IOException;
027:        import java.io.InputStream;
028:        import java.io.OutputStream;
029:        import java.util.Vector;
030:
031:        /**
032:         Holder for a growing sequence of bytes. The ByteHolder supports a
033:         writing phase in which a caller appends bytes to the ByteHolder. 
034:         Later the caller may read the bytes out of the ByteHolder in
035:         the order they were written.
036:         */
037:        public interface ByteHolder {
038:            /**
039:              Write a byte to this ByteHolder.
040:
041:              <P>The ByteHolder must be in writing mode to call this.
042:             */
043:            public void write(int b) throws IOException;
044:
045:            /**
046:              Write len bytes of data starting at 'offset' to this ByteHolder.
047:
048:              <P>The ByteHolder must be in writing mode to call this.
049:             */
050:            public void write(byte[] data, int offset, int len)
051:                    throws IOException;
052:
053:            /**	
054:              Write up to count bytes from an input stream to this
055:              ByteHolder. This may write fewer bytes if it encounters
056:              an end of file on the input stream.
057:
058:              @return the number of bytes written.
059:              @exception IOException thrown when reading in causes an
060:              error.
061:             */
062:            public long write(InputStream in, long count) throws IOException;
063:
064:            /**
065:              Clear the bytes from the ByteHolder and place it in writing
066:              mode. This may not free the memory the ByteHolder uses to
067:              store data.
068:             */
069:            public void clear() throws IOException;
070:
071:            /**
072:              Place a ByteHolder in reading mode. After this call,
073:              reads scan bytes sequentially in the order they were
074:              written to the ByteHolder starting from the first byte.
075:              When the ByteHolder is already in readmode this simply
076:              arranges for reads to start at the beginning of the
077:              sequence of saved bytes.
078:             */
079:            public void startReading() throws IOException;
080:
081:            /**
082:              Read a byte from this ByteHolder.
083:
084:              <P>The ByteHolder must be in reading mode to call this.
085:
086:              @return The byte or -1 if there are no bytes available.
087:             */
088:            public int read() throws IOException;
089:
090:            /**
091:              Read up to 'len' bytes from this ByteHolder and store them in
092:              an array at offset 'off'.
093:
094:              <P>The ByteHolder must be in reading mode to call this.
095:
096:              @return the number of bytes read or -1 if the this ByteHolder
097:              has no more bytes.
098:             */
099:            public int read(byte b[], int off, int len) throws IOException;
100:
101:            /**
102:              Read from the ByteHolder.
103:              <p>
104:              Read up to 'len' bytes from this ByteHolder and write them to
105:              the OutputStream
106:
107:              <P>The ByteHolder must be in reading mode to call this.
108:
109:              @return the number of bytes read or -1 if the this ByteHolder
110:              has no more bytes.
111:             */
112:            public int read(OutputStream out, int len) throws IOException;
113:
114:            /**
115:              shift the remaining unread bytes to the beginning of the byte holder
116:             */
117:            public int shiftToFront() throws IOException;
118:
119:            /**
120:              Return the number of bytes that can be read from this ByteHolder
121:              without blocking on an IO.
122:             */
123:            public int available() throws IOException;
124:
125:            /**
126:              Return the number of bytes that have been saved to this byte holder.
127:              This result is different from available() as it is unaffected by the
128:              current read position on the ByteHolder.
129:             */
130:            public int numBytesSaved() throws IOException;
131:
132:            /**
133:              Skip over the specified number of bytes in a ByteHolder.
134:             */
135:            public long skip(long count) throws IOException;
136:
137:            /**
138:              Return true if this is in writing mode.
139:             */
140:            public boolean writingMode();
141:        }
w_w__w._ja___va2__s.__c__o__m__ | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.