01: /* ====================================================================
02: Licensed to the Apache Software Foundation (ASF) under one or more
03: contributor license agreements. See the NOTICE file distributed with
04: this work for additional information regarding copyright ownership.
05: The ASF licenses this file to You under the Apache License, Version 2.0
06: (the "License"); you may not use this file except in compliance with
07: the License. You may obtain a copy of the License at
08:
09: http://www.apache.org/licenses/LICENSE-2.0
10:
11: Unless required by applicable law or agreed to in writing, software
12: distributed under the License is distributed on an "AS IS" BASIS,
13: WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14: See the License for the specific language governing permissions and
15: limitations under the License.
16: ==================================================================== */
17: package org.apache.poi.hdgf.streams;
18:
19: /**
20: * Holds the representation of the stream on-disk, and
21: * handles de-compressing it as required.
22: * In future, may also handle writing it back out again
23: */
24: public class StreamStore {
25: private byte[] contents;
26:
27: /**
28: * Creates a new, non compressed Stream Store
29: */
30: protected StreamStore(byte[] data, int offset, int length) {
31: contents = new byte[length];
32: System.arraycopy(data, offset, contents, 0, length);
33: }
34:
35: protected void prependContentsWith(byte[] b) {
36: byte[] newContents = new byte[contents.length + b.length];
37: System.arraycopy(b, 0, newContents, 0, b.length);
38: System.arraycopy(contents, 0, newContents, b.length,
39: contents.length);
40: contents = newContents;
41: }
42:
43: protected void copyBlockHeaderToContents() {
44: }
45:
46: protected byte[] getContents() {
47: return contents;
48: }
49:
50: public byte[] _getContents() {
51: return contents;
52: }
53: }
|