EMMA Coverage Report (generated Sun Mar 01 22:06:14 CET 2015)
[all classes][org.h2.store]

COVERAGE SUMMARY FOR SOURCE FILE [LobStorageFrontend.java]

nameclass, %method, %block, %line, %
LobStorageFrontend.java100% (1/1)50%  (5/10)71%  (37/52)64%  (9/14)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class LobStorageFrontend100% (1/1)50%  (5/10)71%  (37/52)64%  (9/14)
copyLob (ValueLobDb, int, long): ValueLobDb 0%   (0/1)0%   (0/4)0%   (0/1)
init (): void 0%   (0/1)0%   (0/1)0%   (0/1)
isReadOnly (): boolean 0%   (0/1)0%   (0/2)0%   (0/1)
removeAllForTable (int): void 0%   (0/1)0%   (0/4)0%   (0/1)
setTable (ValueLobDb, int): void 0%   (0/1)0%   (0/4)0%   (0/1)
LobStorageFrontend (DataHandler): void 100% (1/1)100% (6/6)100% (3/3)
createBlob (InputStream, long): Value 100% (1/1)100% (6/6)100% (1/1)
createClob (Reader, long): Value 100% (1/1)100% (6/6)100% (1/1)
getInputStream (ValueLobDb, byte [], long): InputStream 100% (1/1)100% (18/18)100% (3/3)
removeLob (ValueLobDb): void 100% (1/1)100% (1/1)100% (1/1)

1/*
2 * Copyright 2004-2014 H2 Group. Multiple-Licensed under the MPL 2.0,
3 * and the EPL 1.0 (http://h2database.com/html/license.html).
4 * Initial Developer: H2 Group
5 */
6package org.h2.store;
7 
8import java.io.BufferedInputStream;
9import java.io.IOException;
10import java.io.InputStream;
11import java.io.Reader;
12import org.h2.value.Value;
13import org.h2.value.ValueLobDb;
14 
15/**
16 * This factory creates in-memory objects and temporary files. It is used on the
17 * client side.
18 */
19public class LobStorageFrontend implements LobStorageInterface {
20 
21    /**
22     * The table id for session variables (LOBs not assigned to a table).
23     */
24    public static final int TABLE_ID_SESSION_VARIABLE = -1;
25 
26    /**
27     * The table id for temporary objects (not assigned to any object).
28     */
29    public static final int TABLE_TEMP = -2;
30 
31    /**
32     * The table id for result sets.
33     */
34    public static final int TABLE_RESULT = -3;
35 
36    private final DataHandler handler;
37 
38    public LobStorageFrontend(DataHandler handler) {
39        this.handler = handler;
40    }
41 
42    @Override
43    public void removeLob(ValueLobDb lob) {
44        // not stored in the database
45    }
46 
47    /**
48     * Get the input stream for the given lob.
49     *
50     * @param lob the lob
51     * @param hmac the message authentication code (for remote input streams)
52     * @param byteCount the number of bytes to read, or -1 if not known
53     * @return the stream
54     */
55    @Override
56    public InputStream getInputStream(ValueLobDb lob, byte[] hmac,
57            long byteCount) throws IOException {
58        if (byteCount < 0) {
59            byteCount = Long.MAX_VALUE;
60        }
61        return new BufferedInputStream(new LobStorageRemoteInputStream(
62                handler, lob, hmac, byteCount));
63    }
64 
65    @Override
66    public boolean isReadOnly() {
67        return false;
68    }
69 
70    @Override
71    public ValueLobDb copyLob(ValueLobDb old, int tableId, long length) {
72        throw new UnsupportedOperationException();
73    }
74 
75    @Override
76    public void setTable(ValueLobDb lob, int tableIdSessionVariable) {
77        throw new UnsupportedOperationException();
78    }
79 
80    @Override
81    public void removeAllForTable(int tableId) {
82        throw new UnsupportedOperationException();
83    }
84 
85    @Override
86    public Value createBlob(InputStream in, long maxLength) {
87        // need to use a temp file, because the input stream could come from
88        // the same database, which would create a weird situation (trying
89        // to read a block while writing something)
90        return ValueLobDb.createTempBlob(in, maxLength, handler);
91    }
92 
93    /**
94     * Create a CLOB object.
95     *
96     * @param reader the reader
97     * @param maxLength the maximum length (-1 if not known)
98     * @return the LOB
99     */
100    @Override
101    public Value createClob(Reader reader, long maxLength) {
102        // need to use a temp file, because the input stream could come from
103        // the same database, which would create a weird situation (trying
104        // to read a block while writing something)
105        return ValueLobDb.createTempClob(reader, maxLength, handler);
106    }
107 
108    @Override
109    public void init() {
110        // nothing to do
111    }
112 
113}

[all classes][org.h2.store]
EMMA 2.0.5312 (C) Vladimir Roubtsov