Skip to main content
aboutsummaryrefslogtreecommitdiffstats
blob: 29142800a25beef5c0edddff5746a5c1061bb99a (plain) (blame)
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
/**
 * Copyright (c) 2004 - 2011 Eike Stepper (Berlin, Germany) and others.
 * All rights reserved. This program and the accompanying materials
 * are made available under the terms of the Eclipse Public License v1.0
 * which accompanies this distribution, and is available at
 * http://www.eclipse.org/legal/epl-v10.html
 *
 * Contributors:
 *    Eike Stepper - initial API and implementation
 */
package org.eclipse.emf.cdo.common.lob;

import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.io.Reader;

/**
 * Stores and loads {@link CDOLob large objects}.
 * 
 * @author Eike Stepper
 * @since 4.0
 */
public interface CDOLobStore
{
  public File getBinaryFile(byte[] id);

  public InputStream getBinary(CDOLobInfo info) throws IOException;

  public CDOLobInfo putBinary(InputStream contents) throws IOException;

  public File getCharacterFile(byte[] id);

  public Reader getCharacter(CDOLobInfo info) throws IOException;

  public CDOLobInfo putCharacter(Reader contents) throws IOException;

  /**
   * @author Eike Stepper
   */
  public static abstract class Delegating implements CDOLobStore
  {
    public File getBinaryFile(byte[] id)
    {
      return getDelegate().getBinaryFile(id);
    }

    public InputStream getBinary(CDOLobInfo info) throws IOException
    {
      return getDelegate().getBinary(info);
    }

    public CDOLobInfo putBinary(InputStream contents) throws IOException
    {
      return getDelegate().putBinary(contents);
    }

    public File getCharacterFile(byte[] id)
    {
      return getDelegate().getCharacterFile(id);
    }

    public Reader getCharacter(CDOLobInfo info) throws IOException
    {
      return getDelegate().getCharacter(info);
    }

    public CDOLobInfo putCharacter(Reader contents) throws IOException
    {
      return getDelegate().putCharacter(contents);
    }

    protected abstract CDOLobStore getDelegate();
  }
}

Back to the top